1 /* 2 * Copyright 2016 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 SkNoDrawCanvas_DEFINED 9 #define SkNoDrawCanvas_DEFINED 10 11 #include "SkCanvas.h" 12 #include "SkVertices.h" 13 14 struct SkIRect; 15 16 // SkNoDrawCanvas is a helper for SkCanvas subclasses which do not need to 17 // actually rasterize (e.g., analysis of the draw calls). 18 // 19 // It provides the following simplifications: 20 // 21 // * not backed by any device/pixels 22 // * conservative clipping (clipping calls only use rectangles) 23 // 24 class SK_API SkNoDrawCanvas : public SkCanvas { 25 public: 26 SkNoDrawCanvas(int width, int height); 27 28 // TODO: investigate the users of this ctor. 29 SkNoDrawCanvas(const SkIRect&); 30 31 protected: 32 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override; 33 34 // No-op overrides for aborting rasterization earlier than SkNullBlitter. onDrawDRRect(const SkRRect &,const SkRRect &,const SkPaint &)35 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override {} onDrawDrawable(SkDrawable *,const SkMatrix *)36 void onDrawDrawable(SkDrawable*, const SkMatrix*) override {} onDrawText(const void *,size_t,SkScalar,SkScalar,const SkPaint &)37 void onDrawText(const void*, size_t, SkScalar, SkScalar, const SkPaint&) override {} onDrawPosText(const void *,size_t,const SkPoint[],const SkPaint &)38 void onDrawPosText(const void*, size_t, const SkPoint[], const SkPaint&) override {} onDrawPosTextH(const void *,size_t,const SkScalar[],SkScalar,const SkPaint &)39 void onDrawPosTextH(const void*, size_t, const SkScalar[], SkScalar, const SkPaint&) override {} onDrawTextOnPath(const void *,size_t,const SkPath &,const SkMatrix *,const SkPaint &)40 void onDrawTextOnPath(const void*, size_t, const SkPath&, const SkMatrix*, 41 const SkPaint&) override {} onDrawTextRSXform(const void *,size_t,const SkRSXform[],const SkRect *,const SkPaint &)42 void onDrawTextRSXform(const void*, size_t, const SkRSXform[], const SkRect*, 43 const SkPaint&) override {} onDrawTextBlob(const SkTextBlob *,SkScalar,SkScalar,const SkPaint &)44 void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override {} onDrawPatch(const SkPoint[12],const SkColor[4],const SkPoint[4],SkBlendMode,const SkPaint &)45 void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, 46 const SkPaint&) override {} 47 onDrawPaint(const SkPaint &)48 void onDrawPaint(const SkPaint&) override {} onDrawPoints(PointMode,size_t,const SkPoint[],const SkPaint &)49 void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint&) override {} onDrawRect(const SkRect &,const SkPaint &)50 void onDrawRect(const SkRect&, const SkPaint&) override {} onDrawRegion(const SkRegion &,const SkPaint &)51 void onDrawRegion(const SkRegion&, const SkPaint&) override {} onDrawOval(const SkRect &,const SkPaint &)52 void onDrawOval(const SkRect&, const SkPaint&) override {} onDrawArc(const SkRect &,SkScalar,SkScalar,bool,const SkPaint &)53 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override {} onDrawRRect(const SkRRect &,const SkPaint &)54 void onDrawRRect(const SkRRect&, const SkPaint&) override {} onDrawPath(const SkPath &,const SkPaint &)55 void onDrawPath(const SkPath&, const SkPaint&) override {} onDrawBitmap(const SkBitmap &,SkScalar,SkScalar,const SkPaint *)56 void onDrawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint*) override {} onDrawBitmapRect(const SkBitmap &,const SkRect *,const SkRect &,const SkPaint *,SrcRectConstraint)57 void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, 58 SrcRectConstraint) override {} onDrawImage(const SkImage *,SkScalar,SkScalar,const SkPaint *)59 void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) override {} onDrawImageRect(const SkImage *,const SkRect *,const SkRect &,const SkPaint *,SrcRectConstraint)60 void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*, 61 SrcRectConstraint) override {} onDrawImageNine(const SkImage *,const SkIRect &,const SkRect &,const SkPaint *)62 void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) override {} onDrawBitmapNine(const SkBitmap &,const SkIRect &,const SkRect &,const SkPaint *)63 void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, 64 const SkPaint*) override {} onDrawImageLattice(const SkImage *,const Lattice &,const SkRect &,const SkPaint *)65 void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, 66 const SkPaint*) override {} onDrawBitmapLattice(const SkBitmap &,const Lattice &,const SkRect &,const SkPaint *)67 void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&, 68 const SkPaint*) override {} onDrawVerticesObject(const SkVertices *,SkBlendMode,const SkPaint &)69 void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override {} onDrawAtlas(const SkImage *,const SkRSXform[],const SkRect[],const SkColor[],int,SkBlendMode,const SkRect *,const SkPaint *)70 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], 71 int, SkBlendMode, const SkRect*, const SkPaint*) override {} 72 73 private: 74 typedef SkCanvas INHERITED; 75 }; 76 77 #endif // SkNoDrawCanvas_DEFINED 78