blob: a9d9ba9d14ea7d072e183879131ce68cf57816d4 [file] [log] [blame]
commit-bot@chromium.orgc4b21e62014-04-11 18:33:31 +00001/*
2 * Copyright 2014 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 */
7
mtklein9db912c2015-05-19 11:11:26 -07008#include "SkBigPicture.h"
mtkleind711d112015-07-01 07:04:37 -07009#include "SkCanvasPriv.h"
dandovb3c9d1c2014-08-12 08:34:29 -070010#include "SkPatchUtils.h"
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000011#include "SkPicture.h"
mtklein98b84852015-04-21 15:23:59 -070012#include "SkPictureUtils.h"
13#include "SkRecorder.h"
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000014
reed3cb38402015-02-06 08:36:15 -080015SkDrawableList::~SkDrawableList() {
reed1bdfd3f2014-11-24 14:41:51 -080016 fArray.unrefAll();
17}
18
mtklein9db912c2015-05-19 11:11:26 -070019SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
reed1bdfd3f2014-11-24 14:41:51 -080020 const int count = fArray.count();
21 if (0 == count) {
22 return NULL;
23 }
24 SkAutoTMalloc<const SkPicture*> pics(count);
25 for (int i = 0; i < count; ++i) {
26 pics[i] = fArray[i]->newPictureSnapshot();
27 }
mtklein9db912c2015-05-19 11:11:26 -070028 return SkNEW_ARGS(SkBigPicture::SnapshotArray, (pics.detach(), count));
reed1bdfd3f2014-11-24 14:41:51 -080029}
30
reed3cb38402015-02-06 08:36:15 -080031void SkDrawableList::append(SkDrawable* drawable) {
reed1bdfd3f2014-11-24 14:41:51 -080032 *fArray.append() = SkRef(drawable);
33}
34
35///////////////////////////////////////////////////////////////////////////////////////////////
36
mtklein9db912c2015-05-19 11:11:26 -070037SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder* mr)
reed78e27682014-11-19 08:04:34 -080038 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag)
mtkleind711d112015-07-01 07:04:37 -070039 , fDrawPictureMode(Record_DrawPictureMode)
mtklein98b84852015-04-21 15:23:59 -070040 , fApproxBytesUsedBySubPictures(0)
mtklein9db912c2015-05-19 11:11:26 -070041 , fRecord(record)
42 , fMiniRecorder(mr) {}
reed78e27682014-11-19 08:04:34 -080043
mtklein9db912c2015-05-19 11:11:26 -070044SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr)
reed78e27682014-11-19 08:04:34 -080045 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
mtkleind711d112015-07-01 07:04:37 -070046 , fDrawPictureMode(Record_DrawPictureMode)
mtklein98b84852015-04-21 15:23:59 -070047 , fApproxBytesUsedBySubPictures(0)
mtklein9db912c2015-05-19 11:11:26 -070048 , fRecord(record)
49 , fMiniRecorder(mr) {}
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000050
mtkleind711d112015-07-01 07:04:37 -070051void SkRecorder::reset(SkRecord* record, const SkRect& bounds,
52 DrawPictureMode dpm, SkMiniRecorder* mr) {
mtkleinfeaadee2015-04-08 11:25:48 -070053 this->forgetRecord();
mtkleind711d112015-07-01 07:04:37 -070054 fDrawPictureMode = dpm;
mtkleinfeaadee2015-04-08 11:25:48 -070055 fRecord = record;
56 this->resetForNextPicture(bounds.roundOut());
mtklein9db912c2015-05-19 11:11:26 -070057 fMiniRecorder = mr;
mtkleinfeaadee2015-04-08 11:25:48 -070058}
59
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000060void SkRecorder::forgetRecord() {
reed1bdfd3f2014-11-24 14:41:51 -080061 fDrawableList.reset(NULL);
mtklein98b84852015-04-21 15:23:59 -070062 fApproxBytesUsedBySubPictures = 0;
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000063 fRecord = NULL;
64}
65
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000066// To make appending to fRecord a little less verbose.
mtklein9db912c2015-05-19 11:11:26 -070067#define APPEND(T, ...) \
68 if (fMiniRecorder) { this->flushMiniRecorder(); } \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000069 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__VA_ARGS__))
70
mtklein9db912c2015-05-19 11:11:26 -070071#define TRY_MINIRECORDER(method, ...) \
72 if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
73
commit-bot@chromium.orga0950412014-05-29 16:52:40 +000074// For methods which must call back into SkCanvas.
75#define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +000076
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000077// Use copy() only for optional arguments, to be copied if present or skipped if not.
78// (For most types we just pass by value and let copy constructors do their thing.)
79template <typename T>
80T* SkRecorder::copy(const T* src) {
81 if (NULL == src) {
82 return NULL;
83 }
84 return SkNEW_PLACEMENT_ARGS(fRecord->alloc<T>(), T, (*src));
85}
86
87// This copy() is for arrays.
88// It will work with POD or non-POD, though currently we only use it for POD.
89template <typename T>
reed2347b622014-08-07 12:19:50 -070090T* SkRecorder::copy(const T src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000091 if (NULL == src) {
92 return NULL;
93 }
94 T* dst = fRecord->alloc<T>(count);
reed2347b622014-08-07 12:19:50 -070095 for (size_t i = 0; i < count; i++) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000096 SkNEW_PLACEMENT_ARGS(dst + i, T, (src[i]));
97 }
98 return dst;
99}
100
101// Specialization for copying strings, using memcpy.
102// This measured around 2x faster for copying code points,
103// but I found no corresponding speedup for other arrays.
104template <>
reed2347b622014-08-07 12:19:50 -0700105char* SkRecorder::copy(const char src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000106 if (NULL == src) {
107 return NULL;
108 }
109 char* dst = fRecord->alloc<char>(count);
110 memcpy(dst, src, count);
111 return dst;
112}
113
mtklein5f0e8222014-08-22 11:44:26 -0700114// As above, assuming and copying a terminating \0.
115template <>
116char* SkRecorder::copy(const char* src) {
117 return this->copy(src, strlen(src)+1);
118}
119
mtklein9db912c2015-05-19 11:11:26 -0700120void SkRecorder::flushMiniRecorder() {
121 if (fMiniRecorder) {
122 SkMiniRecorder* mr = fMiniRecorder;
mtkleind41ea1d2015-05-20 10:16:49 -0700123 fMiniRecorder = nullptr; // Needs to happen before flushAndReset() or we recurse forever.
124 mr->flushAndReset(this);
mtklein9db912c2015-05-19 11:11:26 -0700125 }
126}
mtklein5f0e8222014-08-22 11:44:26 -0700127
reed41af9662015-01-05 07:49:08 -0800128void SkRecorder::onDrawPaint(const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700129 APPEND(DrawPaint, paint);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000130}
131
reed41af9662015-01-05 07:49:08 -0800132void SkRecorder::onDrawPoints(PointMode mode,
133 size_t count,
134 const SkPoint pts[],
135 const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700136 APPEND(DrawPoints, paint, mode, SkToUInt(count), this->copy(pts, count));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000137}
138
reed41af9662015-01-05 07:49:08 -0800139void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700140 TRY_MINIRECORDER(drawRect, rect, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700141 APPEND(DrawRect, paint, rect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000142}
143
reed41af9662015-01-05 07:49:08 -0800144void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700145 APPEND(DrawOval, paint, oval);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000146}
147
reed41af9662015-01-05 07:49:08 -0800148void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700149 APPEND(DrawRRect, paint, rrect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000150}
151
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000152void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700153 APPEND(DrawDRRect, paint, outer, inner);
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000154}
155
reed3cb38402015-02-06 08:36:15 -0800156void SkRecorder::onDrawDrawable(SkDrawable* drawable) {
reed1bdfd3f2014-11-24 14:41:51 -0800157 if (!fDrawableList) {
reed3cb38402015-02-06 08:36:15 -0800158 fDrawableList.reset(SkNEW(SkDrawableList));
reed1bdfd3f2014-11-24 14:41:51 -0800159 }
160 fDrawableList->append(drawable);
161 APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
reed6be2aa92014-11-18 11:08:05 -0800162}
163
reed41af9662015-01-05 07:49:08 -0800164void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700165 TRY_MINIRECORDER(drawPath, path, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700166 APPEND(DrawPath, paint, path);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000167}
168
reed41af9662015-01-05 07:49:08 -0800169void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
170 SkScalar left,
171 SkScalar top,
172 const SkPaint* paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700173 APPEND(DrawBitmap, this->copy(paint), bitmap, left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000174}
175
reed41af9662015-01-05 07:49:08 -0800176void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
177 const SkRect* src,
178 const SkRect& dst,
179 const SkPaint* paint,
180 DrawBitmapRectFlags flags) {
mtklein42ddcd42014-11-21 08:48:35 -0800181 if (kBleed_DrawBitmapRectFlag == flags) {
182 APPEND(DrawBitmapRectToRectBleed,
mtkleinc845fa02015-06-30 09:49:49 -0700183 this->copy(paint), bitmap, this->copy(src), dst);
mtklein42ddcd42014-11-21 08:48:35 -0800184 return;
185 }
186 SkASSERT(kNone_DrawBitmapRectFlag == flags);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000187 APPEND(DrawBitmapRectToRect,
mtkleinc845fa02015-06-30 09:49:49 -0700188 this->copy(paint), bitmap, this->copy(src), dst);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000189}
190
reed41af9662015-01-05 07:49:08 -0800191void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
192 const SkIRect& center,
193 const SkRect& dst,
194 const SkPaint* paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700195 APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000196}
197
reed41af9662015-01-05 07:49:08 -0800198void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
199 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700200 APPEND(DrawImage, this->copy(paint), image, left, top);
201}
202
reed41af9662015-01-05 07:49:08 -0800203void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src,
204 const SkRect& dst,
205 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700206 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst);
207}
208
reed4c21dc52015-06-25 12:32:03 -0700209void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center,
210 const SkRect& dst, const SkPaint* paint) {
211 APPEND(DrawImageNine, this->copy(paint), image, center, dst);
212}
213
reed41af9662015-01-05 07:49:08 -0800214void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700215 APPEND(DrawSprite, this->copy(paint), bitmap, left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000216}
217
reed@google.come0d9ce82014-04-23 04:00:17 +0000218void SkRecorder::onDrawText(const void* text, size_t byteLength,
219 SkScalar x, SkScalar y, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000220 APPEND(DrawText,
mtkleinc845fa02015-06-30 09:49:49 -0700221 paint, this->copy((const char*)text, byteLength), byteLength, x, y);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000222}
223
reed@google.come0d9ce82014-04-23 04:00:17 +0000224void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
225 const SkPoint pos[], const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000226 const unsigned points = paint.countText(text, byteLength);
227 APPEND(DrawPosText,
mtkleinc845fa02015-06-30 09:49:49 -0700228 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000229 this->copy((const char*)text, byteLength),
230 byteLength,
231 this->copy(pos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000232}
233
reed@google.come0d9ce82014-04-23 04:00:17 +0000234void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
235 const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000236 const unsigned points = paint.countText(text, byteLength);
237 APPEND(DrawPosTextH,
mtkleinc845fa02015-06-30 09:49:49 -0700238 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000239 this->copy((const char*)text, byteLength),
mtklein42ddcd42014-11-21 08:48:35 -0800240 SkToUInt(byteLength),
241 constY,
242 this->copy(xpos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000243}
244
reed@google.come0d9ce82014-04-23 04:00:17 +0000245void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
246 const SkMatrix* matrix, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000247 APPEND(DrawTextOnPath,
mtkleinc845fa02015-06-30 09:49:49 -0700248 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000249 this->copy((const char*)text, byteLength),
250 byteLength,
mtkleinc845fa02015-06-30 09:49:49 -0700251 path,
mtkleinaf579032014-12-01 11:03:37 -0800252 matrix ? *matrix : SkMatrix::I());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000253}
254
fmalita00d5c2c2014-08-21 08:53:26 -0700255void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
256 const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700257 TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700258 APPEND(DrawTextBlob, paint, blob, x, y);
fmalita00d5c2c2014-08-21 08:53:26 -0700259}
260
reedd5fa1a42014-08-09 11:08:05 -0700261void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
mtkleind711d112015-07-01 07:04:37 -0700262 if (fDrawPictureMode == Record_DrawPictureMode) {
263 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pic);
264 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
265 } else {
266 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode);
267 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect());
268 pic->playback(this);
269 }
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000270}
271
reed41af9662015-01-05 07:49:08 -0800272void SkRecorder::onDrawVertices(VertexMode vmode,
273 int vertexCount, const SkPoint vertices[],
274 const SkPoint texs[], const SkColor colors[],
275 SkXfermode* xmode,
276 const uint16_t indices[], int indexCount, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700277 APPEND(DrawVertices, paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000278 vmode,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000279 vertexCount,
280 this->copy(vertices, vertexCount),
281 texs ? this->copy(texs, vertexCount) : NULL,
282 colors ? this->copy(colors, vertexCount) : NULL,
283 xmode,
284 this->copy(indices, indexCount),
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000285 indexCount);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000286}
287
dandovb3c9d1c2014-08-12 08:34:29 -0700288void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
289 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700290 APPEND(DrawPatch, paint,
dandovb3c9d1c2014-08-12 08:34:29 -0700291 cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
292 colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
293 texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
294 xmode);
dandov963137b2014-08-07 07:49:53 -0700295}
296
reed71c3c762015-06-24 10:29:17 -0700297void SkRecorder::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
298 const SkColor colors[], int count, SkXfermode::Mode mode,
299 const SkRect* cull, const SkPaint* paint) {
300 APPEND(DrawAtlas, this->copy(paint),
301 atlas,
302 this->copy(xform, count),
303 this->copy(tex, count),
304 this->copy(colors, count),
305 count,
306 mode,
307 this->copy(cull));
308}
309
Florin Malita5f6102d2014-06-30 10:13:28 -0400310void SkRecorder::willSave() {
311 APPEND(Save);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000312}
313
314SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
315 const SkPaint* paint,
316 SkCanvas::SaveFlags flags) {
317 APPEND(SaveLayer, this->copy(bounds), this->copy(paint), flags);
318 return SkCanvas::kNoLayer_SaveLayerStrategy;
319}
320
mtklein6cfa73a2014-08-13 13:33:49 -0700321void SkRecorder::didRestore() {
mtkleina723b572014-08-15 11:49:49 -0700322 APPEND(Restore, this->devBounds(), this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000323}
324
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000325void SkRecorder::didConcat(const SkMatrix& matrix) {
mtklein6332f1d2014-08-19 07:09:40 -0700326 this->didSetMatrix(this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000327}
328
329void SkRecorder::didSetMatrix(const SkMatrix& matrix) {
mtklein46bc6212014-08-20 09:44:28 -0700330 SkDEVCODE(if (matrix != this->getTotalMatrix()) {
mtkleinec924b92014-08-20 09:22:28 -0700331 matrix.dump();
332 this->getTotalMatrix().dump();
333 SkASSERT(matrix == this->getTotalMatrix());
334 })
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000335 APPEND(SetMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000336}
337
338void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000339 INHERITED(onClipRect, rect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800340 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
341 APPEND(ClipRect, this->devBounds(), rect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000342}
343
344void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700345 INHERITED(onClipRRect, rrect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800346 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
347 APPEND(ClipRRect, this->devBounds(), rrect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000348}
349
350void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700351 INHERITED(onClipPath, path, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800352 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
mtkleinc845fa02015-06-30 09:49:49 -0700353 APPEND(ClipPath, this->devBounds(), path, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000354}
355
356void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000357 INHERITED(onClipRegion, deviceRgn, op);
mtkleinc845fa02015-06-30 09:49:49 -0700358 APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000359}
mtklein5f0e8222014-08-22 11:44:26 -0700360