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 virtual void beginCommentGroup(const char* description) SK_OVERRIDE {} | 29 void beginCommentGroup(const char* description) SK_OVERRIDE {} |
30 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE {} | 30 void addComment(const char* kywd, const char* value) SK_OVERRIDE {} |
31 virtual void endCommentGroup() SK_OVERRIDE {} | 31 void endCommentGroup() SK_OVERRIDE {} |
32 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE {retur
n NULL;} | 32 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE {return NULL;} |
33 | 33 |
34 virtual bool isClipEmpty() const SK_OVERRIDE { return false; } | 34 bool isClipEmpty() const SK_OVERRIDE { return false; } |
35 virtual bool getClipBounds(SkRect* bounds) const SK_OVERRIDE { | 35 bool getClipBounds(SkRect* bounds) const SK_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 virtual bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE { | 43 bool getClipDeviceBounds(SkIRect* bounds) const SK_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) SK_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) SK_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) SK_OVERR
IDE {} |
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) SK_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) SK_OVERRIDE {} |
70 | 70 |
71 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE {} | 71 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {} |
72 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE {} | 72 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {} |
73 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE {} | 73 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {} |
74 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {} | 74 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {} |
75 | 75 |
76 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE {} | 76 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE {} |
77 | 77 |
78 void onDrawPaint(const SkPaint& paint) SK_OVERRIDE {} | 78 void onDrawPaint(const SkPaint& paint) SK_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) SK_OVERRIDE {} |
81 void onDrawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE {} | 81 void onDrawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE {} |
82 void onDrawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE {} | 82 void onDrawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE {} |
83 void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE {} | 83 void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE {} |
84 void onDrawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE {} | 84 void onDrawPath(const SkPath& path, const SkPaint& paint) SK_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) SK_OVERRIDE {} |
(...skipping 13 matching lines...) Expand all Loading... |
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) SK_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 |