2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkNulCanvas_DEFINED
9 #define SkNulCanvas_DEFINED
13 /** \class SkNulCanvas
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.
19 class SK_API SkNulCanvas : public SkCanvas {
21 SK_DECLARE_INST_COUNT(SkNulCanvas);
24 explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {}
26 explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {}
27 virtual ~SkNulCanvas() {}
29 void beginCommentGroup(const char* description) SK_OVERRIDE {}
30 void addComment(const char* kywd, const char* value) SK_OVERRIDE {}
31 void endCommentGroup() SK_OVERRIDE {}
32 SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE {return NULL;}
34 bool isClipEmpty() const SK_OVERRIDE { return false; }
35 bool getClipBounds(SkRect* bounds) const SK_OVERRIDE {
38 SkIntToScalar(this->imageInfo().width()),
39 SkIntToScalar(this->imageInfo().height()));
43 bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE {
51 virtual SkCanvas* canvasForDrawIter() {return NULL;}
52 virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;}
54 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
55 SaveFlags flags) SK_OVERRIDE {
56 this->INHERITED::willSaveLayer(bounds, paint, flags);
57 return kNoLayer_SaveLayerStrategy;
60 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x,
61 SkScalar y, const SkPaint& paint) SK_OVERRIDE {}
62 virtual void onDrawPosText(const void* text, size_t byteLength,
63 const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE {}
64 virtual void onDrawPosTextH(const void* text, size_t byteLength,
65 const SkScalar xpos[], SkScalar constY,
66 const SkPaint& paint) SK_OVERRIDE {}
67 virtual void onDrawTextOnPath(const void* text, size_t byteLength,
68 const SkPath& path, const SkMatrix* matrix,
69 const SkPaint& paint) SK_OVERRIDE {}
71 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {}
72 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {}
73 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE {}
74 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE {}
76 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE {}
78 void onDrawPaint(const SkPaint& paint) SK_OVERRIDE {}
79 void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
80 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 {}
83 void onDrawRRect(const SkRRect& rrect, 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,
86 const SkPaint* paint = NULL) SK_OVERRIDE {}
87 void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
90 DrawBitmapRectFlags flags) SK_OVERRIDE {}
91 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE {}
92 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
93 const SkPaint*) SK_OVERRIDE{}
94 void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
95 const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE {}
96 void onDrawSprite(const SkBitmap& bitmap, int left, int top,
97 const SkPaint* paint = NULL) SK_OVERRIDE {}
98 void onDrawVertices(VertexMode vmode, int vertexCount,
99 const SkPoint vertices[], const SkPoint texs[],
100 const SkColor colors[], SkXfermode* xmode,
101 const uint16_t indices[], int indexCount,
102 const SkPaint& paint) SK_OVERRIDE {}
106 typedef SkCanvas INHERITED;
109 #endif // SkNulCanvas_DEFINED