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 "SkCanvas.h" 13 14 class SK_API SkNWayCanvas : public SkCanvas { 15 public: 16 SkNWayCanvas(int width, int height); 17 virtual ~SkNWayCanvas(); 18 19 virtual void addCanvas(SkCanvas*); 20 virtual void removeCanvas(SkCanvas*); 21 virtual void removeAll(); 22 23 /////////////////////////////////////////////////////////////////////////// 24 // These are forwarded to the N canvases we're referencing 25 26 virtual void clear(SkColor) SK_OVERRIDE; 27 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 28 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 29 const SkPaint&) SK_OVERRIDE; 30 virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; 31 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; 32 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; 33 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; 34 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 35 const SkPaint*) SK_OVERRIDE; 36 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, 37 const SkRect& dst, const SkPaint* paint, 38 DrawBitmapRectFlags flags) SK_OVERRIDE; 39 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, 40 const SkPaint*) SK_OVERRIDE; 41 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 42 const SkRect& dst, 43 const SkPaint* paint = NULL) SK_OVERRIDE; 44 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, 45 const SkPaint*) SK_OVERRIDE; 46 virtual void drawVertices(VertexMode vmode, int vertexCount, 47 const SkPoint vertices[], const SkPoint texs[], 48 const SkColor colors[], SkXfermode* xmode, 49 const uint16_t indices[], int indexCount, 50 const SkPaint&) SK_OVERRIDE; 51 virtual void drawData(const void* data, size_t length) SK_OVERRIDE; 52 53 virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE; 54 55 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; 56 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; 57 virtual void endCommentGroup() SK_OVERRIDE; 58 59 protected: 60 SkTDArray<SkCanvas*> fList; 61 62 virtual void willSave() SK_OVERRIDE; 63 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE; 64 virtual void willRestore() SK_OVERRIDE; 65 66 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; 67 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; 68 69 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; 70 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, 71 const SkPaint&) SK_OVERRIDE; 72 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], 73 const SkPaint&) SK_OVERRIDE; 74 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], 75 SkScalar constY, const SkPaint&) SK_OVERRIDE; 76 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 77 const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE; 78 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 79 const SkPaint& paint) SK_OVERRIDE; 80 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 81 const SkPoint texCoords[4], SkXfermode* xmode, 82 const SkPaint& paint) SK_OVERRIDE; 83 84 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; 85 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; 86 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; 87 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; 88 89 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE; 90 91 class Iter; 92 93 private: 94 typedef SkCanvas INHERITED; 95 }; 96 97 98 #endif 99