blob: c27405575c57c635c897a69d095089d371c683e3 [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"
dandovb3c9d1c2014-08-12 08:34:29 -07009#include "SkPatchUtils.h"
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000010#include "SkPicture.h"
mtklein98b84852015-04-21 15:23:59 -070011#include "SkPictureUtils.h"
12#include "SkRecorder.h"
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000013
reed3cb38402015-02-06 08:36:15 -080014SkDrawableList::~SkDrawableList() {
reed1bdfd3f2014-11-24 14:41:51 -080015 fArray.unrefAll();
16}
17
mtklein9db912c2015-05-19 11:11:26 -070018SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
reed1bdfd3f2014-11-24 14:41:51 -080019 const int count = fArray.count();
20 if (0 == count) {
21 return NULL;
22 }
23 SkAutoTMalloc<const SkPicture*> pics(count);
24 for (int i = 0; i < count; ++i) {
25 pics[i] = fArray[i]->newPictureSnapshot();
26 }
mtklein9db912c2015-05-19 11:11:26 -070027 return SkNEW_ARGS(SkBigPicture::SnapshotArray, (pics.detach(), count));
reed1bdfd3f2014-11-24 14:41:51 -080028}
29
reed3cb38402015-02-06 08:36:15 -080030void SkDrawableList::append(SkDrawable* drawable) {
reed1bdfd3f2014-11-24 14:41:51 -080031 *fArray.append() = SkRef(drawable);
32}
33
34///////////////////////////////////////////////////////////////////////////////////////////////
35
mtklein9db912c2015-05-19 11:11:26 -070036SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder* mr)
reed78e27682014-11-19 08:04:34 -080037 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag)
mtklein98b84852015-04-21 15:23:59 -070038 , fApproxBytesUsedBySubPictures(0)
mtklein9db912c2015-05-19 11:11:26 -070039 , fRecord(record)
40 , fMiniRecorder(mr) {}
reed78e27682014-11-19 08:04:34 -080041
mtklein9db912c2015-05-19 11:11:26 -070042SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr)
reed78e27682014-11-19 08:04:34 -080043 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
mtklein98b84852015-04-21 15:23:59 -070044 , fApproxBytesUsedBySubPictures(0)
mtklein9db912c2015-05-19 11:11:26 -070045 , fRecord(record)
46 , fMiniRecorder(mr) {}
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000047
mtklein9db912c2015-05-19 11:11:26 -070048void SkRecorder::reset(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr) {
mtkleinfeaadee2015-04-08 11:25:48 -070049 this->forgetRecord();
50 fRecord = record;
51 this->resetForNextPicture(bounds.roundOut());
mtklein9db912c2015-05-19 11:11:26 -070052 fMiniRecorder = mr;
mtkleinfeaadee2015-04-08 11:25:48 -070053}
54
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000055void SkRecorder::forgetRecord() {
reed1bdfd3f2014-11-24 14:41:51 -080056 fDrawableList.reset(NULL);
mtklein98b84852015-04-21 15:23:59 -070057 fApproxBytesUsedBySubPictures = 0;
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000058 fRecord = NULL;
59}
60
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000061// To make appending to fRecord a little less verbose.
mtklein9db912c2015-05-19 11:11:26 -070062#define APPEND(T, ...) \
63 if (fMiniRecorder) { this->flushMiniRecorder(); } \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000064 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__VA_ARGS__))
65
mtklein9db912c2015-05-19 11:11:26 -070066#define TRY_MINIRECORDER(method, ...) \
67 if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
68
commit-bot@chromium.orga0950412014-05-29 16:52:40 +000069// For methods which must call back into SkCanvas.
70#define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +000071
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000072// The structs we're creating all copy their constructor arguments. Given the way the SkRecords
73// framework works, sometimes they happen to technically be copied twice, which is fine and elided
74// into a single copy unless the class has a non-trivial copy constructor. For classes with
75// non-trivial copy constructors, we skip the first copy (and its destruction) by wrapping the value
76// with delay_copy(), forcing the argument to be passed by const&.
77//
78// This is used below for SkBitmap, SkPaint, SkPath, and SkRegion, which all have non-trivial copy
79// constructors and destructors. You'll know you've got a good candidate T if you see ~T() show up
80// unexpectedly on a profile of record time. Otherwise don't bother.
81template <typename T>
82class Reference {
83public:
84 Reference(const T& x) : fX(x) {}
85 operator const T&() const { return fX; }
86private:
87 const T& fX;
88};
89
90template <typename T>
91static Reference<T> delay_copy(const T& x) { return Reference<T>(x); }
92
93// Use copy() only for optional arguments, to be copied if present or skipped if not.
94// (For most types we just pass by value and let copy constructors do their thing.)
95template <typename T>
96T* SkRecorder::copy(const T* src) {
97 if (NULL == src) {
98 return NULL;
99 }
100 return SkNEW_PLACEMENT_ARGS(fRecord->alloc<T>(), T, (*src));
101}
102
103// This copy() is for arrays.
104// It will work with POD or non-POD, though currently we only use it for POD.
105template <typename T>
reed2347b622014-08-07 12:19:50 -0700106T* SkRecorder::copy(const T src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000107 if (NULL == src) {
108 return NULL;
109 }
110 T* dst = fRecord->alloc<T>(count);
reed2347b622014-08-07 12:19:50 -0700111 for (size_t i = 0; i < count; i++) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000112 SkNEW_PLACEMENT_ARGS(dst + i, T, (src[i]));
113 }
114 return dst;
115}
116
117// Specialization for copying strings, using memcpy.
118// This measured around 2x faster for copying code points,
119// but I found no corresponding speedup for other arrays.
120template <>
reed2347b622014-08-07 12:19:50 -0700121char* SkRecorder::copy(const char src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000122 if (NULL == src) {
123 return NULL;
124 }
125 char* dst = fRecord->alloc<char>(count);
126 memcpy(dst, src, count);
127 return dst;
128}
129
mtklein5f0e8222014-08-22 11:44:26 -0700130// As above, assuming and copying a terminating \0.
131template <>
132char* SkRecorder::copy(const char* src) {
133 return this->copy(src, strlen(src)+1);
134}
135
mtklein9db912c2015-05-19 11:11:26 -0700136void SkRecorder::flushMiniRecorder() {
137 if (fMiniRecorder) {
138 SkMiniRecorder* mr = fMiniRecorder;
mtkleind41ea1d2015-05-20 10:16:49 -0700139 fMiniRecorder = nullptr; // Needs to happen before flushAndReset() or we recurse forever.
140 mr->flushAndReset(this);
mtklein9db912c2015-05-19 11:11:26 -0700141 }
142}
mtklein5f0e8222014-08-22 11:44:26 -0700143
reed41af9662015-01-05 07:49:08 -0800144void SkRecorder::onDrawPaint(const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000145 APPEND(DrawPaint, delay_copy(paint));
146}
147
reed41af9662015-01-05 07:49:08 -0800148void SkRecorder::onDrawPoints(PointMode mode,
149 size_t count,
150 const SkPoint pts[],
151 const SkPaint& paint) {
mtklein42ddcd42014-11-21 08:48:35 -0800152 APPEND(DrawPoints, delay_copy(paint), mode, SkToUInt(count), this->copy(pts, count));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000153}
154
reed41af9662015-01-05 07:49:08 -0800155void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700156 TRY_MINIRECORDER(drawRect, rect, paint);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000157 APPEND(DrawRect, delay_copy(paint), rect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000158}
159
reed41af9662015-01-05 07:49:08 -0800160void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000161 APPEND(DrawOval, delay_copy(paint), oval);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000162}
163
reed41af9662015-01-05 07:49:08 -0800164void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000165 APPEND(DrawRRect, delay_copy(paint), rrect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000166}
167
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000168void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000169 APPEND(DrawDRRect, delay_copy(paint), outer, inner);
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000170}
171
reed3cb38402015-02-06 08:36:15 -0800172void SkRecorder::onDrawDrawable(SkDrawable* drawable) {
reed1bdfd3f2014-11-24 14:41:51 -0800173 if (!fDrawableList) {
reed3cb38402015-02-06 08:36:15 -0800174 fDrawableList.reset(SkNEW(SkDrawableList));
reed1bdfd3f2014-11-24 14:41:51 -0800175 }
176 fDrawableList->append(drawable);
177 APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
reed6be2aa92014-11-18 11:08:05 -0800178}
179
reed41af9662015-01-05 07:49:08 -0800180void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700181 TRY_MINIRECORDER(drawPath, path, paint);
mtkleinaf579032014-12-01 11:03:37 -0800182 APPEND(DrawPath, delay_copy(paint), delay_copy(path));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000183}
184
reed41af9662015-01-05 07:49:08 -0800185void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
186 SkScalar left,
187 SkScalar top,
188 const SkPaint* paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000189 APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000190}
191
reed41af9662015-01-05 07:49:08 -0800192void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
193 const SkRect* src,
194 const SkRect& dst,
195 const SkPaint* paint,
196 DrawBitmapRectFlags flags) {
mtklein42ddcd42014-11-21 08:48:35 -0800197 if (kBleed_DrawBitmapRectFlag == flags) {
198 APPEND(DrawBitmapRectToRectBleed,
199 this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
200 return;
201 }
202 SkASSERT(kNone_DrawBitmapRectFlag == flags);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000203 APPEND(DrawBitmapRectToRect,
mtklein42ddcd42014-11-21 08:48:35 -0800204 this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000205}
206
reed41af9662015-01-05 07:49:08 -0800207void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
208 const SkIRect& center,
209 const SkRect& dst,
210 const SkPaint* paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000211 APPEND(DrawBitmapNine, this->copy(paint), delay_copy(bitmap), center, dst);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000212}
213
reed41af9662015-01-05 07:49:08 -0800214void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
215 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700216 APPEND(DrawImage, this->copy(paint), image, left, top);
217}
218
reed41af9662015-01-05 07:49:08 -0800219void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src,
220 const SkRect& dst,
221 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700222 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst);
223}
224
reed4c21dc52015-06-25 12:32:03 -0700225void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center,
226 const SkRect& dst, const SkPaint* paint) {
227 APPEND(DrawImageNine, this->copy(paint), image, center, dst);
228}
229
reed41af9662015-01-05 07:49:08 -0800230void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000231 APPEND(DrawSprite, this->copy(paint), delay_copy(bitmap), left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000232}
233
reed@google.come0d9ce82014-04-23 04:00:17 +0000234void SkRecorder::onDrawText(const void* text, size_t byteLength,
235 SkScalar x, SkScalar y, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000236 APPEND(DrawText,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000237 delay_copy(paint), this->copy((const char*)text, byteLength), byteLength, x, y);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000238}
239
reed@google.come0d9ce82014-04-23 04:00:17 +0000240void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
241 const SkPoint pos[], const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000242 const unsigned points = paint.countText(text, byteLength);
243 APPEND(DrawPosText,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000244 delay_copy(paint),
245 this->copy((const char*)text, byteLength),
246 byteLength,
247 this->copy(pos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000248}
249
reed@google.come0d9ce82014-04-23 04:00:17 +0000250void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
251 const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000252 const unsigned points = paint.countText(text, byteLength);
253 APPEND(DrawPosTextH,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000254 delay_copy(paint),
255 this->copy((const char*)text, byteLength),
mtklein42ddcd42014-11-21 08:48:35 -0800256 SkToUInt(byteLength),
257 constY,
258 this->copy(xpos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000259}
260
reed@google.come0d9ce82014-04-23 04:00:17 +0000261void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
262 const SkMatrix* matrix, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000263 APPEND(DrawTextOnPath,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000264 delay_copy(paint),
265 this->copy((const char*)text, byteLength),
266 byteLength,
mtkleinaf579032014-12-01 11:03:37 -0800267 delay_copy(path),
268 matrix ? *matrix : SkMatrix::I());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000269}
270
fmalita00d5c2c2014-08-21 08:53:26 -0700271void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
272 const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700273 TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
fmalita00d5c2c2014-08-21 08:53:26 -0700274 APPEND(DrawTextBlob, delay_copy(paint), blob, x, y);
275}
276
reedd5fa1a42014-08-09 11:08:05 -0700277void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
mtklein98b84852015-04-21 15:23:59 -0700278 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pic);
mtkleinaf579032014-12-01 11:03:37 -0800279 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000280}
281
reed41af9662015-01-05 07:49:08 -0800282void SkRecorder::onDrawVertices(VertexMode vmode,
283 int vertexCount, const SkPoint vertices[],
284 const SkPoint texs[], const SkColor colors[],
285 SkXfermode* xmode,
286 const uint16_t indices[], int indexCount, const SkPaint& paint) {
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000287 APPEND(DrawVertices, delay_copy(paint),
288 vmode,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000289 vertexCount,
290 this->copy(vertices, vertexCount),
291 texs ? this->copy(texs, vertexCount) : NULL,
292 colors ? this->copy(colors, vertexCount) : NULL,
293 xmode,
294 this->copy(indices, indexCount),
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000295 indexCount);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000296}
297
dandovb3c9d1c2014-08-12 08:34:29 -0700298void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
299 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
300 APPEND(DrawPatch, delay_copy(paint),
301 cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
302 colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
303 texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
304 xmode);
dandov963137b2014-08-07 07:49:53 -0700305}
306
reed71c3c762015-06-24 10:29:17 -0700307void SkRecorder::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
308 const SkColor colors[], int count, SkXfermode::Mode mode,
309 const SkRect* cull, const SkPaint* paint) {
310 APPEND(DrawAtlas, this->copy(paint),
311 atlas,
312 this->copy(xform, count),
313 this->copy(tex, count),
314 this->copy(colors, count),
315 count,
316 mode,
317 this->copy(cull));
318}
319
Florin Malita5f6102d2014-06-30 10:13:28 -0400320void SkRecorder::willSave() {
321 APPEND(Save);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000322}
323
324SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
325 const SkPaint* paint,
326 SkCanvas::SaveFlags flags) {
327 APPEND(SaveLayer, this->copy(bounds), this->copy(paint), flags);
328 return SkCanvas::kNoLayer_SaveLayerStrategy;
329}
330
mtklein6cfa73a2014-08-13 13:33:49 -0700331void SkRecorder::didRestore() {
mtkleina723b572014-08-15 11:49:49 -0700332 APPEND(Restore, this->devBounds(), this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000333}
334
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000335void SkRecorder::didConcat(const SkMatrix& matrix) {
mtklein6332f1d2014-08-19 07:09:40 -0700336 this->didSetMatrix(this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000337}
338
339void SkRecorder::didSetMatrix(const SkMatrix& matrix) {
mtklein46bc6212014-08-20 09:44:28 -0700340 SkDEVCODE(if (matrix != this->getTotalMatrix()) {
mtkleinec924b92014-08-20 09:22:28 -0700341 matrix.dump();
342 this->getTotalMatrix().dump();
343 SkASSERT(matrix == this->getTotalMatrix());
344 })
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000345 APPEND(SetMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000346}
347
348void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000349 INHERITED(onClipRect, rect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800350 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
351 APPEND(ClipRect, this->devBounds(), rect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000352}
353
354void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700355 INHERITED(onClipRRect, rrect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800356 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
357 APPEND(ClipRRect, this->devBounds(), rrect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000358}
359
360void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700361 INHERITED(onClipPath, path, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800362 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
mtkleinaf579032014-12-01 11:03:37 -0800363 APPEND(ClipPath, this->devBounds(), delay_copy(path), opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000364}
365
366void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000367 INHERITED(onClipRegion, deviceRgn, op);
mtkleina723b572014-08-15 11:49:49 -0700368 APPEND(ClipRegion, this->devBounds(), delay_copy(deviceRgn), op);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000369}
mtklein5f0e8222014-08-22 11:44:26 -0700370