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

Side by Side Diff: experimental/PdfViewer/SkNulCanvas.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 | « no previous file | include/core/SkCanvas.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkNulCanvas_DEFINED 8 #ifndef SkNulCanvas_DEFINED
9 #define SkNulCanvas_DEFINED 9 #define SkNulCanvas_DEFINED
10 10
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 12
13 /** \class SkNulCanvas 13 /** \class SkNulCanvas
14 * 14 *
15 * Nul Canvas is a canvas that does nothing. It is used to measure the perf of just parsing 15 * Nul Canvas is a canvas that does nothing. It is used to measure the perf of just parsing
16 * a pdf, without actually rendering anything. 16 * a pdf, without actually rendering anything.
17 * 17 *
18 */ 18 */
19 class SK_API SkNulCanvas : public SkCanvas { 19 class SK_API SkNulCanvas : public SkCanvas {
20 public: 20 public:
21 SK_DECLARE_INST_COUNT(SkNulCanvas); 21 SK_DECLARE_INST_COUNT(SkNulCanvas);
22 22
23 SkNulCanvas() {} 23 SkNulCanvas() {}
24 explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {} 24 explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {}
25 25
26 explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {} 26 explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {}
27 virtual ~SkNulCanvas() {} 27 virtual ~SkNulCanvas() {}
28 28
29 virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE {return 0;}
30 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
31 SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRID E {return 0;}
32 int saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
33 SaveFlags flags = kARGB_ClipLayer_SaveFlag) {return 0;}
34 virtual void restore() SK_OVERRIDE {}
35 int getSaveCount() const {return 0;}
36 virtual bool isDrawingToLayer() const SK_OVERRIDE {return false;} 29 virtual bool isDrawingToLayer() const SK_OVERRIDE {return false;}
37 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE {return true;} 30 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE {return true;}
38 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE {return true;} 31 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE {return true;}
39 virtual bool rotate(SkScalar degrees) SK_OVERRIDE {return true;} 32 virtual bool rotate(SkScalar degrees) SK_OVERRIDE {return true;}
40 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE {return true;} 33 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE {return true;}
41 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE {return true;} 34 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE {return true;}
42 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE {} 35 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE {}
43 virtual void clear(SkColor) SK_OVERRIDE {} 36 virtual void clear(SkColor) SK_OVERRIDE {}
44 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE {} 37 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE {}
45 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 38 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (NULL != bounds) { 92 if (NULL != bounds) {
100 bounds->setLargest(); 93 bounds->setLargest();
101 } 94 }
102 return true; 95 return true;
103 } 96 }
104 97
105 protected: 98 protected:
106 virtual SkCanvas* canvasForDrawIter() {return NULL;} 99 virtual SkCanvas* canvasForDrawIter() {return NULL;}
107 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;} 100 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;}
108 101
102 virtual bool onSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFla gs flags)
103 SK_OVERRIDE {
104 this->INHERITED::onSaveLayer(bounds, paint, flags);
105 return false;
106 }
107
109 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE {} 108 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE {}
110 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE RRIDE {} 109 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE RRIDE {}
111 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE {} 110 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE {}
112 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {} 111 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {}
113 112
114 private: 113 private:
115 typedef SkCanvas INHERITED; 114 typedef SkCanvas INHERITED;
116 }; 115 };
117 116
118 #endif // SkNulCanvas_DEFINED 117 #endif // SkNulCanvas_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698