blob: fcd0ccff0e7937a1bf1d2129689fc663cf28dc07 [file] [log] [blame]
reed@android.com6c924ad2009-03-31 03:48:49 +00001
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002/*
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
reed@android.com6c924ad2009-03-31 03:48:49 +00009#ifndef SkNWayCanvas_DEFINED
10#define SkNWayCanvas_DEFINED
11
12#include "SkCanvas.h"
13
14class SkNWayCanvas : public SkCanvas {
15public:
djsollen@google.comf0a062b2012-05-01 16:50:25 +000016 SkNWayCanvas(int width, int height);
reed@android.com6c924ad2009-03-31 03:48:49 +000017 virtual ~SkNWayCanvas();
vandebo@chromium.org74b46192012-01-28 01:45:11 +000018
reed@android.com6c924ad2009-03-31 03:48:49 +000019 void addCanvas(SkCanvas*);
20 void removeCanvas(SkCanvas*);
21 void removeAll();
22
23 ///////////////////////////////////////////////////////////////////////////
24 // These are forwarded to the N canvases we're referencing
25
reed@google.com43d74842011-12-07 14:46:39 +000026 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;
reed@google.com071eef92011-10-12 11:52:53 +000036 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
reed@google.com68d61ed2012-12-12 19:02:53 +000037 virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
reed@google.com071eef92011-10-12 11:52:53 +000038 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000039 virtual bool clipRegion(const SkRegion& deviceRgn,
reed@google.com43d74842011-12-07 14:46:39 +000040 SkRegion::Op) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000041
reed@google.com43d74842011-12-07 14:46:39 +000042 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000043 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
reed@google.com43d74842011-12-07 14:46:39 +000044 const SkPaint&) SK_OVERRIDE;
reed@google.com68d61ed2012-12-12 19:02:53 +000045 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
46 virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
47 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
reed@google.com43d74842011-12-07 14:46:39 +000048 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000049 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
reed@google.com43d74842011-12-07 14:46:39 +000050 const SkPaint*) SK_OVERRIDE;
reed@google.com71121732012-09-18 15:14:33 +000051 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
reed@google.com43d74842011-12-07 14:46:39 +000052 const SkRect& dst, const SkPaint*) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000053 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
reed@google.com43d74842011-12-07 14:46:39 +000054 const SkPaint*) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000055 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
reed@google.com43d74842011-12-07 14:46:39 +000056 const SkPaint*) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000057 virtual void drawText(const void* text, size_t byteLength, SkScalar x,
reed@google.com43d74842011-12-07 14:46:39 +000058 SkScalar y, const SkPaint&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000059 virtual void drawPosText(const void* text, size_t byteLength,
reed@google.com43d74842011-12-07 14:46:39 +000060 const SkPoint pos[], const SkPaint&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000061 virtual void drawPosTextH(const void* text, size_t byteLength,
62 const SkScalar xpos[], SkScalar constY,
reed@google.com43d74842011-12-07 14:46:39 +000063 const SkPaint&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000064 virtual void drawTextOnPath(const void* text, size_t byteLength,
65 const SkPath& path, const SkMatrix* matrix,
reed@google.com43d74842011-12-07 14:46:39 +000066 const SkPaint&) SK_OVERRIDE;
67 virtual void drawPicture(SkPicture&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000068 virtual void drawVertices(VertexMode vmode, int vertexCount,
69 const SkPoint vertices[], const SkPoint texs[],
70 const SkColor colors[], SkXfermode* xmode,
71 const uint16_t indices[], int indexCount,
reed@google.com43d74842011-12-07 14:46:39 +000072 const SkPaint&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000073
reed@google.com43d74842011-12-07 14:46:39 +000074 virtual SkBounder* setBounder(SkBounder*) SK_OVERRIDE;
75 virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000076
reed@android.com6c924ad2009-03-31 03:48:49 +000077private:
78 SkTDArray<SkCanvas*> fList;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000079
reed@android.com6c924ad2009-03-31 03:48:49 +000080 class Iter;
81
82 typedef SkCanvas INHERITED;
83};
84
85
86#endif
87