Chromium Code Reviews| Index: ui/gfx/scoped_canvas.h |
| diff --git a/ui/gfx/scoped_canvas.h b/ui/gfx/scoped_canvas.h |
| index 4a260bf93c3622b78892628667e839c4d2a21632..aaf3a821647cf4c9573ae721c9b560ffba95e434 100644 |
| --- a/ui/gfx/scoped_canvas.h |
| +++ b/ui/gfx/scoped_canvas.h |
| @@ -6,12 +6,16 @@ |
| #define UI_GFX_SCOPED_CANVAS_H_ |
| #include "base/macros.h" |
| + |
|
tapted
2016/04/27 03:25:11
nit: no blank line here
Elly Fong-Jones
2016/04/28 17:03:11
Done.
|
| #include "ui/gfx/canvas.h" |
| +#include "ui/gfx/gfx_export.h" |
| namespace gfx { |
| +class Rect; |
| + |
| // Saves the drawing state, and restores the state when going out of scope. |
| -class ScopedCanvas { |
| +class GFX_EXPORT ScopedCanvas { |
| public: |
| explicit ScopedCanvas(gfx::Canvas* canvas) : canvas_(canvas) { |
| if (canvas_) |
| @@ -28,6 +32,20 @@ class ScopedCanvas { |
| DISALLOW_COPY_AND_ASSIGN(ScopedCanvas); |
| }; |
| +// Saves the drawing state, and applies an RTL transform for the supplied rect |
| +// if the UI is in RTL layout. The resulting transform is such that anything |
| +// drawn inside the supplied rect will be flipped horizontally. |
| +class GFX_EXPORT ScopedRTLFlipCanvas { |
| + public: |
| + ScopedRTLFlipCanvas(gfx::Canvas* canvas, const gfx::Rect& rect); |
| + ~ScopedRTLFlipCanvas() {} |
| + |
| + private: |
| + ScopedCanvas canvas_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ScopedRTLFlipCanvas); |
| +}; |
| + |
| } // namespace gfx |
| #endif // UI_GFX_SCOPED_CANVAS_H_ |