NSWindow and Core Anim - flickering
NSWindow and Core Anim - flickering
- Subject: NSWindow and Core Anim - flickering
- From: John Clayton <email@hidden>
- Date: Tue, 20 Nov 2007 13:11:57 +0100
Hello All,
I have an NSWindow instance that is entirely transparent (background
color of the window has alpha with 0) which is sitting over another
NSView that has its content rendered via Core Animation, lets call
this the 'backdrop'. The 'backdrop' is rendering arbitrarily complex
CALayer hierarchies via CAOpenGLLayer.
On this 'overlay' NSWindow [that is sitting above the 'backdrop'], I
have placed another NSView - lets call it the 'preview'.
When the 'preview' view is moved around, there is quite a lot of
flickering going on, almost for every movement of the mouse (but not
quite). The flickering is restricted to the bounds of the 'preview'
view.
If I change the code ever so slightly; and tell the 'overlay' that it
wants a layer, like this:
overlay.wantsLayer = YES;
then run the code again - the *entire* overlay window area flickers
like mad.
I am more than happy to post snippets of code as required. Does
anyone have an idea of what this might be?
The window is init'd like this:
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)styleMask
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation
{
NSWindow* me = [super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES];
NSColor *blackTransparent =
[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:0.0];
[me setBackgroundColor:blackTransparent];
[me setIsVisible:NO];
[me setHasShadow:NO];
[me setAcceptsMouseMovedEvents:YES];
[me setExcludedFromWindowsMenu:YES];
[me setIgnoresMouseEvents:NO];
[me setMovableByWindowBackground:NO];
[me setHidesOnDeactivate:NO];
[me setOpaque:NO];
// add a single view as the 'contentView', which is the same size as
the window and stretches
// appropriately to fit the content size
NSRect viewFrame = contentRect;
viewFrame.origin.x = 0;
viewFrame.origin.y = 0;
NSView* content = [[NSView alloc] initWithFrame:viewFrame];
[content setAutoresizesSubviews:YES];
[content setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self setContentView:content];
// if I enable this line below; flickering is seen across the
entire NSWindow frame when the 'preview'
// view is moved across it (this whole window is sitting on top of a
layer-backed view)
// content.wantsLayer = YES;
return me;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden