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

Unified Diff: gfx/canvas_direct2d.h

Issue 2959014: Implement initial ClipRect.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | « gfx/canvas.h ('k') | gfx/canvas_direct2d.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gfx/canvas_direct2d.h
===================================================================
--- gfx/canvas_direct2d.h (revision 53197)
+++ gfx/canvas_direct2d.h (working copy)
@@ -28,9 +28,7 @@
virtual void SaveLayerAlpha(uint8 alpha);
virtual void SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds);
virtual void Restore();
- virtual bool GetClipRect(gfx::Rect* clip_rect);
virtual bool ClipRectInt(int x, int y, int w, int h);
- virtual bool IntersectsClipRectInt(int x, int y, int w, int h);
virtual void TranslateInt(int x, int y);
virtual void ScaleInt(int x, int y);
virtual void FillRectInt(int x, int y, int w, int h,
@@ -72,12 +70,29 @@
virtual const CanvasSkia* AsCanvasSkia() const;
private:
+ void SaveInternal(ID2D1Layer* layer);
+
ID2D1RenderTarget* rt_;
ScopedComPtr<ID2D1GdiInteropRenderTarget> interop_rt_;
ScopedComPtr<ID2D1DrawingStateBlock> drawing_state_block_;
static ID2D1Factory* d2d1_factory_;
- std::stack<ID2D1Layer*> layers_;
+ // Every time Save* is called, a RenderState object is pushed onto the
+ // RenderState stack.
+ struct RenderState {
+ explicit RenderState(ID2D1Layer* layer) : layer(layer), clip_count(0) {}
+ RenderState() : layer(NULL), clip_count(0) {}
+
+ // A D2D layer associated with this state, or NULL if there is no layer.
+ // The layer is created and owned by the Canvas.
+ ID2D1Layer* layer;
+ // The number of clip operations performed. This is used to balance calls to
+ // PushAxisAlignedClip with calls to PopAxisAlignedClip when Restore() is
+ // called.
+ int clip_count;
+ };
+ std::stack<RenderState> state_;
+
DISALLOW_COPY_AND_ASSIGN(CanvasDirect2D);
};
« no previous file with comments | « gfx/canvas.h ('k') | gfx/canvas_direct2d.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698