| Index: chrome/browser/ui/cocoa/tabs/tab_view.mm
|
| ===================================================================
|
| --- chrome/browser/ui/cocoa/tabs/tab_view.mm (revision 84308)
|
| +++ chrome/browser/ui/cocoa/tabs/tab_view.mm (working copy)
|
| @@ -16,6 +16,7 @@
|
| #include "grit/generated_resources.h"
|
| #include "grit/theme_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| +#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
|
|
|
| namespace {
|
|
|
| @@ -651,7 +652,7 @@
|
| const CGFloat lineWidth = [self cr_lineWidth];
|
|
|
| NSGraphicsContext* context = [NSGraphicsContext currentContext];
|
| - [context saveGraphicsState];
|
| + gfx::ScopedNSGraphicsContextSaveGState scopedGState(context);
|
|
|
| ThemeService* themeProvider =
|
| static_cast<ThemeService*>([[self window] themeProvider]);
|
| @@ -700,7 +701,7 @@
|
| CGFloat alertAlpha = [self alertAlpha];
|
| if (selected || hoverAlpha > 0 || alertAlpha > 0) {
|
| // Draw the selected background / glow overlay.
|
| - [context saveGraphicsState];
|
| + gfx::ScopedNSGraphicsContextSaveGState drawHoverState(context);
|
| CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]);
|
| CGContextBeginTransparencyLayer(cgContext, 0);
|
| if (!selected) {
|
| @@ -711,9 +712,10 @@
|
| CGContextSetAlpha(cgContext, backgroundAlpha);
|
| }
|
| [path addClip];
|
| - [context saveGraphicsState];
|
| - [super drawBackground];
|
| - [context restoreGraphicsState];
|
| + {
|
| + gfx::ScopedNSGraphicsContextSaveGState drawBackgroundState(context);
|
| + [super drawBackground];
|
| + }
|
|
|
| // Draw a mouse hover gradient for the default themes.
|
| if (!selected && hoverAlpha > 0) {
|
| @@ -737,7 +739,6 @@
|
| }
|
|
|
| CGContextEndTransparencyLayer(cgContext);
|
| - [context restoreGraphicsState];
|
| }
|
|
|
| BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow];
|
| @@ -767,11 +768,12 @@
|
| [context restoreGraphicsState];
|
|
|
| // Draw the top stroke.
|
| - [context saveGraphicsState];
|
| - [borderColor set];
|
| - [path setLineWidth:lineWidth];
|
| - [path stroke];
|
| - [context restoreGraphicsState];
|
| + {
|
| + gfx::ScopedNSGraphicsContextSaveGState drawBorderState(context);
|
| + [borderColor set];
|
| + [path setLineWidth:lineWidth];
|
| + [path stroke];
|
| + }
|
|
|
| // Mimic the tab strip's bottom border, which consists of a dark border
|
| // and light highlight.
|
| @@ -787,8 +789,6 @@
|
| [highlightColor set];
|
| NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
|
| }
|
| -
|
| - [context restoreGraphicsState];
|
| }
|
|
|
| - (void)viewDidMoveToWindow {
|
|
|