Home | History | Annotate | Download | only in core
      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 "SkCanvasVirtualEnforcer.h"
     12 #include "SkNoDrawCanvas.h"
     13 
     14 class SkLiteDL;
     15 
     16 class SkLiteRecorder final : public SkCanvasVirtualEnforcer<SkNoDrawCanvas> {
     17 public:
     18     SkLiteRecorder();
     19     void reset(SkLiteDL*, const SkIRect& bounds);
     20 
     21     sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
     22 
     23     void willSave() override;
     24     SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
     25     bool onDoSaveBehind(const SkRect*) override;
     26     void willRestore() override;
     27 
     28     void onFlush() override;
     29 
     30     void didConcat(const SkMatrix&) override;
     31     void didSetMatrix(const SkMatrix&) override;
     32     void didTranslate(SkScalar, SkScalar) override;
     33 
     34     void onClipRect  (const   SkRect&, SkClipOp, ClipEdgeStyle) override;
     35     void onClipRRect (const  SkRRect&, SkClipOp, ClipEdgeStyle) override;
     36     void onClipPath  (const   SkPath&, SkClipOp, ClipEdgeStyle) override;
     37     void onClipRegion(const SkRegion&, SkClipOp) override;
     38 
     39     void onDrawPaint (const SkPaint&) override;
     40     void onDrawPath  (const SkPath&, const SkPaint&) override;
     41     void onDrawRect  (const SkRect&, const SkPaint&) override;
     42     void onDrawEdgeAARect(const SkRect&, SkCanvas::QuadAAFlags, SkColor, SkBlendMode) override;
     43     void onDrawRegion(const SkRegion&, const SkPaint&) override;
     44     void onDrawOval  (const SkRect&, const SkPaint&) override;
     45     void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override;
     46     void onDrawRRect (const SkRRect&, const SkPaint&) override;
     47     void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
     48 
     49     void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
     50     void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
     51     void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
     52 
     53     void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
     54 
     55     void onDrawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint*) override;
     56     void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
     57                              const SkPaint*) override;
     58     void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, const SkPaint*) override;
     59     void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*,
     60                           SrcRectConstraint) override;
     61 
     62     void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) override;
     63     void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override;
     64     void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) override;
     65     void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
     66                          SrcRectConstraint) override;
     67     void onDrawImageSet(const ImageSetEntry[], int count, SkFilterQuality, SkBlendMode) override;
     68 
     69     void onDrawPatch(const SkPoint[12], const SkColor[4],
     70                      const SkPoint[4], SkBlendMode, const SkPaint&) override;
     71     void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
     72     void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
     73                               SkBlendMode, const SkPaint&) override;
     74     void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
     75                      int, SkBlendMode, const SkRect*, const SkPaint*) override;
     76     void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
     77 
     78 private:
     79     typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED;
     80 
     81     SkLiteDL* fDL;
     82 };
     83 
     84 #endif//SkLiteRecorder_DEFINED
     85