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