blob: 0413860e9dc1ff26f9ca8b424bec1fb22625fa7b [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
reed56179002015-07-07 06:11:19 -070015//#define WRAP_BITMAP_AS_IMAGE
16
reed3cb38402015-02-06 08:36:15 -080017SkDrawableList::~SkDrawableList() {
reed1bdfd3f2014-11-24 14:41:51 -080018 fArray.unrefAll();
19}
20
mtklein9db912c2015-05-19 11:11:26 -070021SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
reed1bdfd3f2014-11-24 14:41:51 -080022 const int count = fArray.count();
23 if (0 == count) {
24 return NULL;
25 }
26 SkAutoTMalloc<const SkPicture*> pics(count);
27 for (int i = 0; i < count; ++i) {
28 pics[i] = fArray[i]->newPictureSnapshot();
29 }
mtklein9db912c2015-05-19 11:11:26 -070030 return SkNEW_ARGS(SkBigPicture::SnapshotArray, (pics.detach(), count));
reed1bdfd3f2014-11-24 14:41:51 -080031}
32
reed3cb38402015-02-06 08:36:15 -080033void SkDrawableList::append(SkDrawable* drawable) {
reed1bdfd3f2014-11-24 14:41:51 -080034 *fArray.append() = SkRef(drawable);
35}
36
37///////////////////////////////////////////////////////////////////////////////////////////////
38
mtklein9db912c2015-05-19 11:11:26 -070039SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder* mr)
reed78e27682014-11-19 08:04:34 -080040 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag)
mtkleind711d112015-07-01 07:04:37 -070041 , fDrawPictureMode(Record_DrawPictureMode)
mtklein98b84852015-04-21 15:23:59 -070042 , fApproxBytesUsedBySubPictures(0)
mtklein9db912c2015-05-19 11:11:26 -070043 , fRecord(record)
44 , fMiniRecorder(mr) {}
reed78e27682014-11-19 08:04:34 -080045
mtklein9db912c2015-05-19 11:11:26 -070046SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr)
reed78e27682014-11-19 08:04:34 -080047 : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
mtkleind711d112015-07-01 07:04:37 -070048 , fDrawPictureMode(Record_DrawPictureMode)
mtklein98b84852015-04-21 15:23:59 -070049 , fApproxBytesUsedBySubPictures(0)
mtklein9db912c2015-05-19 11:11:26 -070050 , fRecord(record)
51 , fMiniRecorder(mr) {}
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000052
mtkleind711d112015-07-01 07:04:37 -070053void SkRecorder::reset(SkRecord* record, const SkRect& bounds,
54 DrawPictureMode dpm, SkMiniRecorder* mr) {
mtkleinfeaadee2015-04-08 11:25:48 -070055 this->forgetRecord();
mtkleind711d112015-07-01 07:04:37 -070056 fDrawPictureMode = dpm;
mtkleinfeaadee2015-04-08 11:25:48 -070057 fRecord = record;
58 this->resetForNextPicture(bounds.roundOut());
mtklein9db912c2015-05-19 11:11:26 -070059 fMiniRecorder = mr;
mtkleinfeaadee2015-04-08 11:25:48 -070060}
61
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000062void SkRecorder::forgetRecord() {
reed1bdfd3f2014-11-24 14:41:51 -080063 fDrawableList.reset(NULL);
mtklein98b84852015-04-21 15:23:59 -070064 fApproxBytesUsedBySubPictures = 0;
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000065 fRecord = NULL;
66}
67
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000068// To make appending to fRecord a little less verbose.
mtklein9db912c2015-05-19 11:11:26 -070069#define APPEND(T, ...) \
70 if (fMiniRecorder) { this->flushMiniRecorder(); } \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000071 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__VA_ARGS__))
72
mtklein9db912c2015-05-19 11:11:26 -070073#define TRY_MINIRECORDER(method, ...) \
74 if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
75
commit-bot@chromium.orga0950412014-05-29 16:52:40 +000076// For methods which must call back into SkCanvas.
77#define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +000078
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000079// Use copy() only for optional arguments, to be copied if present or skipped if not.
80// (For most types we just pass by value and let copy constructors do their thing.)
81template <typename T>
82T* SkRecorder::copy(const T* src) {
83 if (NULL == src) {
84 return NULL;
85 }
86 return SkNEW_PLACEMENT_ARGS(fRecord->alloc<T>(), T, (*src));
87}
88
89// This copy() is for arrays.
90// It will work with POD or non-POD, though currently we only use it for POD.
91template <typename T>
reed2347b622014-08-07 12:19:50 -070092T* SkRecorder::copy(const T src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000093 if (NULL == src) {
94 return NULL;
95 }
96 T* dst = fRecord->alloc<T>(count);
reed2347b622014-08-07 12:19:50 -070097 for (size_t i = 0; i < count; i++) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000098 SkNEW_PLACEMENT_ARGS(dst + i, T, (src[i]));
99 }
100 return dst;
101}
102
103// Specialization for copying strings, using memcpy.
104// This measured around 2x faster for copying code points,
105// but I found no corresponding speedup for other arrays.
106template <>
reed2347b622014-08-07 12:19:50 -0700107char* SkRecorder::copy(const char src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000108 if (NULL == src) {
109 return NULL;
110 }
111 char* dst = fRecord->alloc<char>(count);
112 memcpy(dst, src, count);
113 return dst;
114}
115
mtklein5f0e8222014-08-22 11:44:26 -0700116// As above, assuming and copying a terminating \0.
117template <>
118char* SkRecorder::copy(const char* src) {
119 return this->copy(src, strlen(src)+1);
120}
121
mtklein9db912c2015-05-19 11:11:26 -0700122void SkRecorder::flushMiniRecorder() {
123 if (fMiniRecorder) {
124 SkMiniRecorder* mr = fMiniRecorder;
mtkleind41ea1d2015-05-20 10:16:49 -0700125 fMiniRecorder = nullptr; // Needs to happen before flushAndReset() or we recurse forever.
126 mr->flushAndReset(this);
mtklein9db912c2015-05-19 11:11:26 -0700127 }
128}
mtklein5f0e8222014-08-22 11:44:26 -0700129
reed41af9662015-01-05 07:49:08 -0800130void SkRecorder::onDrawPaint(const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700131 APPEND(DrawPaint, paint);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000132}
133
reed41af9662015-01-05 07:49:08 -0800134void SkRecorder::onDrawPoints(PointMode mode,
135 size_t count,
136 const SkPoint pts[],
137 const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700138 APPEND(DrawPoints, paint, mode, SkToUInt(count), this->copy(pts, count));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000139}
140
reed41af9662015-01-05 07:49:08 -0800141void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700142 TRY_MINIRECORDER(drawRect, rect, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700143 APPEND(DrawRect, paint, rect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000144}
145
reed41af9662015-01-05 07:49:08 -0800146void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700147 APPEND(DrawOval, paint, oval);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000148}
149
reed41af9662015-01-05 07:49:08 -0800150void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700151 APPEND(DrawRRect, paint, rrect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000152}
153
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000154void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700155 APPEND(DrawDRRect, paint, outer, inner);
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000156}
157
reeda8db7282015-07-07 10:22:31 -0700158void SkRecorder::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
reed1bdfd3f2014-11-24 14:41:51 -0800159 if (!fDrawableList) {
reed3cb38402015-02-06 08:36:15 -0800160 fDrawableList.reset(SkNEW(SkDrawableList));
reed1bdfd3f2014-11-24 14:41:51 -0800161 }
162 fDrawableList->append(drawable);
reeda8db7282015-07-07 10:22:31 -0700163 APPEND(DrawDrawable, this->copy(matrix), drawable->getBounds(), fDrawableList->count() - 1);
reed6be2aa92014-11-18 11:08:05 -0800164}
165
reed41af9662015-01-05 07:49:08 -0800166void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700167 TRY_MINIRECORDER(drawPath, path, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700168 APPEND(DrawPath, paint, path);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000169}
170
reed41af9662015-01-05 07:49:08 -0800171void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
172 SkScalar left,
173 SkScalar top,
174 const SkPaint* paint) {
reed56179002015-07-07 06:11:19 -0700175#ifdef WRAP_BITMAP_AS_IMAGE
176 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
177 if (image) {
178 this->onDrawImage(image, left, top, paint);
179 }
180#else
mtkleinc845fa02015-06-30 09:49:49 -0700181 APPEND(DrawBitmap, this->copy(paint), bitmap, left, top);
reed56179002015-07-07 06:11:19 -0700182#endif
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000183}
184
reed41af9662015-01-05 07:49:08 -0800185void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
186 const SkRect* src,
187 const SkRect& dst,
188 const SkPaint* paint,
189 DrawBitmapRectFlags flags) {
reed56179002015-07-07 06:11:19 -0700190#ifdef WRAP_BITMAP_AS_IMAGE
191 // TODO: need a way to support the flags for images...
192 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
193 if (image) {
194 this->onDrawImageRect(image, src, dst, paint);
195 }
196#else
mtklein64b4c782015-07-01 13:56:53 -0700197 TRY_MINIRECORDER(drawBitmapRectToRect, bitmap, src, dst, paint, flags);
mtklein42ddcd42014-11-21 08:48:35 -0800198 if (kBleed_DrawBitmapRectFlag == flags) {
199 APPEND(DrawBitmapRectToRectBleed,
mtkleinc845fa02015-06-30 09:49:49 -0700200 this->copy(paint), bitmap, this->copy(src), dst);
mtklein42ddcd42014-11-21 08:48:35 -0800201 return;
202 }
203 SkASSERT(kNone_DrawBitmapRectFlag == flags);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000204 APPEND(DrawBitmapRectToRect,
mtkleinc845fa02015-06-30 09:49:49 -0700205 this->copy(paint), bitmap, this->copy(src), dst);
reed56179002015-07-07 06:11:19 -0700206#endif
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000207}
208
reed41af9662015-01-05 07:49:08 -0800209void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
210 const SkIRect& center,
211 const SkRect& dst,
212 const SkPaint* paint) {
reed56179002015-07-07 06:11:19 -0700213#ifdef WRAP_BITMAP_AS_IMAGE
214 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
215 if (image) {
216 this->onDrawImageNine(image, center, dst, paint);
217 }
218#else
mtkleinc845fa02015-06-30 09:49:49 -0700219 APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst);
reed56179002015-07-07 06:11:19 -0700220#endif
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000221}
222
reed41af9662015-01-05 07:49:08 -0800223void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
224 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700225 APPEND(DrawImage, this->copy(paint), image, left, top);
226}
227
reed41af9662015-01-05 07:49:08 -0800228void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src,
229 const SkRect& dst,
230 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700231 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst);
232}
233
reed4c21dc52015-06-25 12:32:03 -0700234void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center,
235 const SkRect& dst, const SkPaint* paint) {
236 APPEND(DrawImageNine, this->copy(paint), image, center, dst);
237}
238
reed41af9662015-01-05 07:49:08 -0800239void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700240 APPEND(DrawSprite, this->copy(paint), bitmap, left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000241}
242
reed@google.come0d9ce82014-04-23 04:00:17 +0000243void SkRecorder::onDrawText(const void* text, size_t byteLength,
244 SkScalar x, SkScalar y, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000245 APPEND(DrawText,
mtkleinc845fa02015-06-30 09:49:49 -0700246 paint, this->copy((const char*)text, byteLength), byteLength, x, y);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000247}
248
reed@google.come0d9ce82014-04-23 04:00:17 +0000249void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
250 const SkPoint pos[], const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000251 const unsigned points = paint.countText(text, byteLength);
252 APPEND(DrawPosText,
mtkleinc845fa02015-06-30 09:49:49 -0700253 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000254 this->copy((const char*)text, byteLength),
255 byteLength,
256 this->copy(pos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000257}
258
reed@google.come0d9ce82014-04-23 04:00:17 +0000259void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
260 const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000261 const unsigned points = paint.countText(text, byteLength);
262 APPEND(DrawPosTextH,
mtkleinc845fa02015-06-30 09:49:49 -0700263 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000264 this->copy((const char*)text, byteLength),
mtklein42ddcd42014-11-21 08:48:35 -0800265 SkToUInt(byteLength),
266 constY,
267 this->copy(xpos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000268}
269
reed@google.come0d9ce82014-04-23 04:00:17 +0000270void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
271 const SkMatrix* matrix, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000272 APPEND(DrawTextOnPath,
mtkleinc845fa02015-06-30 09:49:49 -0700273 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000274 this->copy((const char*)text, byteLength),
275 byteLength,
mtkleinc845fa02015-06-30 09:49:49 -0700276 path,
mtkleinaf579032014-12-01 11:03:37 -0800277 matrix ? *matrix : SkMatrix::I());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000278}
279
fmalita00d5c2c2014-08-21 08:53:26 -0700280void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
281 const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700282 TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700283 APPEND(DrawTextBlob, paint, blob, x, y);
fmalita00d5c2c2014-08-21 08:53:26 -0700284}
285
reedd5fa1a42014-08-09 11:08:05 -0700286void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
mtkleind711d112015-07-01 07:04:37 -0700287 if (fDrawPictureMode == Record_DrawPictureMode) {
288 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pic);
289 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
290 } else {
291 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode);
292 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect());
293 pic->playback(this);
294 }
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000295}
296
reed41af9662015-01-05 07:49:08 -0800297void SkRecorder::onDrawVertices(VertexMode vmode,
298 int vertexCount, const SkPoint vertices[],
299 const SkPoint texs[], const SkColor colors[],
300 SkXfermode* xmode,
301 const uint16_t indices[], int indexCount, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700302 APPEND(DrawVertices, paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000303 vmode,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000304 vertexCount,
305 this->copy(vertices, vertexCount),
306 texs ? this->copy(texs, vertexCount) : NULL,
307 colors ? this->copy(colors, vertexCount) : NULL,
308 xmode,
309 this->copy(indices, indexCount),
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000310 indexCount);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000311}
312
dandovb3c9d1c2014-08-12 08:34:29 -0700313void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
314 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700315 APPEND(DrawPatch, paint,
dandovb3c9d1c2014-08-12 08:34:29 -0700316 cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
317 colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
318 texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
319 xmode);
dandov963137b2014-08-07 07:49:53 -0700320}
321
reed71c3c762015-06-24 10:29:17 -0700322void SkRecorder::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
323 const SkColor colors[], int count, SkXfermode::Mode mode,
324 const SkRect* cull, const SkPaint* paint) {
325 APPEND(DrawAtlas, this->copy(paint),
326 atlas,
327 this->copy(xform, count),
328 this->copy(tex, count),
329 this->copy(colors, count),
330 count,
331 mode,
332 this->copy(cull));
333}
334
Florin Malita5f6102d2014-06-30 10:13:28 -0400335void SkRecorder::willSave() {
336 APPEND(Save);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000337}
338
339SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
340 const SkPaint* paint,
341 SkCanvas::SaveFlags flags) {
342 APPEND(SaveLayer, this->copy(bounds), this->copy(paint), flags);
343 return SkCanvas::kNoLayer_SaveLayerStrategy;
344}
345
mtklein6cfa73a2014-08-13 13:33:49 -0700346void SkRecorder::didRestore() {
mtkleina723b572014-08-15 11:49:49 -0700347 APPEND(Restore, this->devBounds(), this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000348}
349
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000350void SkRecorder::didConcat(const SkMatrix& matrix) {
mtklein6332f1d2014-08-19 07:09:40 -0700351 this->didSetMatrix(this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000352}
353
354void SkRecorder::didSetMatrix(const SkMatrix& matrix) {
mtklein46bc6212014-08-20 09:44:28 -0700355 SkDEVCODE(if (matrix != this->getTotalMatrix()) {
mtkleinec924b92014-08-20 09:22:28 -0700356 matrix.dump();
357 this->getTotalMatrix().dump();
358 SkASSERT(matrix == this->getTotalMatrix());
359 })
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000360 APPEND(SetMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000361}
362
363void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000364 INHERITED(onClipRect, rect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800365 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
366 APPEND(ClipRect, this->devBounds(), rect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000367}
368
369void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700370 INHERITED(onClipRRect, rrect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800371 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
372 APPEND(ClipRRect, this->devBounds(), rrect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000373}
374
375void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700376 INHERITED(onClipPath, path, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800377 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
mtkleinc845fa02015-06-30 09:49:49 -0700378 APPEND(ClipPath, this->devBounds(), path, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000379}
380
381void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000382 INHERITED(onClipRegion, deviceRgn, op);
mtkleinc845fa02015-06-30 09:49:49 -0700383 APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000384}
mtklein5f0e8222014-08-22 11:44:26 -0700385