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

Side by Side Diff: include/utils/SkProxyCanvas.h

Issue 196323003: Revert of Revert "De-virtualize SkCanvas save/restore." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/utils/SkNWayCanvas.h ('k') | src/core/SkBBoxHierarchyRecord.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef SkProxyCanvas_DEFINED 8 #ifndef SkProxyCanvas_DEFINED
9 #define SkProxyCanvas_DEFINED 9 #define SkProxyCanvas_DEFINED
10 10
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 12
13 /** This class overrides all virtual methods on SkCanvas, and redirects them 13 /** This class overrides all virtual methods on SkCanvas, and redirects them
14 to a "proxy", another SkCanvas instance. It can be the basis for 14 to a "proxy", another SkCanvas instance. It can be the basis for
15 intercepting (and possibly modifying) calls to a canvas. 15 intercepting (and possibly modifying) calls to a canvas.
16 16
17 There must be a proxy installed before the proxycanvas can be used (i.e. 17 There must be a proxy installed before the proxycanvas can be used (i.e.
18 before its virtual methods can be called). 18 before its virtual methods can be called).
19 */ 19 */
20 class SK_API SkProxyCanvas : public SkCanvas { 20 class SK_API SkProxyCanvas : public SkCanvas {
21 public: 21 public:
22 SkProxyCanvas() : fProxy(NULL) {} 22 SkProxyCanvas() : fProxy(NULL) {}
23 SkProxyCanvas(SkCanvas* proxy); 23 SkProxyCanvas(SkCanvas* proxy);
24 virtual ~SkProxyCanvas(); 24 virtual ~SkProxyCanvas();
25 25
26 SkCanvas* getProxy() const { return fProxy; } 26 SkCanvas* getProxy() const { return fProxy; }
27 void setProxy(SkCanvas* proxy); 27 void setProxy(SkCanvas* proxy);
28 28
29 virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE;
30 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
31 SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRID E;
32 virtual void restore() SK_OVERRIDE;
33
34 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE; 29 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
35 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE; 30 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
36 virtual bool rotate(SkScalar degrees) SK_OVERRIDE; 31 virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
37 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE; 32 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
38 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE; 33 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
39 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; 34 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
40 35
41 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 36 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
42 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 37 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
43 const SkPaint& paint) SK_OVERRIDE; 38 const SkPaint& paint) SK_OVERRIDE;
(...skipping 29 matching lines...) Expand all
73 virtual void drawData(const void* data, size_t length) SK_OVERRIDE; 68 virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
74 69
75 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; 70 virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
76 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; 71 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
77 virtual void endCommentGroup() SK_OVERRIDE; 72 virtual void endCommentGroup() SK_OVERRIDE;
78 73
79 virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE; 74 virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
80 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE; 75 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
81 76
82 protected: 77 protected:
78 virtual void onSave(SaveFlags) SK_OVERRIDE;
79 virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRI DE;
80 virtual void onRestore() SK_OVERRIDE;
81
83 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK _OVERRIDE; 82 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK _OVERRIDE;
84 83
85 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE; 84 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE;
86 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE RRIDE; 85 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE RRIDE;
87 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE; 86 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE;
88 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; 87 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
89 88
90 private: 89 private:
91 SkCanvas* fProxy; 90 SkCanvas* fProxy;
92 91
93 typedef SkCanvas INHERITED; 92 typedef SkCanvas INHERITED;
94 }; 93 };
95 94
96 #endif 95 #endif
OLDNEW
« no previous file with comments | « include/utils/SkNWayCanvas.h ('k') | src/core/SkBBoxHierarchyRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698