mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [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 SkLiteRecorder_DEFINED |
| 9 | #define SkLiteRecorder_DEFINED |
| 10 | |
| 11 | #include "SkCanvas.h" |
| 12 | |
| 13 | class SkLiteDL; |
| 14 | |
| 15 | class SkLiteRecorder final : public SkCanvas { |
| 16 | public: |
| 17 | SkLiteRecorder(); |
| 18 | void reset(SkLiteDL*); |
| 19 | |
| 20 | sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override; |
| 21 | |
reed | 6ae6969 | 2016-09-02 04:56:53 -0700 | [diff] [blame] | 22 | #ifdef SK_SUPPORT_LEGACY_DRAWFILTER |
| 23 | SkDrawFilter* setDrawFilter(SkDrawFilter*) override; |
| 24 | #endif |
| 25 | |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 26 | void willSave() override; |
| 27 | SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; |
| 28 | void willRestore() override; |
| 29 | |
| 30 | void didConcat(const SkMatrix&) override; |
| 31 | void didSetMatrix(const SkMatrix&) override; |
mtklein | cbdf007 | 2016-08-19 09:05:27 -0700 | [diff] [blame] | 32 | void didTranslate(SkScalar, SkScalar) override; |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 33 | |
| 34 | void onClipRect (const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 35 | void onClipRRect (const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 36 | void onClipPath (const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
| 37 | void onClipRegion(const SkRegion&, SkRegion::Op) override; |
| 38 | |
| 39 | void onDrawPaint (const SkPaint&) override; |
msarett | 44df651 | 2016-08-25 13:54:30 -0700 | [diff] [blame] | 40 | void onDrawPath (const SkPath&, const SkPaint&) override; |
| 41 | void onDrawRect (const SkRect&, const SkPaint&) override; |
| 42 | void onDrawRegion(const SkRegion&, const SkPaint&) override; |
| 43 | void onDrawOval (const SkRect&, const SkPaint&) override; |
bsalomon | ac3aa24 | 2016-08-19 11:25:19 -0700 | [diff] [blame] | 44 | void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 45 | void onDrawRRect (const SkRRect&, const SkPaint&) override; |
| 46 | void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
| 47 | |
| 48 | void onDrawDrawable(SkDrawable*, const SkMatrix*) override; |
| 49 | void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; |
| 50 | void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |
| 51 | |
| 52 | void onDrawText (const void*, size_t, SkScalar x, SkScalar y, const SkPaint&) override; |
| 53 | void onDrawPosText (const void*, size_t, const SkPoint[], const SkPaint&) override; |
| 54 | void onDrawPosTextH (const void*, size_t, const SkScalar[], SkScalar, const SkPaint&) override; |
| 55 | void onDrawTextOnPath(const void*, size_t, |
| 56 | const SkPath&, const SkMatrix*, const SkPaint&) override; |
| 57 | void onDrawTextRSXform(const void*, size_t, |
| 58 | const SkRSXform[], const SkRect*, const SkPaint&) override; |
| 59 | void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override; |
| 60 | |
| 61 | void onDrawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint*) override; |
msarett | 1688206 | 2016-08-16 09:31:08 -0700 | [diff] [blame] | 62 | void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&, |
| 63 | const SkPaint*) override; |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 64 | void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, const SkPaint*) override; |
| 65 | void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*, |
| 66 | SrcRectConstraint) override; |
| 67 | |
| 68 | void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) override; |
| 69 | void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override; |
| 70 | void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) override; |
| 71 | void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*, |
| 72 | SrcRectConstraint) override; |
| 73 | |
| 74 | void onDrawPatch(const SkPoint[12], const SkColor[4], |
| 75 | const SkPoint[4], SkXfermode*, const SkPaint&) override; |
| 76 | void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; |
| 77 | void onDrawVertices(VertexMode, int, const SkPoint[], const SkPoint[], const SkColor[], |
| 78 | SkXfermode*, const uint16_t[], int, const SkPaint&) override; |
| 79 | void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], |
| 80 | int, SkXfermode::Mode, const SkRect*, const SkPaint*) override; |
| 81 | |
| 82 | #ifdef SK_EXPERIMENTAL_SHADOWING |
| 83 | void didTranslateZ(SkScalar) override; |
vjiaoblack | e6f5d56 | 2016-08-25 06:30:23 -0700 | [diff] [blame] | 84 | void onDrawShadowedPicture(const SkPicture*, const SkMatrix*, |
| 85 | const SkPaint*, const SkShadowParams& params) override; |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 86 | #else |
| 87 | void didTranslateZ(SkScalar); |
vjiaoblack | e6f5d56 | 2016-08-25 06:30:23 -0700 | [diff] [blame] | 88 | void onDrawShadowedPicture(const SkPicture*, const SkMatrix*, |
| 89 | const SkPaint*, const SkShadowParams& params); |
mtklein | 9c5052f | 2016-08-06 12:51:51 -0700 | [diff] [blame] | 90 | #endif |
| 91 | |
| 92 | private: |
| 93 | SkLiteDL* fDL; |
| 94 | }; |
| 95 | |
| 96 | #endif//SkLiteRecorder_DEFINED |