Revision: 25530
          http://sourceforge.net/p/bibdesk/svn/25530
Author:   hofman
Date:     2021-02-02 15:54:59 +0000 (Tue, 02 Feb 2021)
Log Message:
-----------
Draw directly to context, avoids setting the current context

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m   2021-02-02 
14:28:36 UTC (rev 25529)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.m   2021-02-02 
15:54:59 UTC (rev 25530)
@@ -570,24 +570,9 @@
     
     FVBitmapContext *bitmapContext = [FVBitmapContext 
bitmapContextWithSize:size];
     CGContextRef context = [bitmapContext graphicsPort];
-    CGContextClearRect(context, CGRectMake(0, 0, size.width, size.height));
     NSGraphicsContext *nsContext = [_webView isFlipped] ? [bitmapContext 
flippedGraphicsContext] : [bitmapContext graphicsContext];
     
-    [NSGraphicsContext saveGraphicsState];
-    
-    [NSGraphicsContext setCurrentContext:nsContext];
-    [nsContext saveGraphicsState];
-    // @@ Dark mode
-    [[NSColor whiteColor] setFill];
-    NSRect rect = NSMakeRect(0, 0, size.width, size.height);
-    [[NSBezierPath bezierPathWithRoundedRect:rect xRadius:5 yRadius:5] fill];
-    [nsContext restoreGraphicsState];
-
-    [_webView setFrame:NSInsetRect(rect, 10, 10)];
-    
-    CGContextSaveGState(context);
-    CGContextTranslateCTM(context, 10, 10);
-    
+    [_webView setFrame:NSMakeRect(10.0, 10.0, size.width - 20.0, size.height - 
20.0)];
     /*
      Force document layout.  This was added as a workaround for a bug 
introduced with Safari 4.0.3 on 10.5.8,
      where setAllowsScrolling:NO caused a white page to be drawn.  
Interestingly, it also fixes some prior
@@ -597,11 +582,25 @@
      protocol is not correctly implemented.
      */
     [[view documentView] layout];
+    
+    // @@ Dark mode
+    CGContextSaveGState(context);
+    CGContextClearRect(context, CGRectMake(0, 0, size.width, size.height));
+    CGContextMoveToPoint(context, 0.0, 5.0);
+    CGContextAddArcToPoint(context, 0.0, 0.0, size.width, 0.0, 5.0);
+    CGContextAddArcToPoint(context, size.width, 0.0, size.width, size.height, 
5.0);
+    CGContextAddArcToPoint(context, size.width, size.height, 0.0, size.height, 
5.0);
+    CGContextAddArcToPoint(context, 0.0, size.height, 0.0, 0.0, 5.0);
+    CGContextClosePath(context);
+    CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
+    CGContextFillPath(context);
+    CGContextRestoreGState(context);
+    
+    CGContextSaveGState(context);
+    CGContextTranslateCTM(context, 10, 10);
     [_webView displayRectIgnoringOpacity:[_webView bounds] 
inContext:nsContext];
     CGContextRestoreGState(context);
     
-    [NSGraphicsContext restoreGraphicsState];
-    
     // temporary CGImage from the full webview
     _viewImage = CGBitmapContextCreateImage(context);
 }

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to