OLD | NEW |
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 void beginCommentGroup(const char* description) SK_OVERRIDE {} | 29 void beginCommentGroup(const char* description) override {} |
30 void addComment(const char* kywd, const char* value) SK_OVERRIDE {} | 30 void addComment(const char* kywd, const char* value) override {} |
31 void endCommentGroup() SK_OVERRIDE {} | 31 void endCommentGroup() override {} |
32 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE {return NULL;} | 32 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) override {return NULL;} |
33 | 33 |
34 bool isClipEmpty() const SK_OVERRIDE { return false; } | 34 bool isClipEmpty() const override { return false; } |
35 bool getClipBounds(SkRect* bounds) const SK_OVERRIDE { | 35 bool getClipBounds(SkRect* bounds) const override { |
36 if (NULL != bounds) { | 36 if (NULL != bounds) { |
37 bounds->setXYWH(0, 0, | 37 bounds->setXYWH(0, 0, |
38 SkIntToScalar(this->imageInfo().width()), | 38 SkIntToScalar(this->imageInfo().width()), |
39 SkIntToScalar(this->imageInfo().height())); | 39 SkIntToScalar(this->imageInfo().height())); |
40 } | 40 } |
41 return true; | 41 return true; |
42 } | 42 } |
43 bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE { | 43 bool getClipDeviceBounds(SkIRect* bounds) const override { |
44 if (NULL != bounds) { | 44 if (NULL != bounds) { |
45 bounds->setLargest(); | 45 bounds->setLargest(); |
46 } | 46 } |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 protected: | 50 protected: |
51 virtual SkCanvas* canvasForDrawIter() {return NULL;} | 51 virtual SkCanvas* canvasForDrawIter() {return NULL;} |
52 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;} | 52 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;} |
53 | 53 |
54 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint*
paint, | 54 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint*
paint, |
55 SaveFlags flags) SK_OVERRIDE { | 55 SaveFlags flags) override { |
56 this->INHERITED::willSaveLayer(bounds, paint, flags); | 56 this->INHERITED::willSaveLayer(bounds, paint, flags); |
57 return kNoLayer_SaveLayerStrategy; | 57 return kNoLayer_SaveLayerStrategy; |
58 } | 58 } |
59 | 59 |
60 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 60 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
61 SkScalar y, const SkPaint& paint) SK_OVERRIDE {} | 61 SkScalar y, const SkPaint& paint) override {} |
62 virtual void onDrawPosText(const void* text, size_t byteLength, | 62 virtual void onDrawPosText(const void* text, size_t byteLength, |
63 const SkPoint pos[], const SkPaint& paint) SK_OVERR
IDE {} | 63 const SkPoint pos[], const SkPaint& paint) override
{} |
64 virtual void onDrawPosTextH(const void* text, size_t byteLength, | 64 virtual void onDrawPosTextH(const void* text, size_t byteLength, |
65 const SkScalar xpos[], SkScalar constY, | 65 const SkScalar xpos[], SkScalar constY, |
66 const SkPaint& paint) SK_OVERRIDE {} | 66 const SkPaint& paint) override {} |
67 virtual void onDrawTextOnPath(const void* text, size_t byteLength, | 67 virtual void onDrawTextOnPath(const void* text, size_t byteLength, |
68 const SkPath& path, const SkMatrix* matrix, | 68 const SkPath& path, const SkMatrix* matrix, |
69 const SkPaint& paint) SK_OVERRIDE {} | 69 const SkPaint& paint) override {} |
70 | 70 |
71 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {} | 71 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override {} |
72 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {} | 72 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override {} |
73 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {} | 73 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override {} |
74 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {} | 74 void onClipRegion(const SkRegion&, SkRegion::Op) override {} |
75 | 75 |
76 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE {} | 76 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de {} |
77 | 77 |
78 void onDrawPaint(const SkPaint& paint) SK_OVERRIDE {} | 78 void onDrawPaint(const SkPaint& paint) override {} |
79 void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], | 79 void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], |
80 const SkPaint& paint) SK_OVERRIDE {} | 80 const SkPaint& paint) override {} |
81 void onDrawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE {} | 81 void onDrawRect(const SkRect& rect, const SkPaint& paint) override {} |
82 void onDrawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE {} | 82 void onDrawOval(const SkRect& oval, const SkPaint&) override {} |
83 void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE {} | 83 void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override {} |
84 void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE {} | 84 void onDrawPath(const SkPath& path, const SkPaint& paint) override {} |
85 void onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, | 85 void onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
86 const SkPaint* paint = NULL) SK_OVERRIDE {} | 86 const SkPaint* paint = NULL) override {} |
87 void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 87 void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
88 const SkRect& dst, | 88 const SkRect& dst, |
89 const SkPaint* paint, | 89 const SkPaint* paint, |
90 DrawBitmapRectFlags flags) SK_OVERRIDE {} | 90 DrawBitmapRectFlags flags) override {} |
91 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE {} | 91 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override {} |
92 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 92 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
93 const SkPaint*) SK_OVERRIDE{} | 93 const SkPaint*) override{} |
94 void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 94 void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
95 const SkRect& dst, const SkPaint* paint = NULL) SK_OVE
RRIDE {} | 95 const SkRect& dst, const SkPaint* paint = NULL) overri
de {} |
96 void onDrawSprite(const SkBitmap& bitmap, int left, int top, | 96 void onDrawSprite(const SkBitmap& bitmap, int left, int top, |
97 const SkPaint* paint = NULL) SK_OVERRIDE {} | 97 const SkPaint* paint = NULL) override {} |
98 void onDrawVertices(VertexMode vmode, int vertexCount, | 98 void onDrawVertices(VertexMode vmode, int vertexCount, |
99 const SkPoint vertices[], const SkPoint texs[], | 99 const SkPoint vertices[], const SkPoint texs[], |
100 const SkColor colors[], SkXfermode* xmode, | 100 const SkColor colors[], SkXfermode* xmode, |
101 const uint16_t indices[], int indexCount, | 101 const uint16_t indices[], int indexCount, |
102 const SkPaint& paint) SK_OVERRIDE {} | 102 const SkPaint& paint) override {} |
103 | 103 |
104 | 104 |
105 private: | 105 private: |
106 typedef SkCanvas INHERITED; | 106 typedef SkCanvas INHERITED; |
107 }; | 107 }; |
108 | 108 |
109 #endif // SkNulCanvas_DEFINED | 109 #endif // SkNulCanvas_DEFINED |
OLD | NEW |