Revision: 10194
          http://sourceforge.net/p/skim-app/code/10194
Author:   hofman
Date:     2018-12-28 14:59:06 +0000 (Fri, 28 Dec 2018)
Log Message:
-----------
draw background for drag image of line well before drawing content, as in dark 
mode it is transparent

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

Modified: trunk/SKLineWell.m
===================================================================
--- trunk/SKLineWell.m  2018-12-28 14:39:43 UTC (rev 10193)
+++ trunk/SKLineWell.m  2018-12-28 14:59:06 UTC (rev 10194)
@@ -315,8 +315,17 @@
     NSBitmapImageRep *imageRep = [self 
bitmapImageRepForCachingDisplayInRect:bounds];
     CGFloat scale = [imageRep pixelsWide] / NSWidth(bounds);
     BOOL wasActive = lwFlags.active;
-    NSColor *borderColor = [NSColor 
colorWithCalibratedWhite:SKHasDarkAppearance(NSApp) ? 1.0 : 0.0 alpha:0.6];
+    NSColor *borderColor;
+    NSColor *backgroundColor;
     
+    if (SKHasDarkAppearance(NSApp)) {
+        borderColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.6];
+        backgroundColor = [NSColor colorWithCalibratedRed:0.157 green:0.165 
blue:0.169 alpha:1.0];
+    } else {
+        borderColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.6];
+        backgroundColor = [NSColor colorWithCalibratedWhite:0.906 alpha:1.0];
+    }
+    
     lwFlags.active = 0;
     [self cacheDisplayInRect:bounds toBitmapImageRep:imageRep];
     lwFlags.active = wasActive;
@@ -324,10 +333,12 @@
     // @@ Dark mode
     
     NSImage *image = [NSImage bitmapImageWithSize:bounds.size scale:scale 
drawingHandler:^(NSRect rect){
+        [backgroundColor setFill];
+        [NSBezierPath fillRect:rect];
         [borderColor setStroke];
         [NSBezierPath strokeRect:NSInsetRect(rect, 0.5, 0.5)];
         rect = NSInsetRect(rect, 1.0, 1.0);
-        [imageRep drawInRect:rect fromRect:rect operation:NSCompositeCopy 
fraction:RUNNING_BEFORE(10_7) ? 0.7 : 1.0 respectFlipped:NO hints:nil];
+        [imageRep drawInRect:rect fromRect:rect 
operation:NSCompositeSourceOver fraction:RUNNING_BEFORE(10_7) ? 0.7 : 1.0 
respectFlipped:NO hints:nil];
     }];
     
     return image;

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