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

Unified Diff: ui/gfx/canvas.h

Issue 1819443002: MacViews: draw combobox arrow backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | ui/native_theme/native_theme.h » ('j') | ui/native_theme/native_theme.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.h
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index 367aa8a74416facf0b0c0062944121ffd17dee06..99ca4339e26b212e243a5b674bd214cd9ea0df43 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -74,6 +74,21 @@ class GFX_EXPORT Canvas {
NO_SUBPIXEL_RENDERING = 1 << 9,
};
+ // This class represents a scoped state of a Canvas. When a ScopedState is
tapted 2016/03/21 07:09:04 ui/gfx/scoped_canvas.h?
Elly Fong-Jones 2016/03/21 18:53:56 Ach! The idiom I'm used to is having these Scoped*
+ // constructed, it saves the state of the supplied Canvas; when a ScopedState
+ // is destroyed, it restores the state it saved earlier.
+ class ScopedState {
+ public:
+ ScopedState(Canvas* canvas) : canvas_(canvas) {
+ canvas_->Save();
+ }
+ ~ScopedState() {
+ canvas_->Restore();
+ }
+ private:
+ Canvas* canvas_;
+ };
+
// Creates an empty canvas with image_scale of 1x.
Canvas();
« no previous file with comments | « no previous file | ui/native_theme/native_theme.h » ('j') | ui/native_theme/native_theme.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698