1cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com/* 2cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * Copyright 2013 Google Inc. 3cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * 4cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * Use of this source code is governed by a BSD-style license that can be 5cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * found in the LICENSE file. 6cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com */ 7cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com 8cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com#ifndef SkNulCanvas_DEFINED 9cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com#define SkNulCanvas_DEFINED 10ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 11ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com#include "SkCanvas.h" 12ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 132af2ad9cc0b2c7d911aed2e8d2ac77c0b7d3b5dfedisonn@google.com/** \class SkNulCanvas 142af2ad9cc0b2c7d911aed2e8d2ac77c0b7d3b5dfedisonn@google.com * 152af2ad9cc0b2c7d911aed2e8d2ac77c0b7d3b5dfedisonn@google.com * Nul Canvas is a canvas that does nothing. It is used to measure the perf of just parsing 162af2ad9cc0b2c7d911aed2e8d2ac77c0b7d3b5dfedisonn@google.com * a pdf, without actually rendering anything. 172af2ad9cc0b2c7d911aed2e8d2ac77c0b7d3b5dfedisonn@google.com * 182af2ad9cc0b2c7d911aed2e8d2ac77c0b7d3b5dfedisonn@google.com */ 19ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.comclass SK_API SkNulCanvas : public SkCanvas { 20ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.compublic: 21ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com SK_DECLARE_INST_COUNT(SkNulCanvas); 22ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 23ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com SkNulCanvas() {} 241f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {} 25ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 26ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {} 27ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com virtual ~SkNulCanvas() {} 28ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 2936352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void beginCommentGroup(const char* description) override {} 3036352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void addComment(const char* kywd, const char* value) override {} 3136352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void endCommentGroup() override {} 3236352bf5e38f45a70ee4f4fc132a38048d38206dmtklein SkDrawFilter* setDrawFilter(SkDrawFilter* filter) override {return NULL;} 338f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com 3436352bf5e38f45a70ee4f4fc132a38048d38206dmtklein bool isClipEmpty() const override { return false; } 3536352bf5e38f45a70ee4f4fc132a38048d38206dmtklein bool getClipBounds(SkRect* bounds) const override { 368f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com if (NULL != bounds) { 37370a89980b2d38a6d01903b484bf404d6c48b496skia.committer@gmail.com bounds->setXYWH(0, 0, 38e5ea500d4714a7d84de2bf913e81be3b65d2de68reed SkIntToScalar(this->imageInfo().width()), 39e5ea500d4714a7d84de2bf913e81be3b65d2de68reed SkIntToScalar(this->imageInfo().height())); 408f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com } 418f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com return true; 428f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com } 4336352bf5e38f45a70ee4f4fc132a38048d38206dmtklein bool getClipDeviceBounds(SkIRect* bounds) const override { 448f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com if (NULL != bounds) { 458f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com bounds->setLargest(); 468f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com } 478f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com return true; 488f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com } 49ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 50ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.comprotected: 51ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com virtual SkCanvas* canvasForDrawIter() {return NULL;} 521f2f338e23789f3eef168dcbd8171a28820ba6c1robertphillips@google.com virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;} 53ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 54e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, 5536352bf5e38f45a70ee4f4fc132a38048d38206dmtklein SaveFlags flags) override { 56e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org this->INHERITED::willSaveLayer(bounds, paint, flags); 57e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org return kNoLayer_SaveLayerStrategy; 58e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org } 59e54a23fcfa42b2fc9d320650de72bcb2d9566b2dcommit-bot@chromium.org 60e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, 6136352bf5e38f45a70ee4f4fc132a38048d38206dmtklein SkScalar y, const SkPaint& paint) override {} 62e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com virtual void onDrawPosText(const void* text, size_t byteLength, 6336352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPoint pos[], const SkPaint& paint) override {} 64e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com virtual void onDrawPosTextH(const void* text, size_t byteLength, 65e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com const SkScalar xpos[], SkScalar constY, 6636352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint& paint) override {} 67e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com virtual void onDrawTextOnPath(const void* text, size_t byteLength, 68e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com const SkPath& path, const SkMatrix* matrix, 6936352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint& paint) override {} 70e0d9ce890e67d02727ac2811bb456ddb64f827d4reed@google.com 7136352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override {} 7236352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override {} 7336352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override {} 7436352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onClipRegion(const SkRegion&, SkRegion::Op) override {} 758f90a892c5130d4d26b5588e1ff151d01a40688arobertphillips@google.com 7636352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override {} 7753a8f216a85781476350474dd6e37f36426da995robertphillips 7836352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawPaint(const SkPaint& paint) override {} 7953a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], 8036352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint& paint) override {} 8136352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawRect(const SkRect& rect, const SkPaint& paint) override {} 8236352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawOval(const SkRect& oval, const SkPaint&) override {} 8336352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override {} 8436352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawPath(const SkPath& path, const SkPaint& paint) override {} 8553a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 8636352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint* paint = NULL) override {} 8753a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, 8853a8f216a85781476350474dd6e37f36426da995robertphillips const SkRect& dst, 8953a8f216a85781476350474dd6e37f36426da995robertphillips const SkPaint* paint, 9036352bf5e38f45a70ee4f4fc132a38048d38206dmtklein DrawBitmapRectFlags flags) override {} 9136352bf5e38f45a70ee4f4fc132a38048d38206dmtklein void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override {} 9253a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, 9336352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint*) override{} 9453a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 9536352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkRect& dst, const SkPaint* paint = NULL) override {} 9653a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawSprite(const SkBitmap& bitmap, int left, int top, 9736352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint* paint = NULL) override {} 9853a8f216a85781476350474dd6e37f36426da995robertphillips void onDrawVertices(VertexMode vmode, int vertexCount, 9953a8f216a85781476350474dd6e37f36426da995robertphillips const SkPoint vertices[], const SkPoint texs[], 10053a8f216a85781476350474dd6e37f36426da995robertphillips const SkColor colors[], SkXfermode* xmode, 10153a8f216a85781476350474dd6e37f36426da995robertphillips const uint16_t indices[], int indexCount, 10236352bf5e38f45a70ee4f4fc132a38048d38206dmtklein const SkPaint& paint) override {} 10353a8f216a85781476350474dd6e37f36426da995robertphillips 1049b14f26d0f3a974f3dd626c8354e1db1cfcd322frobertphillips 105ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.comprivate: 106ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com typedef SkCanvas INHERITED; 107ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com}; 108ac03d91ee03599eab946a8ad25e33f9fc5f3166eedisonn@google.com 109cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com#endif // SkNulCanvas_DEFINED 110