Module: wine Branch: master Commit: 0e8b30502341ee9483d5f4cbc5878ae4a4787e1e URL: http://source.winehq.org/git/wine.git/?a=commit;h=0e8b30502341ee9483d5f4cbc5...
Author: Ken Thomases ken@codeweavers.com Date: Thu Mar 28 23:34:03 2013 -0500
winemac: Draw surface region rects separately instead of clipping one big draw.
---
dlls/winemac.drv/cocoa_window.m | 66 ++++++++++++++++++++------------------ 1 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 48ca593..279f81f 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -186,51 +186,55 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) if (window.surface && window.surface_mutex && !pthread_mutex_lock(window.surface_mutex)) { + CGRect bounds; const CGRect* rects; int count;
- if (!get_surface_region_rects(window.surface, &rects, &count) || count) + if (!get_surface_region_rects(window.surface, &rects, &count)) { - CGRect imageRect; - CGImageRef image; + bounds = NSRectToCGRect([self bounds]); + rects = &bounds; + count = 1; + }
- imageRect = NSRectToCGRect(rect); - image = create_surface_image(window.surface, &imageRect, FALSE); + if (count) + { + CGContextRef context; + int i;
- if (image) - { - CGContextRef context; + [window.shape addClip];
- if (rects && count) - { - NSBezierPath* surfaceClip = [NSBezierPath bezierPath]; - int i; - for (i = 0; i < count; i++) - [surfaceClip appendBezierPathWithRect:NSRectFromCGRect(rects[i])]; - [surfaceClip addClip]; - } + context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + CGContextSetBlendMode(context, kCGBlendModeCopy);
- [window.shape addClip]; + for (i = 0; i < count; i++) + { + CGRect imageRect; + CGImageRef image; + + imageRect = CGRectIntersection(rects[i], NSRectToCGRect(rect)); + image = create_surface_image(window.surface, &imageRect, FALSE);
- if (window.colorKeyed) + if (image) { - CGImageRef maskedImage; - CGFloat components[] = { window.colorKeyRed - 0.5, window.colorKeyRed + 0.5, - window.colorKeyGreen - 0.5, window.colorKeyGreen + 0.5, - window.colorKeyBlue - 0.5, window.colorKeyBlue + 0.5 }; - maskedImage = CGImageCreateWithMaskingColors(image, components); - if (maskedImage) + if (window.colorKeyed) { - CGImageRelease(image); - image = maskedImage; + CGImageRef maskedImage; + CGFloat components[] = { window.colorKeyRed - 0.5, window.colorKeyRed + 0.5, + window.colorKeyGreen - 0.5, window.colorKeyGreen + 0.5, + window.colorKeyBlue - 0.5, window.colorKeyBlue + 0.5 }; + maskedImage = CGImageCreateWithMaskingColors(image, components); + if (maskedImage) + { + CGImageRelease(image); + image = maskedImage; + } } - }
- context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - CGContextSetBlendMode(context, kCGBlendModeCopy); - CGContextDrawImage(context, imageRect, image); + CGContextDrawImage(context, imageRect, image);
- CGImageRelease(image); + CGImageRelease(image); + } } }