• 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
NSView and setNeedsDisplayInRect:rect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSView and setNeedsDisplayInRect:rect


  • Subject: NSView and setNeedsDisplayInRect:rect
  • From: email@hidden
  • Date: Tue, 12 Nov 2002 02:18:44 +0100

Hello everybody!

I've been working on an application which should display a given
2D-vector. The app is rather simple and I use NSBezierPath to draw the
coordinate system as well as background and the vector. In the static
mode everything works just fine.

I then started experimenting with an NSTimer to animate a rotating
vector. In my first implementation i used the [vectorDisplay
setNeedsDisplay:YES] message to draw my custom NSView. This too worked
well, but I didn't get the performance I wanted. I then figured that I
could optimize my code by using the [vectorDisplay
setNeedsDisplayInRect:dirtyRect] since I then should be redrawing only
the updated part of the NSView. This however gave me some very
interesting (and not very welcome) graphical disorders which I don't
know how to treat.

In the first quarter of the coordinate system the vector is displayed
correctly, see picture:

http://homepage.mac.com/jontolof/.Pictures/VectorDisplay1.jpg

But when reaching the second quarter it seems like the updated
rectangle is very much wrong. See for yourself on the screenshot:

http://homepage.mac.com/jontolof/.Pictures/VectorDisplay2.jpg

Also when I use the Quarz debugger I get the following results:

http://homepage.mac.com/jontolof/.Pictures/VectorDisplayQuartz.jpg

...which is very strange because the dirtyRect that I send to the
setNeedsDisplayInRect:dirtyRect is an NSRect made by the origo and the
point of the vector.

This really bugs me and maybe I've misunderstood the entire
setNeedsDisplayInRect:dirtyRect - method, in that case, please help me
out.

In short, how do I get setNeedsDisplayInRect:dirtyRect to redraw but
the rectangle between the origo and the point of the vector?

Source code for those who find it helpful or interesting.

Thank you all in advance

/Jont Olof


http://homepage.mac.com/jontolof/.cv/jontolof/Public/
Programming Files/VectorViewSourceFiles/JOLVectorView.h-binhex.hqx

http://homepage.mac.com/jontolof/.cv/jontolof/Public/
Programming Files/VectorViewSourceFiles/JOLVectorView.m-binhex.hqx

http://homepage.mac.com/jontolof/.cv/jontolof/Public/
Programming Files/VectorViewSourceFiles/MyDocument.h-binhex.hqx

http://homepage.mac.com/jontolof/.cv/jontolof/Public/
Programming Files/VectorViewSourceFiles/MyDocument.m-binhex.hqx

http://homepage.mac.com/jontolof/.cv/jontolof/Public/
Programming Files/VectorViewSourceFiles/Vector.h-binhex.hqx

http://homepage.mac.com/jontolof/.cv/jontolof/Public/
Programming Files/VectorViewSourceFiles/Vector.m-binhex.hqx
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: "weak link" framework refs for 10.1 compatibility?
  • Next by Date: Re: OT: Web Objects -- Anybody using it?
  • Previous by thread: Re: NSView and setNeedsDisplayInRect:rect
  • Next by thread: Torturing NSToolbar
  • Index(es):
    • Date
    • Thread