OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2013 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef SkNulCanvas_DEFINED | |
9 #define SkNulCanvas_DEFINED | |
10 | |
11 #include "SkCanvas.h" | |
12 | |
13 /** \class SkNulCanvas | |
14 * | |
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. | |
17 * | |
18 */ | |
19 class SK_API SkNulCanvas : public SkCanvas { | |
20 public: | |
21 SkNulCanvas() {} | |
22 explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {} | |
23 | |
24 explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {} | |
25 virtual ~SkNulCanvas() {} | |
26 | |
27 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) override {return NULL;} | |
28 | |
29 bool isClipEmpty() const override { return false; } | |
30 bool getClipBounds(SkRect* bounds) const override { | |
31 if (NULL != bounds) { | |
32 bounds->setXYWH(0, 0, | |
33 SkIntToScalar(this->imageInfo().width()), | |
34 SkIntToScalar(this->imageInfo().height())); | |
35 } | |
36 return true; | |
37 } | |
38 bool getClipDeviceBounds(SkIRect* bounds) const override { | |
39 if (NULL != bounds) { | |
40 bounds->setLargest(); | |
41 } | |
42 return true; | |
43 } | |
44 | |
45 protected: | |
46 virtual SkCanvas* canvasForDrawIter() {return NULL;} | |
47 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;} | |
48 | |
49 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint*
paint, | |
50 SaveFlags flags) override { | |
51 this->INHERITED::willSaveLayer(bounds, paint, flags); | |
52 return kNoLayer_SaveLayerStrategy; | |
53 } | |
54 | |
55 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | |
56 SkScalar y, const SkPaint& paint) override {} | |
57 virtual void onDrawPosText(const void* text, size_t byteLength, | |
58 const SkPoint pos[], const SkPaint& paint) override
{} | |
59 virtual void onDrawPosTextH(const void* text, size_t byteLength, | |
60 const SkScalar xpos[], SkScalar constY, | |
61 const SkPaint& paint) override {} | |
62 virtual void onDrawTextOnPath(const void* text, size_t byteLength, | |
63 const SkPath& path, const SkMatrix* matrix, | |
64 const SkPaint& paint) override {} | |
65 | |
66 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override {} | |
67 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override {} | |
68 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override {} | |
69 void onClipRegion(const SkRegion&, SkRegion::Op) override {} | |
70 | |
71 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de {} | |
72 | |
73 void onDrawPaint(const SkPaint& paint) override {} | |
74 void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], | |
75 const SkPaint& paint) override {} | |
76 void onDrawRect(const SkRect& rect, const SkPaint& paint) override {} | |
77 void onDrawOval(const SkRect& oval, const SkPaint&) override {} | |
78 void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override {} | |
79 void onDrawPath(const SkPath& path, const SkPaint& paint) override {} | |
80 void onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, | |
81 const SkPaint* paint = NULL) override {} | |
82 void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | |
83 const SkRect& dst, | |
84 const SkPaint* paint, | |
85 SK_VIRTUAL_CONSTRAINT_TYPE) override {} | |
86 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override {} | |
87 void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkP
aint* | |
88 SRC_RECT_CONSTRAINT_PARAM(constraint)) override {} | |
89 void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | |
90 const SkRect& dst, const SkPaint* paint = NULL) overri
de {} | |
91 void onDrawSprite(const SkBitmap& bitmap, int left, int top, | |
92 const SkPaint* paint = NULL) override {} | |
93 void onDrawVertices(VertexMode vmode, int vertexCount, | |
94 const SkPoint vertices[], const SkPoint texs[], | |
95 const SkColor colors[], SkXfermode* xmode, | |
96 const uint16_t indices[], int indexCount, | |
97 const SkPaint& paint) override {} | |
98 | |
99 | |
100 private: | |
101 typedef SkCanvas INHERITED; | |
102 }; | |
103 | |
104 #endif // SkNulCanvas_DEFINED | |
OLD | NEW |