Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: third_party/molokocacao/NSBezierPath+MCAdditions.m

Issue 10556030: mac: Fix close button appearance in HiDPI. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // 1 //
2 // NSBezierPath+MCAdditions.m 2 // NSBezierPath+MCAdditions.m
3 // 3 //
4 // Created by Sean Patrick O'Brien on 4/1/08. 4 // Created by Sean Patrick O'Brien on 4/1/08.
5 // Copyright 2008 MolokoCacao. All rights reserved. 5 // Copyright 2008 MolokoCacao. All rights reserved.
6 // 6 //
7 7
8 #import "NSBezierPath+MCAdditions.h" 8 #import "NSBezierPath+MCAdditions.h"
9 9
10 #import "third_party/GTM/AppKit/GTMNSBezierPath+CGPath.h" 10 #import "third_party/GTM/AppKit/GTMNSBezierPath+CGPath.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 CFRelease(pathRef); 86 CFRelease(pathRef);
87 CFRelease(strokedPathRef); 87 CFRelease(strokedPathRef);
88 88
89 return strokedPath; 89 return strokedPath;
90 #else 90 #else
91 return nil; 91 return nil;
92 #endif // MCBEZIER_USE_PRIVATE_FUNCTION 92 #endif // MCBEZIER_USE_PRIVATE_FUNCTION
93 } 93 }
94 94
95 - (void)fillWithInnerShadow:(NSShadow *)shadow scale:(float)scale 95 - (void)fillWithInnerShadow:(NSShadow *)shadow
96 { 96 {
97 [NSGraphicsContext saveGraphicsState]; 97 [NSGraphicsContext saveGraphicsState];
98 98
99 NSSize offset = shadow.shadowOffset; 99 NSSize offset = shadow.shadowOffset;
100 NSSize originalOffset = offset; 100 NSSize originalOffset = offset;
101 CGFloat radius = shadow.shadowBlurRadius; 101 CGFloat radius = shadow.shadowBlurRadius;
102 NSRect bounds = NSInsetRect(self.bounds, -(ABS(offset.width) + radius), -(ABS(offset.height) + radius)); 102 NSRect bounds = NSInsetRect(self.bounds, -(ABS(offset.width) + radius), -(ABS(offset.height) + radius));
103 103
104 // The context's user transform isn't automatically applied to shadow of fsets. 104 // The context's user transform isn't automatically applied to shadow of fsets.
105 » offset.height += scale * bounds.size.height; 105 offset.height += bounds.size.height;
106 shadow.shadowOffset = offset; 106 shadow.shadowOffset = offset;
107 NSAffineTransform *transform = [NSAffineTransform transform]; 107 NSAffineTransform *transform = [NSAffineTransform transform];
108 if ([[NSGraphicsContext currentContext] isFlipped]) 108 if ([[NSGraphicsContext currentContext] isFlipped])
109 [transform translateXBy:0 yBy:bounds.size.height]; 109 [transform translateXBy:0 yBy:bounds.size.height];
110 else 110 else
111 [transform translateXBy:0 yBy:-bounds.size.height]; 111 [transform translateXBy:0 yBy:-bounds.size.height];
112 112
113 NSBezierPath *drawingPath = [NSBezierPath bezierPathWithRect:bounds]; 113 NSBezierPath *drawingPath = [NSBezierPath bezierPathWithRect:bounds];
114 [drawingPath setWindingRule:NSEvenOddWindingRule]; 114 [drawingPath setWindingRule:NSEvenOddWindingRule];
115 [drawingPath appendBezierPath:self]; 115 [drawingPath appendBezierPath:self];
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 /* Stroke the path. */ 182 /* Stroke the path. */
183 [self stroke]; 183 [self stroke];
184 184
185 /* Restore the previous graphics context. */ 185 /* Restore the previous graphics context. */
186 [thisContext restoreGraphicsState]; 186 [thisContext restoreGraphicsState];
187 [self setLineWidth:lineWidth]; 187 [self setLineWidth:lineWidth];
188 } 188 }
189 189
190 @end 190 @end
OLDNEW
« no previous file with comments | « third_party/molokocacao/NSBezierPath+MCAdditions.h ('k') | third_party/molokocacao/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698