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 14class SkNWayCanvas : public SkCanvas { 15public: 16 SkNWayCanvas(int width, int height); 17 virtual ~SkNWayCanvas(); 18 19 void addCanvas(SkCanvas*); 20 void removeCanvas(SkCanvas*); 21 void removeAll(); 22 23 /////////////////////////////////////////////////////////////////////////// 24 // These are forwarded to the N canvases we're referencing 25 26 virtual int save(SaveFlags) SK_OVERRIDE; 27 virtual int saveLayer(const SkRect* bounds, const SkPaint*, 28 SaveFlags) SK_OVERRIDE; 29 virtual void restore() SK_OVERRIDE; 30 virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE; 31 virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE; 32 virtual bool rotate(SkScalar degrees) SK_OVERRIDE; 33 virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE; 34 virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE; 35 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; 36 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE; 37 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; 38 virtual bool clipRegion(const SkRegion& deviceRgn, 39 SkRegion::Op) SK_OVERRIDE; 40 41 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; 42 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], 43 const SkPaint&) SK_OVERRIDE; 44 virtual void drawRect(const SkRect& rect, const SkPaint&) SK_OVERRIDE; 45 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; 46 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 47 const SkPaint*) SK_OVERRIDE; 48 virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, 49 const SkRect& dst, const SkPaint*) SK_OVERRIDE; 50 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, 51 const SkPaint*) SK_OVERRIDE; 52 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, 53 const SkPaint*) SK_OVERRIDE; 54 virtual void drawText(const void* text, size_t byteLength, SkScalar x, 55 SkScalar y, const SkPaint&) SK_OVERRIDE; 56 virtual void drawPosText(const void* text, size_t byteLength, 57 const SkPoint pos[], const SkPaint&) SK_OVERRIDE; 58 virtual void drawPosTextH(const void* text, size_t byteLength, 59 const SkScalar xpos[], SkScalar constY, 60 const SkPaint&) SK_OVERRIDE; 61 virtual void drawTextOnPath(const void* text, size_t byteLength, 62 const SkPath& path, const SkMatrix* matrix, 63 const SkPaint&) SK_OVERRIDE; 64 virtual void drawPicture(SkPicture&) SK_OVERRIDE; 65 virtual void drawVertices(VertexMode vmode, int vertexCount, 66 const SkPoint vertices[], const SkPoint texs[], 67 const SkColor colors[], SkXfermode* xmode, 68 const uint16_t indices[], int indexCount, 69 const SkPaint&) SK_OVERRIDE; 70 71 virtual SkBounder* setBounder(SkBounder*) SK_OVERRIDE; 72 virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE; 73 74private: 75 SkTDArray<SkCanvas*> fList; 76 77 class Iter; 78 79 typedef SkCanvas INHERITED; 80}; 81 82 83#endif 84 85