blob: 0fe9e28848f00389c9015855da018b6d96a0fc7e [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 }
halcanary385fe4d2015-08-26 13:07:48 -070030 return new 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.
halcanary385fe4d2015-08-26 13:07:48 -070069#define APPEND(T, ...) \
70 if (fMiniRecorder) { \
71 this->flushMiniRecorder(); \
72 } \
73 new (fRecord->append<SkRecords::T>()) SkRecords::T(__VA_ARGS__)
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000074
mtklein9db912c2015-05-19 11:11:26 -070075#define TRY_MINIRECORDER(method, ...) \
76 if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
77
commit-bot@chromium.orga0950412014-05-29 16:52:40 +000078// For methods which must call back into SkCanvas.
79#define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +000080
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000081// Use copy() only for optional arguments, to be copied if present or skipped if not.
82// (For most types we just pass by value and let copy constructors do their thing.)
83template <typename T>
84T* SkRecorder::copy(const T* src) {
85 if (NULL == src) {
86 return NULL;
87 }
halcanary385fe4d2015-08-26 13:07:48 -070088 return new (fRecord->alloc<T>()) T(*src);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000089}
90
91// This copy() is for arrays.
92// It will work with POD or non-POD, though currently we only use it for POD.
93template <typename T>
reed2347b622014-08-07 12:19:50 -070094T* SkRecorder::copy(const T src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000095 if (NULL == src) {
96 return NULL;
97 }
98 T* dst = fRecord->alloc<T>(count);
reed2347b622014-08-07 12:19:50 -070099 for (size_t i = 0; i < count; i++) {
halcanary385fe4d2015-08-26 13:07:48 -0700100 new (dst + i) T(src[i]);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000101 }
102 return dst;
103}
104
105// Specialization for copying strings, using memcpy.
106// This measured around 2x faster for copying code points,
107// but I found no corresponding speedup for other arrays.
108template <>
reed2347b622014-08-07 12:19:50 -0700109char* SkRecorder::copy(const char src[], size_t count) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000110 if (NULL == src) {
111 return NULL;
112 }
113 char* dst = fRecord->alloc<char>(count);
114 memcpy(dst, src, count);
115 return dst;
116}
117
mtklein5f0e8222014-08-22 11:44:26 -0700118// As above, assuming and copying a terminating \0.
119template <>
120char* SkRecorder::copy(const char* src) {
121 return this->copy(src, strlen(src)+1);
122}
123
mtklein9db912c2015-05-19 11:11:26 -0700124void SkRecorder::flushMiniRecorder() {
125 if (fMiniRecorder) {
126 SkMiniRecorder* mr = fMiniRecorder;
mtkleind41ea1d2015-05-20 10:16:49 -0700127 fMiniRecorder = nullptr; // Needs to happen before flushAndReset() or we recurse forever.
128 mr->flushAndReset(this);
mtklein9db912c2015-05-19 11:11:26 -0700129 }
130}
mtklein5f0e8222014-08-22 11:44:26 -0700131
reed41af9662015-01-05 07:49:08 -0800132void SkRecorder::onDrawPaint(const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700133 APPEND(DrawPaint, paint);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000134}
135
reed41af9662015-01-05 07:49:08 -0800136void SkRecorder::onDrawPoints(PointMode mode,
137 size_t count,
138 const SkPoint pts[],
139 const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700140 APPEND(DrawPoints, paint, mode, SkToUInt(count), this->copy(pts, count));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000141}
142
reed41af9662015-01-05 07:49:08 -0800143void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700144 TRY_MINIRECORDER(drawRect, rect, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700145 APPEND(DrawRect, paint, rect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000146}
147
reed41af9662015-01-05 07:49:08 -0800148void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700149 APPEND(DrawOval, paint, oval);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000150}
151
reed41af9662015-01-05 07:49:08 -0800152void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700153 APPEND(DrawRRect, paint, rrect);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000154}
155
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000156void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700157 APPEND(DrawDRRect, paint, outer, inner);
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000158}
159
reeda8db7282015-07-07 10:22:31 -0700160void SkRecorder::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
reed1bdfd3f2014-11-24 14:41:51 -0800161 if (!fDrawableList) {
halcanary385fe4d2015-08-26 13:07:48 -0700162 fDrawableList.reset(new SkDrawableList);
reed1bdfd3f2014-11-24 14:41:51 -0800163 }
164 fDrawableList->append(drawable);
reeda8db7282015-07-07 10:22:31 -0700165 APPEND(DrawDrawable, this->copy(matrix), drawable->getBounds(), fDrawableList->count() - 1);
reed6be2aa92014-11-18 11:08:05 -0800166}
167
reed41af9662015-01-05 07:49:08 -0800168void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700169 TRY_MINIRECORDER(drawPath, path, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700170 APPEND(DrawPath, paint, path);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000171}
172
reed41af9662015-01-05 07:49:08 -0800173void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
174 SkScalar left,
175 SkScalar top,
176 const SkPaint* paint) {
reed56179002015-07-07 06:11:19 -0700177#ifdef WRAP_BITMAP_AS_IMAGE
178 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
179 if (image) {
180 this->onDrawImage(image, left, top, paint);
181 }
182#else
mtkleinc845fa02015-06-30 09:49:49 -0700183 APPEND(DrawBitmap, this->copy(paint), bitmap, left, top);
reed56179002015-07-07 06:11:19 -0700184#endif
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000185}
186
reed41af9662015-01-05 07:49:08 -0800187void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
188 const SkRect* src,
189 const SkRect& dst,
190 const SkPaint* paint,
reed562fe472015-07-28 07:35:14 -0700191 SrcRectConstraint constraint) {
reed56179002015-07-07 06:11:19 -0700192#ifdef WRAP_BITMAP_AS_IMAGE
193 // TODO: need a way to support the flags for images...
194 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap));
195 if (image) {
196 this->onDrawImageRect(image, src, dst, paint);
197 }
198#else
reeda5517e22015-07-14 10:54:12 -0700199 TRY_MINIRECORDER(drawBitmapRect, bitmap, src, dst, paint, constraint);
200 if (kFast_SrcRectConstraint == constraint) {
201 APPEND(DrawBitmapRectFast, this->copy(paint), bitmap, this->copy(src), dst);
mtklein42ddcd42014-11-21 08:48:35 -0800202 return;
203 }
reeda5517e22015-07-14 10:54:12 -0700204 SkASSERT(kStrict_SrcRectConstraint == constraint);
205 APPEND(DrawBitmapRect, 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
reed562fe472015-07-28 07:35:14 -0700228void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
229 const SkPaint* paint, SrcRectConstraint constraint) {
reeda5517e22015-07-14 10:54:12 -0700230 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst, constraint);
piotaixr65151752014-10-16 11:58:39 -0700231}
232
reed4c21dc52015-06-25 12:32:03 -0700233void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center,
234 const SkRect& dst, const SkPaint* paint) {
235 APPEND(DrawImageNine, this->copy(paint), image, center, dst);
236}
237
reed41af9662015-01-05 07:49:08 -0800238void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700239 APPEND(DrawSprite, this->copy(paint), bitmap, left, top);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000240}
241
reed@google.come0d9ce82014-04-23 04:00:17 +0000242void SkRecorder::onDrawText(const void* text, size_t byteLength,
243 SkScalar x, SkScalar y, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000244 APPEND(DrawText,
mtkleinc845fa02015-06-30 09:49:49 -0700245 paint, this->copy((const char*)text, byteLength), byteLength, x, y);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000246}
247
reed@google.come0d9ce82014-04-23 04:00:17 +0000248void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
249 const SkPoint pos[], const SkPaint& paint) {
mtkleinc6ad06a2015-08-19 09:51:00 -0700250 const int points = paint.countText(text, byteLength);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000251 APPEND(DrawPosText,
mtkleinc845fa02015-06-30 09:49:49 -0700252 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000253 this->copy((const char*)text, byteLength),
254 byteLength,
255 this->copy(pos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000256}
257
reed@google.come0d9ce82014-04-23 04:00:17 +0000258void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
259 const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
mtkleinc6ad06a2015-08-19 09:51:00 -0700260 const int points = paint.countText(text, byteLength);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000261 APPEND(DrawPosTextH,
mtkleinc845fa02015-06-30 09:49:49 -0700262 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000263 this->copy((const char*)text, byteLength),
mtklein42ddcd42014-11-21 08:48:35 -0800264 SkToUInt(byteLength),
265 constY,
266 this->copy(xpos, points));
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000267}
268
reed@google.come0d9ce82014-04-23 04:00:17 +0000269void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
270 const SkMatrix* matrix, const SkPaint& paint) {
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000271 APPEND(DrawTextOnPath,
mtkleinc845fa02015-06-30 09:49:49 -0700272 paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000273 this->copy((const char*)text, byteLength),
274 byteLength,
mtkleinc845fa02015-06-30 09:49:49 -0700275 path,
mtkleinaf579032014-12-01 11:03:37 -0800276 matrix ? *matrix : SkMatrix::I());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000277}
278
fmalita00d5c2c2014-08-21 08:53:26 -0700279void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
280 const SkPaint& paint) {
mtklein9db912c2015-05-19 11:11:26 -0700281 TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
mtkleinc845fa02015-06-30 09:49:49 -0700282 APPEND(DrawTextBlob, paint, blob, x, y);
fmalita00d5c2c2014-08-21 08:53:26 -0700283}
284
reedd5fa1a42014-08-09 11:08:05 -0700285void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
mtkleind711d112015-07-01 07:04:37 -0700286 if (fDrawPictureMode == Record_DrawPictureMode) {
287 fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pic);
288 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
289 } else {
290 SkASSERT(fDrawPictureMode == Playback_DrawPictureMode);
291 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, pic->cullRect());
292 pic->playback(this);
293 }
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000294}
295
reed41af9662015-01-05 07:49:08 -0800296void SkRecorder::onDrawVertices(VertexMode vmode,
297 int vertexCount, const SkPoint vertices[],
298 const SkPoint texs[], const SkColor colors[],
299 SkXfermode* xmode,
300 const uint16_t indices[], int indexCount, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700301 APPEND(DrawVertices, paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000302 vmode,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000303 vertexCount,
304 this->copy(vertices, vertexCount),
305 texs ? this->copy(texs, vertexCount) : NULL,
306 colors ? this->copy(colors, vertexCount) : NULL,
307 xmode,
308 this->copy(indices, indexCount),
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000309 indexCount);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000310}
311
dandovb3c9d1c2014-08-12 08:34:29 -0700312void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
313 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
mtkleinc845fa02015-06-30 09:49:49 -0700314 APPEND(DrawPatch, paint,
dandovb3c9d1c2014-08-12 08:34:29 -0700315 cubics ? this->copy(cubics, SkPatchUtils::kNumCtrlPts) : NULL,
316 colors ? this->copy(colors, SkPatchUtils::kNumCorners) : NULL,
317 texCoords ? this->copy(texCoords, SkPatchUtils::kNumCorners) : NULL,
318 xmode);
dandov963137b2014-08-07 07:49:53 -0700319}
320
reed71c3c762015-06-24 10:29:17 -0700321void SkRecorder::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
322 const SkColor colors[], int count, SkXfermode::Mode mode,
323 const SkRect* cull, const SkPaint* paint) {
324 APPEND(DrawAtlas, this->copy(paint),
325 atlas,
326 this->copy(xform, count),
327 this->copy(tex, count),
328 this->copy(colors, count),
329 count,
330 mode,
331 this->copy(cull));
332}
333
Florin Malita5f6102d2014-06-30 10:13:28 -0400334void SkRecorder::willSave() {
335 APPEND(Save);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000336}
337
338SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
339 const SkPaint* paint,
340 SkCanvas::SaveFlags flags) {
341 APPEND(SaveLayer, this->copy(bounds), this->copy(paint), flags);
342 return SkCanvas::kNoLayer_SaveLayerStrategy;
343}
344
mtklein6cfa73a2014-08-13 13:33:49 -0700345void SkRecorder::didRestore() {
mtkleina723b572014-08-15 11:49:49 -0700346 APPEND(Restore, this->devBounds(), this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000347}
348
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000349void SkRecorder::didConcat(const SkMatrix& matrix) {
mtklein6332f1d2014-08-19 07:09:40 -0700350 this->didSetMatrix(this->getTotalMatrix());
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000351}
352
353void SkRecorder::didSetMatrix(const SkMatrix& matrix) {
mtklein46bc6212014-08-20 09:44:28 -0700354 SkDEVCODE(if (matrix != this->getTotalMatrix()) {
mtkleinec924b92014-08-20 09:22:28 -0700355 matrix.dump();
356 this->getTotalMatrix().dump();
357 SkASSERT(matrix == this->getTotalMatrix());
358 })
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000359 APPEND(SetMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000360}
361
362void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000363 INHERITED(onClipRect, rect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800364 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
365 APPEND(ClipRect, this->devBounds(), rect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000366}
367
368void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700369 INHERITED(onClipRRect, rrect, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800370 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
371 APPEND(ClipRRect, this->devBounds(), rrect, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000372}
373
374void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
reedd9544982014-09-09 18:46:22 -0700375 INHERITED(onClipPath, path, op, edgeStyle);
mtkleincdeeb092014-11-20 09:14:28 -0800376 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
mtkleinc845fa02015-06-30 09:49:49 -0700377 APPEND(ClipPath, this->devBounds(), path, opAA);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000378}
379
380void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
commit-bot@chromium.orgd9ce2be2014-04-09 23:30:28 +0000381 INHERITED(onClipRegion, deviceRgn, op);
mtkleinc845fa02015-06-30 09:49:49 -0700382 APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000383}
mtklein5f0e8222014-08-22 11:44:26 -0700384