SkLiteRecorder.h revision cbdf007bc2eb85056a1a5c75c088202becba2d16
19c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein/*
29c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein * Copyright 2016 Google Inc.
39c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein *
49c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein * Use of this source code is governed by a BSD-style license that can be
59c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein * found in the LICENSE file.
69c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein */
79c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
89c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#ifndef SkLiteRecorder_DEFINED
99c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#define SkLiteRecorder_DEFINED
109c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
119c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#include "SkCanvas.h"
129c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
139c5052f16b249d2b7674ea86bd24ed0038ccc61fmtkleinclass SkLiteDL;
149c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
159c5052f16b249d2b7674ea86bd24ed0038ccc61fmtkleinclass SkLiteRecorder final : public SkCanvas {
169c5052f16b249d2b7674ea86bd24ed0038ccc61fmtkleinpublic:
179c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    SkLiteRecorder();
189c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void reset(SkLiteDL*);
199c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
209c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
219c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
229c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void willSave() override;
239c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
249c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void willRestore() override;
259c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
269c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void didConcat(const SkMatrix&) override;
279c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void didSetMatrix(const SkMatrix&) override;
28cbdf007bc2eb85056a1a5c75c088202becba2d16mtklein    void didTranslate(SkScalar, SkScalar) override;
299c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
309c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onClipRect  (const   SkRect&, SkRegion::Op, ClipEdgeStyle) override;
319c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onClipRRect (const  SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
329c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onClipPath  (const   SkPath&, SkRegion::Op, ClipEdgeStyle) override;
339c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onClipRegion(const SkRegion&, SkRegion::Op) override;
349c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
359c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPaint (const SkPaint&) override;
369c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPath  (const SkPath&,  const SkPaint&) override;
379c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawRect  (const SkRect&,  const SkPaint&) override;
389c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawOval  (const SkRect&,  const SkPaint&) override;
399c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawRRect (const SkRRect&, const SkPaint&) override;
409c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
419c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
429c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
439c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
449c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
459c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
469c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawText      (const void*, size_t, SkScalar x, SkScalar y, const SkPaint&) override;
479c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPosText   (const void*, size_t, const SkPoint[], const SkPaint&) override;
489c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPosTextH  (const void*, size_t, const SkScalar[], SkScalar, const SkPaint&) override;
499c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawTextOnPath(const void*, size_t,
509c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                          const SkPath&, const SkMatrix*, const SkPaint&) override;
519c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawTextRSXform(const void*, size_t,
529c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                           const SkRSXform[], const SkRect*, const SkPaint&) override;
539c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
549c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
559c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint*) override;
56168820625c35a8c19f66c661efcbce7a5e334837msarett    void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
57168820625c35a8c19f66c661efcbce7a5e334837msarett                             const SkPaint*) override;
589c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, const SkPaint*) override;
599c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*,
609c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                          SrcRectConstraint) override;
619c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
629c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) override;
639c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override;
649c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) override;
659c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
669c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                         SrcRectConstraint) override;
679c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
689c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPatch(const SkPoint[12], const SkColor[4],
699c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                     const SkPoint[4], SkXfermode*, const SkPaint&) override;
709c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
719c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawVertices(VertexMode, int, const SkPoint[], const SkPoint[], const SkColor[],
729c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                        SkXfermode*, const uint16_t[], int, const SkPaint&) override;
739c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
749c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein                     int, SkXfermode::Mode, const SkRect*, const SkPaint*) override;
759c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
769c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#ifdef SK_EXPERIMENTAL_SHADOWING
779c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void didTranslateZ(SkScalar) override;
789c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawShadowedPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
799c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#else
809c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void didTranslateZ(SkScalar);
819c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    void onDrawShadowedPicture(const SkPicture*, const SkMatrix*, const SkPaint*);
829c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#endif
839c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
849c5052f16b249d2b7674ea86bd24ed0038ccc61fmtkleinprivate:
859c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein    SkLiteDL* fDL;
869c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein};
879c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein
889c5052f16b249d2b7674ea86bd24ed0038ccc61fmtklein#endif//SkLiteRecorder_DEFINED
89