OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_view.h" | |
6 | |
7 #include "base/memory/scoped_nsobject.h" | |
8 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | |
9 | |
10 namespace { | |
11 | |
12 const CGFloat kShadowTop = 20; | |
13 const CGFloat kShadowBottom = 50; | |
14 const CGFloat kShadowLeft = 50; | |
15 const CGFloat kShadowRight = 50; | |
16 const CGFloat kShadowBlurRadius = 290; | |
17 const CGFloat kShadowAlpha = 0.5; | |
18 const CGFloat kBubbleCornerRadius = 8.0; | |
19 | |
20 } | |
21 | |
22 @implementation FullscreenExitBubbleView | |
23 | |
24 - (void)drawRect:(NSRect)rect { | |
25 // Make room for the border to be seen. | |
26 NSRect bounds = [self bounds]; | |
27 bounds.size.width -= kShadowLeft + kShadowRight; | |
28 bounds.size.height -= kShadowTop + kShadowBottom; | |
29 bounds.origin.x += kShadowLeft; | |
30 bounds.origin.y += kShadowBottom; | |
31 NSBezierPath* bezier = [NSBezierPath bezierPath]; | |
32 | |
33 CGFloat radius = kBubbleCornerRadius; | |
34 // Start with a rounded rectangle. | |
35 [bezier appendBezierPathWithRoundedRect:bounds | |
36 xRadius:radius | |
37 yRadius:radius]; | |
38 | |
39 [bezier closePath]; | |
40 [[NSColor whiteColor] set]; | |
41 [NSGraphicsContext saveGraphicsState]; | |
jeremya
2011/11/09 00:37:18
I don't think you need to saveGraphicsState *and*
koz (OOO until 15th September)
2011/11/14 01:00:33
Done.
| |
42 gfx::ScopedNSGraphicsContextSaveGState scoped_g_state; | |
43 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); | |
44 [shadow setShadowBlurRadius:kShadowBlurRadius]; | |
45 [shadow setShadowColor:[[NSColor blackColor] | |
46 colorWithAlphaComponent:kShadowAlpha]]; | |
47 [shadow set]; | |
48 | |
49 [bezier fill]; | |
50 } | |
51 | |
52 @end | |
OLD | NEW |