Revision: 24170
          http://sourceforge.net/p/bibdesk/svn/24170
Author:   hofman
Date:     2019-08-29 21:40:16 +0000 (Thu, 29 Aug 2019)
Log Message:
-----------
get cgcontext in common method

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

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderLabel.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderLabel.m   2019-08-29 
15:29:17 UTC (rev 24169)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderLabel.m   2019-08-29 
21:40:16 UTC (rev 24170)
@@ -406,10 +406,12 @@
     CGPathRelease(path);
 }
 
-+ (void)_drawFinderLabel:(NSUInteger)label inRect:(CGRect)rect 
ofContext:(CGContextRef)context flipped:(BOOL)isFlipped roundEnds:(BOOL)flag;
++ (void)_drawGradientFinderLabel:(NSUInteger)label inRect:(CGRect)rect 
roundEnds:(BOOL)flag;
 {
     FVAPIAssert1(label <= 7, @"Invalid Finder label %ld (must be in the range 
0--7)", (long)label);
     
+    NSGraphicsContext *nsContext = [NSGraphicsContext currentContext];
+    CGContextRef context = [nsContext graphicsPort];
     CGLayerRef layerToDraw = NULL;
     
     if (flag) {
@@ -431,7 +433,7 @@
     }
     
     CGContextSaveGState(context);
-    if (isFlipped) {
+    if ([nsContext isFlipped]) {
         CGContextTranslateCTM(context, 0, CGRectGetMaxY(rect));
         CGContextScaleCTM(context, 1, -1);
         rect.origin.y = 0;
@@ -494,8 +496,7 @@
     if (label == 0) {
         [self _drawNoFinderLabelInRect:rect];
     } else if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_10) {
-        NSGraphicsContext *nsContext = [NSGraphicsContext currentContext];
-        [self _drawFinderLabel:label inRect:NSRectToCGRect(rect) 
ofContext:[nsContext graphicsPort] flipped:[nsContext isFlipped] roundEnds:NO];
+        [self _drawGradientFinderLabel:label inRect:NSRectToCGRect(rect) 
roundEnds:NO];
     } else {
         [self _drawFinderLabel:label inRect:rect];
     }
@@ -505,8 +506,7 @@
 {
     if (label == 0) {
     } else if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_10) {
-        NSGraphicsContext *nsContext = [NSGraphicsContext currentContext];
-        [self _drawFinderLabel:label inRect:NSRectToCGRect(rect) 
ofContext:[nsContext graphicsPort] flipped:[nsContext isFlipped] roundEnds:YES];
+        [self _drawGradientFinderLabel:label inRect:NSRectToCGRect(rect) 
roundEnds:YES];
     } else {
         [self _drawFinderLabelHighlight:label inRect:rect];
     }

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