Revision: 13473
          http://sourceforge.net/p/skim-app/code/13473
Author:   hofman
Date:     2023-06-14 09:11:02 +0000 (Wed, 14 Jun 2023)
Log Message:
-----------
make sure we don't draw a zero size mask image

Modified Paths:
--------------
    trunk/SKThumbnailView.m

Modified: trunk/SKThumbnailView.m
===================================================================
--- trunk/SKThumbnailView.m     2023-06-13 21:24:34 UTC (rev 13472)
+++ trunk/SKThumbnailView.m     2023-06-14 09:11:02 UTC (rev 13473)
@@ -177,10 +177,12 @@
 - (void)updateImageHighlightMask:(NSNotification *)note {
     NSRect rect = [imageHighlightView bounds];
     NSImage *mask = [[NSImage alloc] initWithSize:rect.size];
-    [mask lockFocus];
-    [[NSColor colorWithGenericGamma22White:0.0 alpha:1.0] setFill];
-    [[NSBezierPath bezierPathWithRoundedRect:rect xRadius:IMAGE_SEL_RADIUS 
yRadius:IMAGE_SEL_RADIUS] fill];
-    [mask unlockFocus];
+    if (NSIsEmptyRect(rect) == NO) {
+        [mask lockFocus];
+        [[NSColor colorWithGenericGamma22White:0.0 alpha:1.0] setFill];
+        [[NSBezierPath bezierPathWithRoundedRect:rect xRadius:IMAGE_SEL_RADIUS 
yRadius:IMAGE_SEL_RADIUS] fill];
+        [mask unlockFocus];
+    }
     [imageHighlightView setMaskImage:mask];
     [mask release];
 }
@@ -215,10 +217,12 @@
     CGFloat inset = fmax(0.0, floor(0.5 * (NSWidth(rect) - [[labelView cell] 
cellSize].width)));
     CGFloat alpha = [self isSelected] ? 1.0 : 0.05 * [self highlightLevel];
     NSImage *mask = [[NSImage alloc] initWithSize:rect.size];
-    [mask lockFocus];
-    [[NSColor colorWithGenericGamma22White:0.0 alpha:alpha] setFill];
-    [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, inset, 0.0) 
xRadius:TEXT_SEL_RADIUS yRadius:TEXT_SEL_RADIUS] fill];
-    [mask unlockFocus];
+    if (NSIsEmptyRect(rect) == NO) {
+        [mask lockFocus];
+        [[NSColor colorWithGenericGamma22White:0.0 alpha:alpha] setFill];
+        [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, inset, 0.0) 
xRadius:TEXT_SEL_RADIUS yRadius:TEXT_SEL_RADIUS] fill];
+        [mask unlockFocus];
+    }
     [labelHighlightView setMaskImage:mask];
     [mask release];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to