reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 1 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 9 | #ifndef SkNWayCanvas_DEFINED |
| 10 | #define SkNWayCanvas_DEFINED |
| 11 | |
| 12 | #include "SkCanvas.h" |
bungeman | d3ebb48 | 2015-08-05 13:57:49 -0700 | [diff] [blame] | 13 | #include "SkTDArray.h" |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 14 | |
commit-bot@chromium.org | e1a81d2 | 2013-07-15 22:49:37 +0000 | [diff] [blame] | 15 | class SK_API SkNWayCanvas : public SkCanvas { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 16 | public: |
djsollen@google.com | f0a062b | 2012-05-01 16:50:25 +0000 | [diff] [blame] | 17 | SkNWayCanvas(int width, int height); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 18 | virtual ~SkNWayCanvas(); |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 19 | |
djsollen@google.com | 339e79f | 2013-09-04 17:16:00 +0000 | [diff] [blame] | 20 | virtual void addCanvas(SkCanvas*); |
| 21 | virtual void removeCanvas(SkCanvas*); |
| 22 | virtual void removeAll(); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 23 | |
| 24 | /////////////////////////////////////////////////////////////////////////// |
| 25 | // These are forwarded to the N canvases we're referencing |
| 26 | |
fmalita | 7765000 | 2016-01-21 18:47:11 -0800 | [diff] [blame^] | 27 | #ifdef SK_SUPPORT_LEGACY_DRAWFLTER |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 28 | SkDrawFilter* setDrawFilter(SkDrawFilter*) override; |
fmalita | 7765000 | 2016-01-21 18:47:11 -0800 | [diff] [blame^] | 29 | #endif |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 30 | |
djsollen@google.com | 339e79f | 2013-09-04 17:16:00 +0000 | [diff] [blame] | 31 | protected: |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 32 | SkTDArray<SkCanvas*> fList; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 33 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 34 | void willSave() override; |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 35 | SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 36 | void willRestore() override; |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 37 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 38 | void didConcat(const SkMatrix&) override; |
| 39 | void didSetMatrix(const SkMatrix&) override; |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 40 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 41 | void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 42 | virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 43 | const SkPaint&) override; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 44 | virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 45 | const SkPaint&) override; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 46 | virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 47 | SkScalar constY, const SkPaint&) override; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 48 | virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 49 | const SkMatrix* matrix, const SkPaint&) override; |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 50 | virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 51 | const SkPaint& paint) override; |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 52 | virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 53 | const SkPoint texCoords[4], SkXfermode* xmode, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 54 | const SkPaint& paint) override; |
piotaixr | b7bac3d | 2014-09-29 08:56:19 -0700 | [diff] [blame] | 55 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 56 | 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; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 63 | void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 64 | SrcRectConstraint) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 65 | void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 66 | void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 67 | const SkPaint*, SrcRectConstraint) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 68 | void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 69 | const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 70 | 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, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 74 | const SkPaint&) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 75 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 76 | 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.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 80 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 81 | void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 82 | |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 83 | class Iter; |
| 84 | |
djsollen@google.com | 339e79f | 2013-09-04 17:16:00 +0000 | [diff] [blame] | 85 | private: |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 86 | typedef SkCanvas INHERITED; |
| 87 | }; |
| 88 | |
| 89 | |
| 90 | #endif |