blob: a90f7d3dea0f0779cd5a4473779eba1eb066dee0 [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
commit-bot@chromium.orgbe65a4c2013-11-14 19:02:41 +000026 virtual void clear(SkColor) SK_OVERRIDE;
reed@google.com43d74842011-12-07 14:46:39 +000027 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000028 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
reed@google.com43d74842011-12-07 14:46:39 +000029 const SkPaint&) SK_OVERRIDE;
bsalomon@google.com7ce564c2013-10-22 16:54:15 +000030 virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
commit-bot@chromium.orgbe65a4c2013-11-14 19:02:41 +000031 virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
reed@google.com4ed0fb72012-12-12 20:48:18 +000032 virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
bsalomon@google.com7ce564c2013-10-22 16:54:15 +000033 virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000034 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
reed@google.com43d74842011-12-07 14:46:39 +000035 const SkPaint*) SK_OVERRIDE;
reed@google.com71121732012-09-18 15:14:33 +000036 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
commit-bot@chromium.orgeed779d2013-08-16 10:24:37 +000037 const SkRect& dst, const SkPaint* paint,
38 DrawBitmapRectFlags flags) SK_OVERRIDE;
piotaixrb7bac3d2014-09-29 08:56:19 -070039 virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top,
40 const SkPaint* paint) SK_OVERRIDE;
41 virtual void drawImageRect(const SkImage* image, const SkRect* src,
42 const SkRect& dst,
43 const SkPaint* paint) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000044 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
reed@google.com43d74842011-12-07 14:46:39 +000045 const SkPaint*) SK_OVERRIDE;
commit-bot@chromium.orgbe65a4c2013-11-14 19:02:41 +000046 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
47 const SkRect& dst,
48 const SkPaint* paint = NULL) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000049 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
reed@google.com43d74842011-12-07 14:46:39 +000050 const SkPaint*) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000051 virtual void drawVertices(VertexMode vmode, int vertexCount,
52 const SkPoint vertices[], const SkPoint texs[],
53 const SkColor colors[], SkXfermode* xmode,
54 const uint16_t indices[], int indexCount,
reed@google.com43d74842011-12-07 14:46:39 +000055 const SkPaint&) SK_OVERRIDE;
commit-bot@chromium.orgbe65a4c2013-11-14 19:02:41 +000056 virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
reed@android.com6c924ad2009-03-31 03:48:49 +000057
reed@google.com43d74842011-12-07 14:46:39 +000058 virtual SkDrawFilter* setDrawFilter(SkDrawFilter*) SK_OVERRIDE;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000059
commit-bot@chromium.org14cec912013-07-20 15:03:26 +000060 virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
61 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
62 virtual void endCommentGroup() SK_OVERRIDE;
63
djsollen@google.com339e79f2013-09-04 17:16:00 +000064protected:
reed@android.com6c924ad2009-03-31 03:48:49 +000065 SkTDArray<SkCanvas*> fList;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000066
Florin Malita5f6102d2014-06-30 10:13:28 -040067 virtual void willSave() SK_OVERRIDE;
commit-bot@chromium.orge54a23f2014-03-12 20:21:48 +000068 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
69 virtual void willRestore() SK_OVERRIDE;
70
commit-bot@chromium.org44c48d02014-03-13 20:03:58 +000071 virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
72 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
73
commit-bot@chromium.orgab582732014-02-21 12:20:45 +000074 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
reed@google.come0d9ce82014-04-23 04:00:17 +000075 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
76 const SkPaint&) SK_OVERRIDE;
77 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
78 const SkPaint&) SK_OVERRIDE;
79 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
80 SkScalar constY, const SkPaint&) SK_OVERRIDE;
81 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
82 const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE;
fmalitab7425172014-08-26 07:56:44 -070083 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
84 const SkPaint& paint) SK_OVERRIDE;
dandovb3c9d1c2014-08-12 08:34:29 -070085 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
86 const SkPoint texCoords[4], SkXfermode* xmode,
87 const SkPaint& paint) SK_OVERRIDE;
piotaixrb7bac3d2014-09-29 08:56:19 -070088
robertphillips@google.com8f90a892014-02-28 18:19:39 +000089 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
90 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
91 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
92 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
93
reedd5fa1a42014-08-09 11:08:05 -070094 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE;
robertphillips9b14f262014-06-04 05:40:44 -070095
reed@android.com6c924ad2009-03-31 03:48:49 +000096 class Iter;
97
djsollen@google.com339e79f2013-09-04 17:16:00 +000098private:
reed@android.com6c924ad2009-03-31 03:48:49 +000099 typedef SkCanvas INHERITED;
100};
101
102
103#endif