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

Unified Diff: ui/gfx/scoped_ns_graphics_context_save_gstate_mac.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: Rename 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
« no previous file with comments | « ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h ('k') | ui/ui_gfx.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm
diff --git a/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm b/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..f3992ea0b694a520c9b45b869151144d4237836b
--- /dev/null
+++ b/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
+
+#include <AppKit/AppKit.h>
+
+namespace gfx {
+
+ScopedNSGraphicsContextSaveGState::ScopedNSGraphicsContextSaveGState(
+ NSGraphicsContext* context) : context_([context retain]) {
+ if (!context_)
+ context_.reset([[NSGraphicsContext currentContext] retain]);
+ [context_ saveGraphicsState];
+}
+
+ScopedNSGraphicsContextSaveGState::~ScopedNSGraphicsContextSaveGState() {
+ [context_ restoreGraphicsState];
+}
+
+} // namespace gfx
« no previous file with comments | « ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h ('k') | ui/ui_gfx.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698