• 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
Re: Faster drawing sprite and background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Faster drawing sprite and background


  • Subject: Re: Faster drawing sprite and background
  • From: jean-michel daix <email@hidden>
  • Date: Mon, 08 Oct 2001 18:34:59 +0200

Thank you all for you help.

This 3 lines made my day :

- (BOOL)isOpaque {
return YES;
}

My fps jumped from 28 to 78. It was exactly what I was looking for.

For those who are interested by this topic, take a look at the CircleView
example in Developer Example folder. (I forgot it in my search).



> On Monday, October 8, 2001, at 01:19 PM, jean-michel daix wrote:
>
>> I'm using a NSView based Cocoa application basicely drawing a
>> background and
>> a sprite. My problem is "drawRect". My background is a 640x480 image
>> and so
>> it can only be drawed about 12 time by second on my G4 400 (12 fps). I
>> don't
>> want to redraw all my background all the time for sure, I just want to
>> redraw the sprite and a part of the background. But, tell me if I'm
>> wrong,
>> "drawRect" is made to redraw all the content of the NSView.

> ********************************************
> Sometimes you get better repeated drawing performance with bitmap images
> if you call [image lockFocus]; [image unlockFocus]; once to force the
> image to create a cache (at least if you use composite... operations).
> Otherwise the image may be doing format conversions etc every time it is
> composited.
>
> Regards.
> John Hornkvist

> ********************************************
> I think its parameter though is the dirty bounds that needs to be redrawn,
> so that would be at least one for of optimization. If your drawRect
> method also draws all of the view's contents, then override the isOpaque
> method and return YES.
>
> Although, if you need high fps rates, I strongly suggest looking into
> OpenGL...it's not just for 3D.
>
> HTH,
>
> Rick Sharp
> Instant Interactive(tm)

> ********************************************
> That depends on the particular implementation of -drawRect:. As it
> happens, a lot of developers don't bother to use the given rect to limit
> the amount of drawing they have to do.


> You might want to look into using the NSCell class.

> -jcr


  • Prev by Date: Background application, floating window and title bar.
  • Next by Date: Re: cocoa-dev digest, Vol 1 #687 - 10 msgs
  • Previous by thread: Re: Faster drawing sprite and background
  • Next by thread: Internet Connect, 2nd
  • Index(es):
    • Date
    • Thread