On Oct 23, 2010, at 2:41 AM, Ken Ferry wrote:

On Oct 22, 2010, at 4:07 PM, Iceberg-Dev <dev.iceb...@gmail.com> wrote:

On Oct 22, 2010, at 12:48 AM, Iceberg-Dev wrote:

I'm currently playing with a screen saver.

Problem:
--------

It draws correctly in fullscreen mode or in SaverLab but does not in the preview mode of the 'Desktop & Screen Saver' pane of the System Preferences.

Basically, in #fail mode, it draws the first frame and then does not refresh.

It works on Mac OS X 10.4 but does not on Mac OS X 10.5 and 10.6.

[...]

QUESTION:
---------

What can be done to address this behavioral incoherence in System Preferences?

I solved the issue on Mac OS X 10.6 by calling lockFocusOnRepresentation: and unlockFocus before and after I refresh the bitmap buffer.

Funnily enough, this bug also exists with the CoreGraphics API.

Hi-

This isn't a bug, and your workaround could break under you at any time.

If you think about what has to happen, you'll realize you cannot just have permanent direct access to the backing store. The image has to be colormatched and possibly uploaded to the graphics card, for example. How are the frameworks to know if you toggled a bit and that work must be redone? The basic CG model for an image is that it's immutable.

Thanks for the hints. I tried them this weekend.

When working with NSBitmapImageRep, calling -bitmapData is a signal that you may be editing the data. It is not repackaged until the bitmap is drawn, or somesuch. It's illegal to just stash a pointer to the data and use it arbitrarily later - that won't necessarily be the same data as now backs the image. This is described in the 10.6 AppKit release notes.

Calling -bitmapData works on Mac OS X 10.5, it does not work on Mac OS X 10.6. On 10.6, it's slow and the data gets zeroed. Bug?

In CG, you may be interested in the relationship of CGBitmapContext to CGBitmapContextCreateImage. The latter makes a copy-on-write vm copy of the data from bitmap context. So it's cheap until real copying is forced by a write to the context data.

I tried this solution and it's way too slow (or I'm doing it incorrectly). Having to create a CGImageRef and then releasing it is killing the framerate.


Basically, the only solution to get a decent framerate (25 fps) and a real refresh is to:

- call -bitmapData on Mac OS X 10.5.

- call lockFocusOnRepresentation: on Mac OS X 10.6.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to