Commit 170d80dc authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Don't invalidate the window shadow on every draw if it's merely shaped…

winemac: Don't invalidate the window shadow on every draw if it's merely shaped and not color-keyed or using per-pixel alpha. This avoids flickering and tearing on some versions of OS X during frequent redrawing in a shaped window, such as when scrolling a document in Word 2007. Since we aren't guaranteed that the window surface has updated bits for us to draw, we mark the whole content view as needing redisplay and draw the window's shape in the background color on the first -drawRect: after the shape change.
parent 7c035744
......@@ -236,6 +236,17 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
if ([window contentView] != self)
return;
if (window.shapeChangedSinceLastDraw && window.shape && !window.colorKeyed && !window.usePerPixelAlpha)
{
[[NSColor clearColor] setFill];
NSRectFill(rect);
[window.shape addClip];
[[NSColor windowBackgroundColor] setFill];
NSRectFill(rect);
}
if (window.surface && window.surface_mutex &&
!pthread_mutex_lock(window.surface_mutex))
{
......@@ -289,7 +300,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
// If the window may be transparent, then we have to invalidate the
// shadow every time we draw. Also, if this is the first time we've
// drawn since changing from transparent to opaque.
if (![window isOpaque] || window.shapeChangedSinceLastDraw)
if (window.colorKeyed || window.usePerPixelAlpha || window.shapeChangedSinceLastDraw)
{
window.shapeChangedSinceLastDraw = FALSE;
[window invalidateShadow];
......@@ -1373,11 +1384,15 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
{
if (![self isOpaque] && !self.needsTransparency)
{
self.shapeChangedSinceLastDraw = TRUE;
[[self contentView] setNeedsDisplay:YES];
[self setBackgroundColor:[NSColor windowBackgroundColor]];
[self setOpaque:YES];
}
else if ([self isOpaque] && self.needsTransparency)
{
self.shapeChangedSinceLastDraw = TRUE;
[[self contentView] setNeedsDisplay:YES];
[self setBackgroundColor:[NSColor clearColor]];
[self setOpaque:NO];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment