blob: 02d715b50abaa3e019df23e8e55723982af15549 [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
commit-bot@chromium.orge1a81d22013-07-15 22:49:37 +000014class SK_API SkNWayCanvas : public SkCanvas {
reed@android.com6c924ad2009-03-31 03:48:49 +000015public:
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
djsollen@google.com339e79f2013-09-04 17:16:00 +000019 virtual void addCanvas(SkCanvas*);
20 virtual void removeCanvas(SkCanvas*);
21 virtual void removeAll();
reed@android.com6c924ad2009-03-31 03:48:49 +000022
23 ///////////////////////////////////////////////////////////////////////////
24 // These are forwarded to the N canvases we're referencing
25
mtklein72c9faa2015-01-09 10:06:39 -080026 SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000027
mtklein72c9faa2015-01-09 10:06:39 -080028 void beginCommentGroup(const char* description) SK_OVERRIDE;
29 void addComment(const char* kywd, const char* value) SK_OVERRIDE;
30 void endCommentGroup() SK_OVERRIDE;
commit-bot@chromium.org14cec912013-07-20 15:03:26 +000031
djsollen@google.com339e79f2013-09-04 17:16:00 +000032protected:
reed@android.com6c924ad2009-03-31 03:48:49 +000033 SkTDArray<SkCanvas*> fList;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000034
mtklein72c9faa2015-01-09 10:06:39 -080035 void willSave() SK_OVERRIDE;
36 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
37 void willRestore() SK_OVERRIDE;
commit-bot@chromium.orge54a23f2014-03-12 20:21:48 +000038
mtklein72c9faa2015-01-09 10:06:39 -080039 void didConcat(const SkMatrix&) SK_OVERRIDE;
40 void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
commit-bot@chromium.org44c48d02014-03-13 20:03:58 +000041
mtklein72c9faa2015-01-09 10:06:39 -080042 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
reed@google.come0d9ce82014-04-23 04:00:17 +000043 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
44 const SkPaint&) SK_OVERRIDE;
45 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
46 const SkPaint&) SK_OVERRIDE;
47 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
48 SkScalar constY, const SkPaint&) SK_OVERRIDE;
49 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
50 const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE;
fmalitab7425172014-08-26 07:56:44 -070051 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
52 const SkPaint& paint) SK_OVERRIDE;
dandovb3c9d1c2014-08-12 08:34:29 -070053 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
54 const SkPoint texCoords[4], SkXfermode* xmode,
55 const SkPaint& paint) SK_OVERRIDE;
piotaixrb7bac3d2014-09-29 08:56:19 -070056
reed41af9662015-01-05 07:49:08 -080057 void onDrawPaint(const SkPaint&) SK_OVERRIDE;
58 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
59 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
60 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
61 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
62 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
63 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
64 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
65 DrawBitmapRectFlags flags) SK_OVERRIDE;
66 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
67 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
68 const SkPaint*) SK_OVERRIDE;
69 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
70 const SkPaint*) SK_OVERRIDE;
71 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
72 void onDrawVertices(VertexMode vmode, int vertexCount,
73 const SkPoint vertices[], const SkPoint texs[],
74 const SkColor colors[], SkXfermode* xmode,
75 const uint16_t indices[], int indexCount,
76 const SkPaint&) SK_OVERRIDE;
77
mtklein72c9faa2015-01-09 10:06:39 -080078 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
79 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
80 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
81 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
robertphillips@google.com8f90a892014-02-28 18:19:39 +000082
mtklein72c9faa2015-01-09 10:06:39 -080083 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE;
robertphillips9b14f262014-06-04 05:40:44 -070084
reed@android.com6c924ad2009-03-31 03:48:49 +000085 class Iter;
86
djsollen@google.com339e79f2013-09-04 17:16:00 +000087private:
reed@android.com6c924ad2009-03-31 03:48:49 +000088 typedef SkCanvas INHERITED;
89};
90
91
92#endif