OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "base/scoped_nsobject.h" | 5 #import "base/scoped_nsobject.h" |
6 #include "chrome/browser/cocoa/gradient_button_cell.h" | 6 #include "chrome/browser/cocoa/gradient_button_cell.h" |
7 #import "third_party/GTM/AppKit/GTMTheme.h" | 7 #import "third_party/GTM/AppKit/GTMTheme.h" |
8 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" | 8 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" |
9 | 9 |
10 @interface GradientButtonCell (Private) | 10 @interface GradientButtonCell (Private) |
(...skipping 301 matching lines...) Loading... |
312 CGContextRef context = | 312 CGContextRef context = |
313 (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]); | 313 (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]); |
314 | 314 |
315 NSColor* color = [theme iconColorForStyle:GTMThemeStyleToolBarButton | 315 NSColor* color = [theme iconColorForStyle:GTMThemeStyleToolBarButton |
316 state:YES]; | 316 state:YES]; |
317 | 317 |
318 if (isTemplate) { | 318 if (isTemplate) { |
319 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); | 319 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
320 NSColor *shadowColor = [color gtm_legibleTextColor]; | 320 NSColor *shadowColor = [color gtm_legibleTextColor]; |
321 shadowColor = [shadowColor colorWithAlphaComponent:0.25]; | 321 shadowColor = [shadowColor colorWithAlphaComponent:0.25]; |
322 [shadow setShadowColor:shadowColor]; | 322 [shadow.get() setShadowColor:shadowColor]; |
323 [shadow setShadowOffset:NSMakeSize(0, -1.0)]; | 323 [shadow.get() setShadowOffset:NSMakeSize(0, -1.0)]; |
324 [shadow setShadowBlurRadius:1.0]; | 324 [shadow setShadowBlurRadius:1.0]; |
325 [shadow set]; | 325 [shadow set]; |
326 } | 326 } |
327 | 327 |
328 [self drawUnderlayImageWithFrame:cellFrame inView:controlView]; | 328 [self drawUnderlayImageWithFrame:cellFrame inView:controlView]; |
329 | 329 |
330 CGContextBeginTransparencyLayer(context, 0); | 330 CGContextBeginTransparencyLayer(context, 0); |
331 NSRect imageRect = NSZeroRect; | 331 NSRect imageRect = NSZeroRect; |
332 imageRect.size = [[self image] size]; | 332 imageRect.size = [[self image] size]; |
333 NSRect drawRect = [self imageRectForBounds:cellFrame]; | 333 NSRect drawRect = [self imageRectForBounds:cellFrame]; |
(...skipping 28 matching lines...) Loading... |
362 imageRect.size = [underlayImage_ size]; | 362 imageRect.size = [underlayImage_ size]; |
363 [underlayImage_ setFlipped:[controlView isFlipped]]; | 363 [underlayImage_ setFlipped:[controlView isFlipped]]; |
364 [underlayImage_ drawInRect:[self imageRectForBounds:cellFrame] | 364 [underlayImage_ drawInRect:[self imageRectForBounds:cellFrame] |
365 fromRect:imageRect | 365 fromRect:imageRect |
366 operation:NSCompositeSourceOver | 366 operation:NSCompositeSourceOver |
367 fraction:[self isEnabled] ? 1.0 : 0.5]; | 367 fraction:[self isEnabled] ? 1.0 : 0.5]; |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 @end | 371 @end |
OLD | NEW |