blob: b12b1eb2962e7b9759ceee6b8e9eb1773c63d27b [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,
reed562fe472015-07-28 07:35:14 -0700189 SrcRectConstraint constraint) {
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
reeda5517e22015-07-14 10:54:12 -0700197 TRY_MINIRECORDER(drawBitmapRect, bitmap, src, dst, paint, constraint);
198 if (kFast_SrcRectConstraint == constraint) {
199 APPEND(DrawBitmapRectFast, this->copy(paint), bitmap, this->copy(src), dst);
mtklein42ddcd42014-11-21 08:48:35 -0800200 return;
201 }
reeda5517e22015-07-14 10:54:12 -0700202 SkASSERT(kStrict_SrcRectConstraint == constraint);
203 APPEND(DrawBitmapRect, this->copy(paint), bitmap, this->copy(src), dst);
reed56179002015-07-07 06:11:19 -0700204#endif
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) {
reed56179002015-07-07 06:11:19 -0700211#ifdef WRAP_BITMAP_AS_IMAGE
212 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
213 if (image) {
214 this->onDrawImageNine(image, center, dst, paint);
215 }
216#else
mtkleinc845fa02015-06-30 09:49:49 -0700217 APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst);
reed56179002015-07-07 06:11:19 -0700218#endif
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000219}
220
reed41af9662015-01-05 07:49:08 -0800221void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
222 const SkPaint* paint) {
piotaixr65151752014-10-16 11:58:39 -0700223 APPEND(DrawImage, this->copy(paint), image, left, top);
224}
225
reed562fe472015-07-28 07:35:14 -0700226void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
227 const SkPaint* paint, SrcRectConstraint constraint) {
reeda5517e22015-07-14 10:54:12 -0700228 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst, constraint);
piotaixr65151752014-10-16 11:58:39 -0700229}
230
reed4c21dc52015-06-25 12:32:03 -0700231void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center,
232 const SkRect& dst, const SkPaint* paint) {
233 APPEND(DrawImageNine, this->copy(paint), image, center, dst);
234}
235
reed41af9662015-01-05 07:49:08 -0800236void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700237 APPEND(DrawSprite, this->copy(paint), bitmap, left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000238}
239
reed@google.come0d9ce82014-04-23 04:00:17 +0000240void SkRecorder::onDrawText(const void* text, size_t byteLength,
241 SkScalar x, SkScalar y, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000242 APPEND(DrawText,
mtkleinc845fa02015-06-30 09:49:49 -0700243 paint, this->copy((const char*)text, byteLength), byteLength, x, y);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000244}
245
reed@google.come0d9ce82014-04-23 04:00:17 +0000246void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
247 const SkPoint pos[], const SkPaint& paint) {
mtkleinc6ad06a2015-08-19 09:51:00 -0700248 const int points = paint.countText(text, byteLength);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000249 APPEND(DrawPosText,
mtkleinc845fa02015-06-30 09:49:49 -0700250 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000251 this->copy((const char*)text, byteLength),
252 byteLength,
253 this->copy(pos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000254}
255
reed@google.come0d9ce82014-04-23 04:00:17 +0000256void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
257 const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
mtkleinc6ad06a2015-08-19 09:51:00 -0700258 const int points = paint.countText(text, byteLength);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000259 APPEND(DrawPosTextH,
mtkleinc845fa02015-06-30 09:49:49 -0700260 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000261 this->copy((const char*)text, byteLength),
mtklein42ddcd42014-11-21 08:48:35 -0800262 SkToUInt(byteLength),
263 constY,
264 this->copy(xpos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000265}
266
reed@google.come0d9ce82014-04-23 04:00:17 +0000267void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
268 const SkMatrix* matrix, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000269 APPEND(DrawTextOnPath,
mtkleinc845fa02015-06-30 09:49:49 -0700270 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000271 this->copy((const char*)text, byteLength),
272 byteLength,
mtkleinc845fa02015-06-30 09:49:49 -0700273 path,
mtkleinaf579032014-12-01 11:03:37 -0800274 matrix ? *matrix : SkMatrix::I());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000275}
276
fmalita00d5c2c2014-08-21 08:53:26 -0700277void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
278 const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700279 TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700280 APPEND(DrawTextBlob, paint, blob, x, y);
fmalita00d5c2c2014-08-21 08:53:26 -0700281}
282
reedd5fa1a42014-08-09 11:08:05 -0700283void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
mtkleind711d112015-07-01 07:04:37 -0700284 if (fDrawPictureMode == Record_DrawPictureMode) {
285 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pic);
286 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
287 } else {
288 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode);
289 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect());
290 pic->playback(this);
291 }
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000292}
293
reed41af9662015-01-05 07:49:08 -0800294void SkRecorder::onDrawVertices(VertexMode vmode,
295 int vertexCount, const SkPoint vertices[],
296 const SkPoint texs[], const SkColor colors[],
297 SkXfermode* xmode,
298 const uint16_t indices[], int indexCount, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700299 APPEND(DrawVertices, paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000300 vmode,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000301 vertexCount,
302 this->copy(vertices, vertexCount),
303 texs ? this->copy(texs, vertexCount) : NULL,
304 colors ? this->copy(colors, vertexCount) : NULL,
305 xmode,
306 this->copy(indices, indexCount),
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000307 indexCount);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000308}
309
dandovb3c9d1c2014-08-12 08:34:29 -0700310void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
311 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700312 APPEND(DrawPatch, paint,
dandovb3c9d1c2014-08-12 08:34:29 -0700313 cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
314 colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
315 texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
316 xmode);
dandov963137b2014-08-07 07:49:53 -0700317}
318
reed71c3c762015-06-24 10:29:17 -0700319void SkRecorder::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
320 const SkColor colors[], int count, SkXfermode::Mode mode,
321 const SkRect* cull, const SkPaint* paint) {
322 APPEND(DrawAtlas, this->copy(paint),
323 atlas,
324 this->copy(xform, count),
325 this->copy(tex, count),
326 this->copy(colors, count),
327 count,
328 mode,
329 this->copy(cull));
330}
331
Florin Malita5f6102d2014-06-30 10:13:28 -0400332void SkRecorder::willSave() {
333 APPEND(Save);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000334}
335
336SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
337 const SkPaint* paint,
338 SkCanvas::SaveFlags flags) {
339 APPEND(SaveLayer, this->copy(bounds), this->copy(paint), flags);
340 return SkCanvas::kNoLayer_SaveLayerStrategy;
341}
342
mtklein6cfa73a2014-08-13 13:33:49 -0700343void SkRecorder::didRestore() {
mtkleina723b572014-08-15 11:49:49 -0700344 APPEND(Restore, this->devBounds(), this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000345}
346
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000347void SkRecorder::didConcat(const SkMatrix& matrix) {
mtklein6332f1d2014-08-19 07:09:40 -0700348 this->didSetMatrix(this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000349}
350
351void SkRecorder::didSetMatrix(const SkMatrix& matrix) {
mtklein46bc6212014-08-20 09:44:28 -0700352 SkDEVCODE(if (matrix != this->getTotalMatrix()) {
mtkleinec924b92014-08-20 09:22:28 -0700353 matrix.dump();
354 this->getTotalMatrix().dump();
355 SkASSERT(matrix == this->getTotalMatrix());
356 })
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000357 APPEND(SetMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000358}
359
360void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000361 INHERITED(onClipRect, rect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800362 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
363 APPEND(ClipRect, this->devBounds(), rect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000364}
365
366void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700367 INHERITED(onClipRRect, rrect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800368 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
369 APPEND(ClipRRect, this->devBounds(), rrect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000370}
371
372void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700373 INHERITED(onClipPath, path, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800374 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
mtkleinc845fa02015-06-30 09:49:49 -0700375 APPEND(ClipPath, this->devBounds(), path, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000376}
377
378void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000379 INHERITED(onClipRegion, deviceRgn, op);
mtkleinc845fa02015-06-30 09:49:49 -0700380 APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000381}
mtklein5f0e8222014-08-22 11:44:26 -0700382