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

Side by Side Diff: experimental/PdfViewer/SkNulCanvas.h

Issue 183453002: add new onClip* methods to SkCanvas (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: remove debug 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) {return 0;} 29 virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE {return 0;}
30 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, 30 virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
31 SaveFlags flags = kARGB_ClipLayer_SaveFlag) {return 0; } 31 SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRID E {return 0;}
32 int saveLayerAlpha(const SkRect* bounds, U8CPU alpha, 32 int saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
33 SaveFlags flags = kARGB_ClipLayer_SaveFlag) {return 0;} 33 SaveFlags flags = kARGB_ClipLayer_SaveFlag) {return 0;}
34 virtual void restore() {} 34 virtual void restore() SK_OVERRIDE {}
35 int getSaveCount() const {return 0;} 35 int getSaveCount() const {return 0;}
36 virtual bool isDrawingToLayer() const {return false;} 36 virtual bool isDrawingToLayer() const SK_OVERRIDE {return false;}
37 virtual bool translate(SkScalar dx, SkScalar dy) {return true;} 37 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE {return true;}
38 virtual bool scale(SkScalar sx, SkScalar sy) {return true;} 38 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE {return true;}
39 virtual bool rotate(SkScalar degrees) {return true;} 39 virtual bool rotate(SkScalar degrees) SK_OVERRIDE {return true;}
40 virtual bool skew(SkScalar sx, SkScalar sy) {return true;} 40 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE {return true;}
41 virtual bool concat(const SkMatrix& matrix) {return true;} 41 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE {return true;}
42 virtual void setMatrix(const SkMatrix& matrix) {} 42 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE {}
43 virtual bool clipRect(const SkRect& rect, 43 virtual void clear(SkColor) SK_OVERRIDE {}
44 SkRegion::Op op = SkRegion::kIntersect_Op, 44 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE {}
45 bool doAntiAlias = false) {return true;}
46 virtual bool clipRRect(const SkRRect& rrect,
47 SkRegion::Op op = SkRegion::kIntersect_Op,
48 bool doAntiAlias = false) {return true;}
49 virtual bool clipPath(const SkPath& path,
50 SkRegion::Op op = SkRegion::kIntersect_Op,
51 bool doAntiAlias = false) {return true;}
52 virtual bool clipRegion(const SkRegion& deviceRgn,
53 SkRegion::Op op = SkRegion::kIntersect_Op) {return t rue;}
54 virtual void clear(SkColor) {}
55 virtual void drawPaint(const SkPaint& paint) {}
56 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 45 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
57 const SkPaint& paint) {} 46 const SkPaint& paint) SK_OVERRIDE {}
58 virtual void drawRect(const SkRect& rect, const SkPaint& paint) {} 47 virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE {}
59 virtual void drawOval(const SkRect& oval, const SkPaint&) {} 48 virtual void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE {}
60 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) {} 49 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRI DE {}
61 virtual void drawPath(const SkPath& path, const SkPaint& paint) {} 50 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE {}
62 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 51 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
63 const SkPaint* paint = NULL) {} 52 const SkPaint* paint = NULL) SK_OVERRIDE {}
64 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, 53 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
65 const SkRect& dst, 54 const SkRect& dst,
66 const SkPaint* paint, 55 const SkPaint* paint,
67 DrawBitmapRectFlags flags) {} 56 DrawBitmapRectFlags flags) SK_OVERRIDE {}
68 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, 57 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
69 const SkPaint* paint = NULL) {} 58 const SkPaint* paint = NULL) SK_OVERRIDE {}
70 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 59 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
71 const SkRect& dst, const SkPaint* paint = NULL) {} 60 const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE {}
72 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, 61 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
73 const SkPaint* paint = NULL) {} 62 const SkPaint* paint = NULL) SK_OVERRIDE {}
74 virtual void drawText(const void* text, size_t byteLength, SkScalar x, 63 virtual void drawText(const void* text, size_t byteLength, SkScalar x,
75 SkScalar y, const SkPaint& paint) {} 64 SkScalar y, const SkPaint& paint) SK_OVERRIDE {}
76 virtual void drawPosText(const void* text, size_t byteLength, 65 virtual void drawPosText(const void* text, size_t byteLength,
77 const SkPoint pos[], const SkPaint& paint) {} 66 const SkPoint pos[], const SkPaint& paint) SK_OVERR IDE {}
78 virtual void drawPosTextH(const void* text, size_t byteLength, 67 virtual void drawPosTextH(const void* text, size_t byteLength,
79 const SkScalar xpos[], SkScalar constY, 68 const SkScalar xpos[], SkScalar constY,
80 const SkPaint& paint) {} 69 const SkPaint& paint) SK_OVERRIDE {}
81 virtual void drawTextOnPath(const void* text, size_t byteLength, 70 virtual void drawTextOnPath(const void* text, size_t byteLength,
82 const SkPath& path, const SkMatrix* matrix, 71 const SkPath& path, const SkMatrix* matrix,
83 const SkPaint& paint) {} 72 const SkPaint& paint) SK_OVERRIDE {}
84 virtual void drawPicture(SkPicture& picture) {} 73 virtual void drawPicture(SkPicture& picture) SK_OVERRIDE {}
85 virtual void drawVertices(VertexMode vmode, int vertexCount, 74 virtual void drawVertices(VertexMode vmode, int vertexCount,
86 const SkPoint vertices[], const SkPoint texs[], 75 const SkPoint vertices[], const SkPoint texs[],
87 const SkColor colors[], SkXfermode* xmode, 76 const SkColor colors[], SkXfermode* xmode,
88 const uint16_t indices[], int indexCount, 77 const uint16_t indices[], int indexCount,
89 const SkPaint& paint) {} 78 const SkPaint& paint) SK_OVERRIDE {}
90 virtual void drawData(const void* data, size_t length) {} 79 virtual void drawData(const void* data, size_t length) SK_OVERRIDE {}
91 virtual void beginCommentGroup(const char* description) {} 80 virtual void beginCommentGroup(const char* description) SK_OVERRIDE {}
92 virtual void addComment(const char* kywd, const char* value) {} 81 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE {}
93 virtual void endCommentGroup() {} 82 virtual void endCommentGroup() SK_OVERRIDE {}
94 virtual SkBounder* setBounder(SkBounder* bounder) {return NULL;} 83 virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE {return NULL;}
95 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) {return NULL;} 84 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE {retur n NULL;}
85
86 virtual bool isClipEmpty() const SK_OVERRIDE { return false; }
87 virtual ClipType getClipType() const SK_OVERRIDE { return kRect_ClipType; }
88 virtual bool getClipBounds(SkRect* bounds) const SK_OVERRIDE {
89 if (NULL != bounds) {
90 bounds->setXYWH(0, 0,
91 SkIntToScalar(this->imageInfo().fWidth),
92 SkIntToScalar(this->imageInfo().fHeight));
93 }
94 return true;
95 }
96 virtual bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE {
97 if (NULL != bounds) {
98 bounds->setLargest();
99 }
100 return true;
101 }
96 102
97 protected: 103 protected:
98 virtual SkCanvas* canvasForDrawIter() {return NULL;} 104 virtual SkCanvas* canvasForDrawIter() {return NULL;}
99 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;} 105 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;}
100 106
107 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE {}
108 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE RRIDE {}
109 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR IDE {}
110 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {}
111
101 private: 112 private:
102 typedef SkCanvas INHERITED; 113 typedef SkCanvas INHERITED;
103 }; 114 };
104 115
105 #endif // SkNulCanvas_DEFINED 116 #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