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

Unified Diff: chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm

Issue 6904026: Add and use gfx::ScopedNSGraphicsContextState (ui/gfx/scoped_ns_graphics_context_state_mac.h). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
index d19786042d7c50078a3d14adbb39eb0ec5623624..3c5f901b72ed036477b6ad5b83d70f450f006199 100644
--- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
@@ -24,6 +24,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image.h"
+#include "ui/gfx/scoped_ns_graphics_context_state_mac.h"
namespace {
@@ -339,8 +340,7 @@ void ContentSettingDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
gradient_.reset([[NSGradient alloc] initWithColors:color_array]);
}
- NSGraphicsContext* context = [NSGraphicsContext currentContext];
- [context saveGraphicsState];
+ gfx::ScopedNSGraphicsContextState scopedGState;
NSRectClip(frame);
@@ -369,8 +369,6 @@ void ContentSettingDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
NSInsetRect(remainder, kTextMarginPadding, kTextMarginPadding);
// .get() needed to fix compiler warning (confusion with NSImageRep).
[animated_text_.get() drawAtPoint:remainder.origin];
-
- [context restoreGraphicsState];
} else {
// No animation, draw the image as normal.
ImageDecoration::DrawInFrame(frame, control_view);

Powered by Google App Engine
This is Rietveld 408576698