winemac: Draw surface region rects separately instead of clipping one big draw.
This commit is contained in:
parent
f7406e74ae
commit
0e8b305023
|
@ -186,32 +186,37 @@ - (void) drawRect:(NSRect)rect
|
||||||
if (window.surface && window.surface_mutex &&
|
if (window.surface && window.surface_mutex &&
|
||||||
!pthread_mutex_lock(window.surface_mutex))
|
!pthread_mutex_lock(window.surface_mutex))
|
||||||
{
|
{
|
||||||
|
CGRect bounds;
|
||||||
const CGRect* rects;
|
const CGRect* rects;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (!get_surface_region_rects(window.surface, &rects, &count) || count)
|
if (!get_surface_region_rects(window.surface, &rects, &count))
|
||||||
|
{
|
||||||
|
bounds = NSRectToCGRect([self bounds]);
|
||||||
|
rects = &bounds;
|
||||||
|
count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
|
CGContextRef context;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
[window.shape addClip];
|
||||||
|
|
||||||
|
context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||||
|
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
CGRect imageRect;
|
CGRect imageRect;
|
||||||
CGImageRef image;
|
CGImageRef image;
|
||||||
|
|
||||||
imageRect = NSRectToCGRect(rect);
|
imageRect = CGRectIntersection(rects[i], NSRectToCGRect(rect));
|
||||||
image = create_surface_image(window.surface, &imageRect, FALSE);
|
image = create_surface_image(window.surface, &imageRect, FALSE);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
CGContextRef context;
|
|
||||||
|
|
||||||
if (rects && count)
|
|
||||||
{
|
|
||||||
NSBezierPath* surfaceClip = [NSBezierPath bezierPath];
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
[surfaceClip appendBezierPathWithRect:NSRectFromCGRect(rects[i])];
|
|
||||||
[surfaceClip addClip];
|
|
||||||
}
|
|
||||||
|
|
||||||
[window.shape addClip];
|
|
||||||
|
|
||||||
if (window.colorKeyed)
|
if (window.colorKeyed)
|
||||||
{
|
{
|
||||||
CGImageRef maskedImage;
|
CGImageRef maskedImage;
|
||||||
|
@ -226,13 +231,12 @@ - (void) drawRect:(NSRect)rect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
|
||||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
|
||||||
CGContextDrawImage(context, imageRect, image);
|
CGContextDrawImage(context, imageRect, image);
|
||||||
|
|
||||||
CGImageRelease(image);
|
CGImageRelease(image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(window.surface_mutex);
|
pthread_mutex_unlock(window.surface_mutex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue