1 2/* 3 * Copyright 2011 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9#ifndef SkNWayCanvas_DEFINED 10#define SkNWayCanvas_DEFINED 11 12#include "../private/SkTDArray.h" 13#include "SkNoDrawCanvas.h" 14 15class SK_API SkNWayCanvas : public SkNoDrawCanvas { 16public: 17 SkNWayCanvas(int width, int height); 18 ~SkNWayCanvas() override; 19 20 virtual void addCanvas(SkCanvas*); 21 virtual void removeCanvas(SkCanvas*); 22 virtual void removeAll(); 23 24 /////////////////////////////////////////////////////////////////////////// 25 // These are forwarded to the N canvases we're referencing 26 27#ifdef SK_SUPPORT_LEGACY_DRAWFILTER 28 SkDrawFilter* setDrawFilter(SkDrawFilter*) override; 29#endif 30 31protected: 32 SkTDArray<SkCanvas*> fList; 33 34 void willSave() override; 35 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; 36 void willRestore() override; 37 38 void didConcat(const SkMatrix&) override; 39 void didSetMatrix(const SkMatrix&) override; 40 41 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; 42 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 43 const SkPaint&) override; 44 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], 45 const SkPaint&) override; 46 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], 47 SkScalar constY, const SkPaint&) override; 48 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 49 const SkMatrix* matrix, const SkPaint&) override; 50 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 51 const SkPaint& paint) override; 52 void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[], 53 const SkRect* cull, const SkPaint& paint) override; 54 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 55 const SkPoint texCoords[4], SkBlendMode, 56 const SkPaint& paint) override; 57 58 void onDrawPaint(const SkPaint&) override; 59 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; 60 void onDrawRect(const SkRect&, const SkPaint&) override; 61 void onDrawOval(const SkRect&, const SkPaint&) override; 62 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; 63 void onDrawRRect(const SkRRect&, const SkPaint&) override; 64 void onDrawPath(const SkPath&, const SkPaint&) override; 65 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override; 66 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, 67 SrcRectConstraint) override; 68 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; 69 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, 70 const SkPaint*, SrcRectConstraint) override; 71 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 72 const SkPaint*) override; 73 void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; 74 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; 75 76 void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; 77 void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; 78 void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; 79 void onClipRegion(const SkRegion&, SkClipOp) override; 80 81 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; 82 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; 83 84 class Iter; 85 86private: 87 typedef SkNoDrawCanvas INHERITED; 88}; 89 90 91#endif 92