Revision: 24195
          http://sourceforge.net/p/bibdesk/svn/24195
Author:   hofman
Date:     2019-09-05 14:38:42 +0000 (Thu, 05 Sep 2019)
Log Message:
-----------
get drawing variables only when using

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

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2019-09-05 
14:24:43 UTC (rev 24194)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2019-09-05 
14:38:42 UTC (rev 24195)
@@ -2031,10 +2031,8 @@
     }
 }
 
-- (void)_drawHighlightInRect:(NSRect)aRect;
+- (void)_drawHighlightInRect:(NSRect)aRect 
inContext:(CGContextRef)drawingContext;
 {
-    CGContextRef drawingContext = [[NSGraphicsContext currentContext] 
graphicsPort];
-    
     // drawing into a CGImage and then overlaying it keeps the rubber band 
highlight much more responsive
     if (NULL == _selectionOverlay) {
         
@@ -2359,10 +2357,7 @@
     // shadow needs to be scaled as the icon scale changes to approximate the 
IconServices shadow
     CGFloat shadowBlur = 2.0 * [self iconScale];
     CGSize shadowOffset = CGSizeMake(0.0, -[self iconScale]);
-    CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
-    CGFloat shadowComponents[] = { 0, 0, 0, 0.4 };
-    CGColorRef shadowColor = CGColorCreate(cspace, shadowComponents);
-    CGColorSpaceRelease(cspace);
+    CGColorRef shadowColor = NULL;
     
     // iterate each row/column to see if it's in the dirty rect, and evaluate 
the current cache state
     for (r = rMin; r < rMax; r++) 
@@ -2383,16 +2378,23 @@
                                 
                 if (willDrawIcon) {
 
-                    FVIcon *image = [self iconAtIndex:i];
-                    
-                    // note that iconRect will be transformed for a flipped 
context
-                    NSRect iconRect = fileRect;
-                    
                     // draw highlight, then draw icon over it, as Finder does
                     if ((FVDrawHighlight | drawOption) && [_selectionIndexes 
containsIndex:i])
-                        [self _drawHighlightInRect:NSInsetRect(fileRect, 
HIGHLIGHT_INSET, HIGHLIGHT_INSET)];
+                        [self _drawHighlightInRect:NSInsetRect(fileRect, 
HIGHLIGHT_INSET, HIGHLIGHT_INSET) inContext:cgContext];
                     
                     if ((FVDrawIcon & drawOption)) {
+                        FVIcon *image = [self iconAtIndex:i];
+                        
+                        // note that iconRect will be transformed for a 
flipped context
+                        NSRect iconRect = fileRect;
+                        
+                        if (shadowColor == NULL) {
+                            CGColorSpaceRef cspace = 
CGColorSpaceCreateDeviceRGB();
+                            CGFloat shadowComponents[] = { 0, 0, 0, 0.4 };
+                            shadowColor = CGColorCreate(cspace, 
shadowComponents);
+                            CGColorSpaceRelease(cspace);
+                        }
+                        
                         CGContextSaveGState(cgContext);
                         
                         // draw a shadow behind the image/page

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to