blob: 35eca7bd800de26577683c8f3c31bb36560ac5b5 [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"
bungemand3ebb482015-08-05 13:57:49 -070013#include "SkTDArray.h"
reed@android.com6c924ad2009-03-31 03:48:49 +000014
commit-bot@chromium.orge1a81d22013-07-15 22:49:37 +000015class SK_API SkNWayCanvas : public SkCanvas {
reed@android.com6c924ad2009-03-31 03:48:49 +000016public:
djsollen@google.comf0a062b2012-05-01 16:50:25 +000017 SkNWayCanvas(int width, int height);
reed@android.com6c924ad2009-03-31 03:48:49 +000018 virtual ~SkNWayCanvas();
vandebo@chromium.org74b46192012-01-28 01:45:11 +000019
djsollen@google.com339e79f2013-09-04 17:16:00 +000020 virtual void addCanvas(SkCanvas*);
21 virtual void removeCanvas(SkCanvas*);
22 virtual void removeAll();
reed@android.com6c924ad2009-03-31 03:48:49 +000023
24 ///////////////////////////////////////////////////////////////////////////
25 // These are forwarded to the N canvases we're referencing
26
fmalita77650002016-01-21 18:47:11 -080027#ifdef SK_SUPPORT_LEGACY_DRAWFLTER
mtklein36352bf2015-03-25 18:17:31 -070028 SkDrawFilter* setDrawFilter(SkDrawFilter*) override;
fmalita77650002016-01-21 18:47:11 -080029#endif
vandebo@chromium.org74b46192012-01-28 01:45:11 +000030
djsollen@google.com339e79f2013-09-04 17:16:00 +000031protected:
reed@android.com6c924ad2009-03-31 03:48:49 +000032 SkTDArray<SkCanvas*> fList;
vandebo@chromium.org74b46192012-01-28 01:45:11 +000033
mtklein36352bf2015-03-25 18:17:31 -070034 void willSave() override;
reed4960eee2015-12-18 07:09:18 -080035 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
mtklein36352bf2015-03-25 18:17:31 -070036 void willRestore() override;
commit-bot@chromium.orge54a23f2014-03-12 20:21:48 +000037
mtklein36352bf2015-03-25 18:17:31 -070038 void didConcat(const SkMatrix&) override;
39 void didSetMatrix(const SkMatrix&) override;
commit-bot@chromium.org44c48d02014-03-13 20:03:58 +000040
mtklein36352bf2015-03-25 18:17:31 -070041 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
reed@google.come0d9ce82014-04-23 04:00:17 +000042 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
mtklein36352bf2015-03-25 18:17:31 -070043 const SkPaint&) override;
reed@google.come0d9ce82014-04-23 04:00:17 +000044 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
mtklein36352bf2015-03-25 18:17:31 -070045 const SkPaint&) override;
reed@google.come0d9ce82014-04-23 04:00:17 +000046 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
mtklein36352bf2015-03-25 18:17:31 -070047 SkScalar constY, const SkPaint&) override;
reed@google.come0d9ce82014-04-23 04:00:17 +000048 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
mtklein36352bf2015-03-25 18:17:31 -070049 const SkMatrix* matrix, const SkPaint&) override;
fmalitab7425172014-08-26 07:56:44 -070050 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
mtklein36352bf2015-03-25 18:17:31 -070051 const SkPaint& paint) override;
dandovb3c9d1c2014-08-12 08:34:29 -070052 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
53 const SkPoint texCoords[4], SkXfermode* xmode,
mtklein36352bf2015-03-25 18:17:31 -070054 const SkPaint& paint) override;
piotaixrb7bac3d2014-09-29 08:56:19 -070055
mtklein36352bf2015-03-25 18:17:31 -070056 void onDrawPaint(const SkPaint&) override;
57 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
58 void onDrawRect(const SkRect&, const SkPaint&) override;
59 void onDrawOval(const SkRect&, const SkPaint&) override;
60 void onDrawRRect(const SkRRect&, const SkPaint&) override;
61 void onDrawPath(const SkPath&, const SkPaint&) override;
62 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
reed41af9662015-01-05 07:49:08 -080063 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
reed562fe472015-07-28 07:35:14 -070064 SrcRectConstraint) override;
mtklein36352bf2015-03-25 18:17:31 -070065 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
reed41af9662015-01-05 07:49:08 -080066 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
reed562fe472015-07-28 07:35:14 -070067 const SkPaint*, SrcRectConstraint) override;
reed41af9662015-01-05 07:49:08 -080068 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
mtklein36352bf2015-03-25 18:17:31 -070069 const SkPaint*) override;
reed41af9662015-01-05 07:49:08 -080070 void onDrawVertices(VertexMode vmode, int vertexCount,
71 const SkPoint vertices[], const SkPoint texs[],
72 const SkColor colors[], SkXfermode* xmode,
73 const uint16_t indices[], int indexCount,
mtklein36352bf2015-03-25 18:17:31 -070074 const SkPaint&) override;
reed41af9662015-01-05 07:49:08 -080075
mtklein36352bf2015-03-25 18:17:31 -070076 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
77 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
78 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
79 void onClipRegion(const SkRegion&, SkRegion::Op) override;
robertphillips@google.com8f90a892014-02-28 18:19:39 +000080
mtklein36352bf2015-03-25 18:17:31 -070081 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
robertphillips9b14f262014-06-04 05:40:44 -070082
reed@android.com6c924ad2009-03-31 03:48:49 +000083 class Iter;
84
djsollen@google.com339e79f2013-09-04 17:16:00 +000085private:
reed@android.com6c924ad2009-03-31 03:48:49 +000086 typedef SkCanvas INHERITED;
87};
88
89
90#endif