epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
Mike Reed | 148b7fd | 2018-12-18 17:38:18 -0500 | [diff] [blame] | 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/utils/SkNWayCanvas.h" |
| 9 | #include "src/core/SkCanvasPriv.h" |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 10 | |
Florin Malita | 439ace9 | 2016-12-02 12:05:41 -0500 | [diff] [blame] | 11 | SkNWayCanvas::SkNWayCanvas(int width, int height) : INHERITED(width, height) {} |
reed@google.com | 6ae24e0 | 2012-09-26 13:44:13 +0000 | [diff] [blame] | 12 | |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 13 | SkNWayCanvas::~SkNWayCanvas() { |
| 14 | this->removeAll(); |
| 15 | } |
| 16 | |
| 17 | void SkNWayCanvas::addCanvas(SkCanvas* canvas) { |
| 18 | if (canvas) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 19 | *fList.append() = canvas; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | void SkNWayCanvas::removeCanvas(SkCanvas* canvas) { |
| 24 | int index = fList.find(canvas); |
| 25 | if (index >= 0) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 26 | fList.removeShuffle(index); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | void SkNWayCanvas::removeAll() { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 31 | fList.reset(); |
| 32 | } |
| 33 | |
| 34 | /////////////////////////////////////////////////////////////////////////// |
| 35 | // These are forwarded to the N canvases we're referencing |
| 36 | |
| 37 | class SkNWayCanvas::Iter { |
| 38 | public: |
| 39 | Iter(const SkTDArray<SkCanvas*>& list) : fList(list) { |
| 40 | fIndex = 0; |
| 41 | } |
| 42 | bool next() { |
| 43 | if (fIndex < fList.count()) { |
| 44 | fCanvas = fList[fIndex++]; |
| 45 | return true; |
| 46 | } |
| 47 | return false; |
| 48 | } |
| 49 | SkCanvas* operator->() { return fCanvas; } |
Mike Reed | 148b7fd | 2018-12-18 17:38:18 -0500 | [diff] [blame] | 50 | SkCanvas* get() const { return fCanvas; } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 51 | |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 52 | private: |
| 53 | const SkTDArray<SkCanvas*>& fList; |
| 54 | int fIndex; |
| 55 | SkCanvas* fCanvas; |
| 56 | }; |
| 57 | |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 58 | void SkNWayCanvas::willSave() { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 59 | Iter iter(fList); |
| 60 | while (iter.next()) { |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 61 | iter->save(); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 62 | } |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 63 | |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 64 | this->INHERITED::willSave(); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 65 | } |
| 66 | |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 67 | SkCanvas::SaveLayerStrategy SkNWayCanvas::getSaveLayerStrategy(const SaveLayerRec& rec) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 68 | Iter iter(fList); |
| 69 | while (iter.next()) { |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 70 | iter->saveLayer(rec); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 71 | } |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 72 | |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 73 | this->INHERITED::getSaveLayerStrategy(rec); |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 74 | // No need for a layer. |
| 75 | return kNoLayer_SaveLayerStrategy; |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Mike Reed | 148b7fd | 2018-12-18 17:38:18 -0500 | [diff] [blame] | 78 | bool SkNWayCanvas::onDoSaveBehind(const SkRect* bounds) { |
| 79 | Iter iter(fList); |
| 80 | while (iter.next()) { |
| 81 | SkCanvasPriv::SaveBehind(iter.get(), bounds); |
| 82 | } |
| 83 | this->INHERITED::onDoSaveBehind(bounds); |
| 84 | return false; |
| 85 | } |
| 86 | |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 87 | void SkNWayCanvas::willRestore() { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 88 | Iter iter(fList); |
| 89 | while (iter.next()) { |
| 90 | iter->restore(); |
| 91 | } |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 92 | this->INHERITED::willRestore(); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 93 | } |
| 94 | |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 95 | void SkNWayCanvas::didConcat(const SkMatrix& matrix) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 96 | Iter iter(fList); |
| 97 | while (iter.next()) { |
| 98 | iter->concat(matrix); |
| 99 | } |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 100 | this->INHERITED::didConcat(matrix); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 101 | } |
| 102 | |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 103 | void SkNWayCanvas::didSetMatrix(const SkMatrix& matrix) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 104 | Iter iter(fList); |
| 105 | while (iter.next()) { |
| 106 | iter->setMatrix(matrix); |
| 107 | } |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 108 | this->INHERITED::didSetMatrix(matrix); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 111 | void SkNWayCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 112 | Iter iter(fList); |
| 113 | while (iter.next()) { |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 114 | iter->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 115 | } |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 116 | this->INHERITED::onClipRect(rect, op, edgeStyle); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 117 | } |
| 118 | |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 119 | void SkNWayCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle) { |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 120 | Iter iter(fList); |
| 121 | while (iter.next()) { |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 122 | iter->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 123 | } |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 124 | this->INHERITED::onClipRRect(rrect, op, edgeStyle); |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 125 | } |
| 126 | |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 127 | void SkNWayCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 128 | Iter iter(fList); |
| 129 | while (iter.next()) { |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 130 | iter->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 131 | } |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 132 | this->INHERITED::onClipPath(path, op, edgeStyle); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 133 | } |
| 134 | |
Mike Reed | c1f7774 | 2016-12-09 09:00:50 -0500 | [diff] [blame] | 135 | void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, SkClipOp op) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 136 | Iter iter(fList); |
| 137 | while (iter.next()) { |
| 138 | iter->clipRegion(deviceRgn, op); |
| 139 | } |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 140 | this->INHERITED::onClipRegion(deviceRgn, op); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 141 | } |
| 142 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 143 | void SkNWayCanvas::onDrawPaint(const SkPaint& paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 144 | Iter iter(fList); |
| 145 | while (iter.next()) { |
| 146 | iter->drawPaint(paint); |
| 147 | } |
| 148 | } |
| 149 | |
Mike Reed | d567408 | 2019-04-19 15:00:47 -0400 | [diff] [blame] | 150 | void SkNWayCanvas::onDrawBehind(const SkPaint& paint) { |
| 151 | Iter iter(fList); |
| 152 | while (iter.next()) { |
| 153 | SkCanvasPriv::DrawBehind(iter.get(), paint); |
| 154 | } |
| 155 | } |
| 156 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 157 | void SkNWayCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], |
| 158 | const SkPaint& paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 159 | Iter iter(fList); |
| 160 | while (iter.next()) { |
| 161 | iter->drawPoints(mode, count, pts, paint); |
| 162 | } |
| 163 | } |
| 164 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 165 | void SkNWayCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 166 | Iter iter(fList); |
| 167 | while (iter.next()) { |
| 168 | iter->drawRect(rect, paint); |
| 169 | } |
| 170 | } |
| 171 | |
Brian Osman | 3adc122 | 2018-03-08 14:52:20 -0500 | [diff] [blame] | 172 | void SkNWayCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) { |
| 173 | Iter iter(fList); |
| 174 | while (iter.next()) { |
| 175 | iter->drawRegion(region, paint); |
| 176 | } |
| 177 | } |
| 178 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 179 | void SkNWayCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { |
commit-bot@chromium.org | be65a4c | 2013-11-14 19:02:41 +0000 | [diff] [blame] | 180 | Iter iter(fList); |
| 181 | while (iter.next()) { |
| 182 | iter->drawOval(rect, paint); |
| 183 | } |
| 184 | } |
| 185 | |
bsalomon | ac3aa24 | 2016-08-19 11:25:19 -0700 | [diff] [blame] | 186 | void SkNWayCanvas::onDrawArc(const SkRect& rect, SkScalar startAngle, SkScalar sweepAngle, |
| 187 | bool useCenter, const SkPaint& paint) { |
| 188 | Iter iter(fList); |
| 189 | while (iter.next()) { |
| 190 | iter->drawArc(rect, startAngle, sweepAngle, useCenter, paint); |
| 191 | } |
| 192 | } |
| 193 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 194 | void SkNWayCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 195 | Iter iter(fList); |
| 196 | while (iter.next()) { |
| 197 | iter->drawRRect(rrect, paint); |
| 198 | } |
| 199 | } |
| 200 | |
reed | a5517e2 | 2015-07-14 10:54:12 -0700 | [diff] [blame] | 201 | void SkNWayCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) { |
commit-bot@chromium.org | ab58273 | 2014-02-21 12:20:45 +0000 | [diff] [blame] | 202 | Iter iter(fList); |
| 203 | while (iter.next()) { |
| 204 | iter->drawDRRect(outer, inner, paint); |
| 205 | } |
| 206 | } |
| 207 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 208 | void SkNWayCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 209 | Iter iter(fList); |
| 210 | while (iter.next()) { |
| 211 | iter->drawPath(path, paint); |
| 212 | } |
| 213 | } |
| 214 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 215 | void SkNWayCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, |
| 216 | const SkPaint* paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 217 | Iter iter(fList); |
| 218 | while (iter.next()) { |
| 219 | iter->drawBitmap(bitmap, x, y, paint); |
| 220 | } |
| 221 | } |
| 222 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 223 | void SkNWayCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 224 | const SkPaint* paint, SrcRectConstraint constraint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 225 | Iter iter(fList); |
| 226 | while (iter.next()) { |
reed | e47829b | 2015-08-06 10:02:53 -0700 | [diff] [blame] | 227 | iter->legacy_drawBitmapRect(bitmap, src, dst, paint, (SrcRectConstraint)constraint); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 228 | } |
| 229 | } |
| 230 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 231 | void SkNWayCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
| 232 | const SkRect& dst, const SkPaint* paint) { |
commit-bot@chromium.org | be65a4c | 2013-11-14 19:02:41 +0000 | [diff] [blame] | 233 | Iter iter(fList); |
| 234 | while (iter.next()) { |
| 235 | iter->drawBitmapNine(bitmap, center, dst, paint); |
| 236 | } |
| 237 | } |
| 238 | |
Brian Osman | 3adc122 | 2018-03-08 14:52:20 -0500 | [diff] [blame] | 239 | void SkNWayCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, |
| 240 | const SkRect& dst, const SkPaint* paint) { |
| 241 | Iter iter(fList); |
| 242 | while (iter.next()) { |
| 243 | iter->drawBitmapLattice(bitmap, lattice, dst, paint); |
| 244 | } |
| 245 | } |
| 246 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 247 | void SkNWayCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, |
| 248 | const SkPaint* paint) { |
piotaixr | b7bac3d | 2014-09-29 08:56:19 -0700 | [diff] [blame] | 249 | Iter iter(fList); |
| 250 | while (iter.next()) { |
| 251 | iter->drawImage(image, left, top, paint); |
| 252 | } |
| 253 | } |
| 254 | |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 255 | void SkNWayCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 256 | const SkPaint* paint, SrcRectConstraint constraint) { |
piotaixr | b7bac3d | 2014-09-29 08:56:19 -0700 | [diff] [blame] | 257 | Iter iter(fList); |
| 258 | while (iter.next()) { |
reed | e47829b | 2015-08-06 10:02:53 -0700 | [diff] [blame] | 259 | iter->legacy_drawImageRect(image, src, dst, paint, constraint); |
piotaixr | b7bac3d | 2014-09-29 08:56:19 -0700 | [diff] [blame] | 260 | } |
| 261 | } |
| 262 | |
Brian Osman | 3adc122 | 2018-03-08 14:52:20 -0500 | [diff] [blame] | 263 | void SkNWayCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst, |
| 264 | const SkPaint* paint) { |
| 265 | Iter iter(fList); |
| 266 | while (iter.next()) { |
| 267 | iter->drawImageNine(image, center, dst, paint); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | void SkNWayCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice, |
| 272 | const SkRect& dst, const SkPaint* paint) { |
| 273 | Iter iter(fList); |
| 274 | while (iter.next()) { |
| 275 | iter->drawImageLattice(image, lattice, dst, paint); |
| 276 | } |
| 277 | } |
| 278 | |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 279 | void SkNWayCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 280 | const SkPaint &paint) { |
| 281 | Iter iter(fList); |
| 282 | while (iter.next()) { |
| 283 | iter->drawTextBlob(blob, x, y, paint); |
| 284 | } |
| 285 | } |
| 286 | |
reed | d5fa1a4 | 2014-08-09 11:08:05 -0700 | [diff] [blame] | 287 | void SkNWayCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, |
| 288 | const SkPaint* paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 289 | Iter iter(fList); |
| 290 | while (iter.next()) { |
reed | d5fa1a4 | 2014-08-09 11:08:05 -0700 | [diff] [blame] | 291 | iter->drawPicture(picture, matrix, paint); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 292 | } |
| 293 | } |
| 294 | |
Florin Malita | adaeaed | 2017-09-21 15:28:29 -0400 | [diff] [blame] | 295 | void SkNWayCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) { |
| 296 | Iter iter(fList); |
| 297 | while (iter.next()) { |
| 298 | iter->drawDrawable(drawable, matrix); |
| 299 | } |
| 300 | } |
| 301 | |
Ruiqi Mao | c97a339 | 2018-08-15 10:44:19 -0400 | [diff] [blame] | 302 | void SkNWayCanvas::onDrawVerticesObject(const SkVertices* vertices, const SkVertices::Bone bones[], |
Ruiqi Mao | f510149 | 2018-06-29 14:32:21 -0400 | [diff] [blame] | 303 | int boneCount, SkBlendMode bmode, const SkPaint& paint) { |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 304 | Iter iter(fList); |
| 305 | while (iter.next()) { |
Ruiqi Mao | f510149 | 2018-06-29 14:32:21 -0400 | [diff] [blame] | 306 | iter->drawVertices(vertices, bones, boneCount, bmode, paint); |
reed@android.com | 6c924ad | 2009-03-31 03:48:49 +0000 | [diff] [blame] | 307 | } |
| 308 | } |
| 309 | |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 310 | void SkNWayCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
Mike Reed | faba371 | 2016-11-03 14:45:31 -0400 | [diff] [blame] | 311 | const SkPoint texCoords[4], SkBlendMode bmode, |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 312 | const SkPaint& paint) { |
dandov | 963137b | 2014-08-07 07:49:53 -0700 | [diff] [blame] | 313 | Iter iter(fList); |
| 314 | while (iter.next()) { |
Mike Reed | faba371 | 2016-11-03 14:45:31 -0400 | [diff] [blame] | 315 | iter->drawPatch(cubics, colors, texCoords, bmode, paint); |
dandov | 963137b | 2014-08-07 07:49:53 -0700 | [diff] [blame] | 316 | } |
| 317 | } |
| 318 | |
Brian Osman | 3adc122 | 2018-03-08 14:52:20 -0500 | [diff] [blame] | 319 | void SkNWayCanvas::onDrawAtlas(const SkImage* image, const SkRSXform xform[], const SkRect tex[], |
| 320 | const SkColor colors[], int count, SkBlendMode bmode, |
| 321 | const SkRect* cull, const SkPaint* paint) { |
| 322 | Iter iter(fList); |
| 323 | while (iter.next()) { |
| 324 | iter->drawAtlas(image, xform, tex, colors, count, bmode, cull, paint); |
| 325 | } |
| 326 | } |
| 327 | |
Mike Reed | 4204da2 | 2017-05-17 08:53:36 -0400 | [diff] [blame] | 328 | void SkNWayCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) { |
| 329 | Iter iter(fList); |
| 330 | while (iter.next()) { |
| 331 | iter->private_draw_shadow_rec(path, rec); |
| 332 | } |
| 333 | } |
| 334 | |
reed | f70b531 | 2016-03-04 16:36:20 -0800 | [diff] [blame] | 335 | void SkNWayCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData* data) { |
| 336 | Iter iter(fList); |
| 337 | while (iter.next()) { |
| 338 | iter->drawAnnotation(rect, key, data); |
| 339 | } |
| 340 | } |
| 341 | |
Michael Ludwig | 390f0cc | 2019-03-19 09:16:38 -0400 | [diff] [blame] | 342 | void SkNWayCanvas::onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], |
Michael Ludwig | a595f86 | 2019-08-27 15:25:49 -0400 | [diff] [blame^] | 343 | QuadAAFlags aa, const SkColor4f& color, SkBlendMode mode) { |
Michael Ludwig | 390f0cc | 2019-03-19 09:16:38 -0400 | [diff] [blame] | 344 | Iter iter(fList); |
| 345 | while (iter.next()) { |
| 346 | iter->experimental_DrawEdgeAAQuad(rect, clip, aa, color, mode); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | void SkNWayCanvas::onDrawEdgeAAImageSet(const ImageSetEntry set[], int count, |
| 351 | const SkPoint dstClips[], const SkMatrix preViewMatrices[], |
| 352 | const SkPaint* paint, SrcRectConstraint constraint) { |
| 353 | Iter iter(fList); |
| 354 | while (iter.next()) { |
| 355 | iter->experimental_DrawEdgeAAImageSet( |
| 356 | set, count, dstClips, preViewMatrices, paint, constraint); |
| 357 | } |
| 358 | } |
| 359 | |
Florin Malita | 1ba5b6b | 2017-10-12 11:08:46 -0400 | [diff] [blame] | 360 | void SkNWayCanvas::onFlush() { |
| 361 | Iter iter(fList); |
| 362 | while (iter.next()) { |
| 363 | iter->flush(); |
| 364 | } |
| 365 | } |