• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
drawRect is getting the wrong Rectangle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

drawRect is getting the wrong Rectangle


  • Subject: drawRect is getting the wrong Rectangle
  • From: John Nairn <email@hidden>
  • Date: Thu, 26 May 2005 12:58:58 -0600

SinceĀ Tiger, my NSScrollView is messing up my view during redrawing or scrolling. I think I traced the problem to the drawRect method of my view getting the wrong rectangle. Here are results during running of the code:

1. The view is created, the bounds are set, data to plot are loaded, and setNeedsDisplay is set to YES to trigger drawing the plot. In this first pass, the rect passed to drawRect matches theĀ  bounds of the view.

setBounds {{-0.00375384, -0.0162667}, {0.0395077, 0.0285333}}
Plot data set 1 in view bounds {{-0.00375384, -0.0162667}, {0.0395077, 0.0285333}}
drawRect gets {{-0.00375384, -0.0162667}, {0.0395077, 0.0285333}}

2. To draw a new plot, the data are changed and for this problem the bounds are unchanged. The first line is printed when the new data are loading showing the view still has the same bounds. But, after setNeedsDisplay triggers an update, drawRect is now getting something different than the bounds and thus only part of the new plot is drawn and the update is wrong.

Plot data set 2 in view bounds {{-0.00375384, -0.0162667}, {0.0395077, 0.0285333}}
drawRect gets {{2.62138e-05, -0.0162667}, {0.0357276, 0.0285333}}
Plot data set 3 in view bounds {{-0.00375384, -0.0162667}, {0.0395077, 0.0285333}}
drawRect gets {{2.62138e-05, -0.0162667}, {0.0357276, 0.0285333}}

Thus, even though nothing has changed in my view, all subsequent needs to redraw are getting a different rectangle than the first time it draws. Even explicitly setting needs display in my view's bounds does not change the wrong rectangle getting to drawRect. It might be a coincidence, but the left edge of my bounds is negative and the bad rectangle passed on subsequent calls has left edge close to zero. The section of the plot with negative x coordinates is the part that does not draw correctly.

---------------

John Nairn (1-801-581-3413, FAX:1-801-581-4816)

Web Page: http://www.mse.utah.edu/~nairn


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Volume does not support setuid
  • Next by Date: Re: Cocoa bindings one- or bi-directional
  • Previous by thread: Volume does not support setuid
  • Next by thread: Tree controller bindings and @sum question
  • Index(es):
    • Date
    • Thread