blob: 074a560c04f7f1ce6dbc8c2fe16b9cc5c8bbbb02 [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
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +00008#ifndef SkRecords_DEFINED
9#define SkRecords_DEFINED
10
11#include "SkCanvas.h"
reed3cb38402015-02-06 08:36:15 -080012#include "SkDrawable.h"
reeda8db7282015-07-07 10:22:31 -070013#include "SkMatrix.h"
reed026beb52015-06-10 14:23:15 -070014#include "SkPathPriv.h"
reed2347b622014-08-07 12:19:50 -070015#include "SkPicture.h"
reed71c3c762015-06-24 10:29:17 -070016#include "SkRSXform.h"
fmalita00d5c2c2014-08-21 08:53:26 -070017#include "SkTextBlob.h"
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000018
19namespace SkRecords {
20
21// A list of all the types of canvas calls we can record.
22// Each of these is reified into a struct below.
23//
24// (We're using the macro-of-macro trick here to do several different things with the same list.)
25//
26// We leave this SK_RECORD_TYPES macro defined for use by code that wants to operate on SkRecords
27// types polymorphically. (See SkRecord::Record::{visit,mutate} for an example.)
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +000028//
29// Order doesn't technically matter here, but the compiler can generally generate better code if
30// you keep them semantically grouped, especially the Draws. It's also nice to leave NoOp at 0.
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000031#define SK_RECORD_TYPES(M) \
32 M(NoOp) \
33 M(Restore) \
34 M(Save) \
35 M(SaveLayer) \
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000036 M(SetMatrix) \
37 M(ClipPath) \
38 M(ClipRRect) \
39 M(ClipRect) \
40 M(ClipRegion) \
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000041 M(DrawBitmap) \
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000042 M(DrawBitmapNine) \
43 M(DrawBitmapRectToRect) \
mtklein42ddcd42014-11-21 08:48:35 -080044 M(DrawBitmapRectToRectBleed) \
mtklein64b4c782015-07-01 13:56:53 -070045 M(DrawBitmapRectToRectFixedSize) \
reed6be2aa92014-11-18 11:08:05 -080046 M(DrawDrawable) \
piotaixr65151752014-10-16 11:58:39 -070047 M(DrawImage) \
48 M(DrawImageRect) \
reed4c21dc52015-06-25 12:32:03 -070049 M(DrawImageNine) \
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000050 M(DrawDRRect) \
51 M(DrawOval) \
52 M(DrawPaint) \
53 M(DrawPath) \
dandov963137b2014-08-07 07:49:53 -070054 M(DrawPatch) \
reed2347b622014-08-07 12:19:50 -070055 M(DrawPicture) \
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000056 M(DrawPoints) \
57 M(DrawPosText) \
58 M(DrawPosTextH) \
mtkleinc551d9f2014-08-20 08:09:46 -070059 M(DrawText) \
60 M(DrawTextOnPath) \
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +000061 M(DrawRRect) \
62 M(DrawRect) \
63 M(DrawSprite) \
mtklein29dfaa82014-09-04 14:12:44 -070064 M(DrawTextBlob) \
reed71c3c762015-06-24 10:29:17 -070065 M(DrawAtlas) \
mtkleinf4078ad2014-08-08 10:05:19 -070066 M(DrawVertices)
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000067
68// Defines SkRecords::Type, an enum of all record types.
69#define ENUM(T) T##_Type,
70enum Type { SK_RECORD_TYPES(ENUM) };
71#undef ENUM
72
73// Macros to make it easier to define a record for a draw call with 0 args, 1 args, 2 args, etc.
74// These should be clearer when you look at their use below.
75#define RECORD0(T) \
76struct T { \
77 static const Type kType = T##_Type; \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000078};
79
mtkleinc845fa02015-06-30 09:49:49 -070080// Instead of requring the exact type A here, we take any type Z which implicitly casts to A.
81// This lets our wrappers like ImmutableBitmap work seamlessly.
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000082
83#define RECORD1(T, A, a) \
84struct T { \
85 static const Type kType = T##_Type; \
mtklein9db912c2015-05-19 11:11:26 -070086 T() {} \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000087 template <typename Z> \
mtkleinc845fa02015-06-30 09:49:49 -070088 T(const Z& a) : a(a) {} \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000089 A a; \
90};
91
mtkleinc845fa02015-06-30 09:49:49 -070092#define RECORD2(T, A, a, B, b) \
93struct T { \
94 static const Type kType = T##_Type; \
95 T() {} \
96 template <typename Z, typename Y> \
97 T(const Z& a, const Y& b) : a(a), b(b) {} \
98 A a; B b; \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +000099};
100
mtkleinc845fa02015-06-30 09:49:49 -0700101#define RECORD3(T, A, a, B, b, C, c) \
102struct T { \
103 static const Type kType = T##_Type; \
104 T() {} \
105 template <typename Z, typename Y, typename X> \
106 T(const Z& a, const Y& b, const X& c) : a(a), b(b), c(c) {} \
107 A a; B b; C c; \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000108};
109
mtkleinc845fa02015-06-30 09:49:49 -0700110#define RECORD4(T, A, a, B, b, C, c, D, d) \
111struct T { \
112 static const Type kType = T##_Type; \
113 T() {} \
114 template <typename Z, typename Y, typename X, typename W> \
115 T(const Z& a, const Y& b, const X& c, const W& d) : a(a), b(b), c(c), d(d) {} \
116 A a; B b; C c; D d; \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000117};
118
119#define RECORD5(T, A, a, B, b, C, c, D, d, E, e) \
120struct T { \
121 static const Type kType = T##_Type; \
mtklein9db912c2015-05-19 11:11:26 -0700122 T() {} \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000123 template <typename Z, typename Y, typename X, typename W, typename V> \
mtkleinc845fa02015-06-30 09:49:49 -0700124 T(const Z& a, const Y& b, const X& c, const W& d, const V& e) \
125 : a(a), b(b), c(c), d(d), e(e) {} \
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000126 A a; B b; C c; D d; E e; \
127};
128
mtkleinc845fa02015-06-30 09:49:49 -0700129#define RECORD8(T, A, a, B, b, C, c, D, d, E, e, F, f, G, g, H, h) \
130struct T { \
131 static const Type kType = T##_Type; \
132 T() {} \
133 template <typename Z, typename Y, typename X, typename W, \
134 typename V, typename U, typename S, typename R> \
135 T(const Z& a, const Y& b, const X& c, const W& d, \
136 const V& e, const U& f, const S& g, const R& h) \
137 : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) {} \
138 A a; B b; C c; D d; E e; F f; G g; H h; \
reed71c3c762015-06-24 10:29:17 -0700139};
mtkleinc845fa02015-06-30 09:49:49 -0700140
mtklein9b222a52014-09-18 11:16:31 -0700141#define ACT_AS_PTR(ptr) \
142 operator T*() const { return ptr; } \
143 T* operator->() const { return ptr; }
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +0000144
mtklein53fecfb2014-08-21 09:11:37 -0700145template <typename T>
146class RefBox : SkNoncopyable {
147public:
mtklein9db912c2015-05-19 11:11:26 -0700148 RefBox() {}
mtklein9b222a52014-09-18 11:16:31 -0700149 RefBox(T* obj) : fObj(SkSafeRef(obj)) {}
150 ~RefBox() { SkSafeUnref(fObj); }
mtklein53fecfb2014-08-21 09:11:37 -0700151
152 ACT_AS_PTR(fObj);
153
154private:
155 T* fObj;
156};
157
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000158// An Optional doesn't own the pointer's memory, but may need to destroy non-POD data.
159template <typename T>
160class Optional : SkNoncopyable {
161public:
mtklein9db912c2015-05-19 11:11:26 -0700162 Optional() : fPtr(nullptr) {}
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000163 Optional(T* ptr) : fPtr(ptr) {}
164 ~Optional() { if (fPtr) fPtr->~T(); }
165
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +0000166 ACT_AS_PTR(fPtr);
167private:
168 T* fPtr;
169};
170
171// Like Optional, but ptr must not be NULL.
172template <typename T>
173class Adopted : SkNoncopyable {
174public:
175 Adopted(T* ptr) : fPtr(ptr) { SkASSERT(fPtr); }
commit-bot@chromium.orgf0ae5e42014-04-24 15:33:48 +0000176 Adopted(Adopted* source) {
177 // Transfer ownership from source to this.
178 fPtr = source->fPtr;
179 source->fPtr = NULL;
180 }
181 ~Adopted() { if (fPtr) fPtr->~T(); }
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +0000182
183 ACT_AS_PTR(fPtr);
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000184private:
185 T* fPtr;
186};
187
188// PODArray doesn't own the pointer's memory, and we assume the data is POD.
189template <typename T>
commit-bot@chromium.orgf0ae5e42014-04-24 15:33:48 +0000190class PODArray {
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000191public:
mtklein9db912c2015-05-19 11:11:26 -0700192 PODArray() {}
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000193 PODArray(T* ptr) : fPtr(ptr) {}
commit-bot@chromium.orgf0ae5e42014-04-24 15:33:48 +0000194 // Default copy and assign.
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000195
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +0000196 ACT_AS_PTR(fPtr);
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000197private:
198 T* fPtr;
199};
200
commit-bot@chromium.org16307bd2014-04-22 18:32:58 +0000201#undef ACT_AS_PTR
202
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000203// Like SkBitmap, but deep copies pixels if they're not immutable.
204// Using this, we guarantee the immutability of all bitmaps we record.
mtkleinf55c3142014-12-11 12:43:04 -0800205class ImmutableBitmap : SkNoncopyable {
206public:
mtklein9db912c2015-05-19 11:11:26 -0700207 ImmutableBitmap() {}
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000208 explicit ImmutableBitmap(const SkBitmap& bitmap) {
209 if (bitmap.isImmutable()) {
mtkleinf55c3142014-12-11 12:43:04 -0800210 fBitmap = bitmap;
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000211 } else {
mtkleinf55c3142014-12-11 12:43:04 -0800212 bitmap.copyTo(&fBitmap);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000213 }
mtkleinf55c3142014-12-11 12:43:04 -0800214 fBitmap.setImmutable();
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000215 }
mtkleinf55c3142014-12-11 12:43:04 -0800216
217 int width() const { return fBitmap.width(); }
218 int height() const { return fBitmap.height(); }
219
220 // While the pixels are immutable, SkBitmap itself is not thread-safe, so return a copy.
221 SkBitmap shallowCopy() const { return fBitmap; }
222private:
223 SkBitmap fBitmap;
mtkleinaf579032014-12-01 11:03:37 -0800224};
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000225
mtkleinaf579032014-12-01 11:03:37 -0800226// SkPath::getBounds() isn't thread safe unless we precache the bounds in a singlethreaded context.
mtklein14ed0fd2015-01-20 13:47:19 -0800227// SkPath::cheapComputeDirection() is similar.
228// Recording is a convenient time to cache these, or we can delay it to between record and playback.
229struct PreCachedPath : public SkPath {
mtklein9db912c2015-05-19 11:11:26 -0700230 PreCachedPath() {}
mtklein14ed0fd2015-01-20 13:47:19 -0800231 explicit PreCachedPath(const SkPath& path) : SkPath(path) {
mtkleinaf579032014-12-01 11:03:37 -0800232 this->updateBoundsCache();
mtklein256cc892015-06-15 12:27:20 -0700233#if 0 // Disabled to see if we ever really race on this. It costs time, chromium:496982.
reed026beb52015-06-10 14:23:15 -0700234 SkPathPriv::FirstDirection junk;
235 (void)SkPathPriv::CheapComputeFirstDirection(*this, &junk);
mtklein256cc892015-06-15 12:27:20 -0700236#endif
mtkleinaf579032014-12-01 11:03:37 -0800237 }
238};
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000239
mtkleinaf579032014-12-01 11:03:37 -0800240// Like SkPath::getBounds(), SkMatrix::getType() isn't thread safe unless we precache it.
241// This may not cover all SkMatrices used by the picture (e.g. some could be hiding in a shader).
242struct TypedMatrix : public SkMatrix {
mtklein9db912c2015-05-19 11:11:26 -0700243 TypedMatrix() {}
mtkleinaf579032014-12-01 11:03:37 -0800244 explicit TypedMatrix(const SkMatrix& matrix) : SkMatrix(matrix) {
245 (void)this->getType();
246 }
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000247};
248
commit-bot@chromium.org88c3e272014-04-22 16:57:20 +0000249RECORD0(NoOp);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000250
mtkleinaf579032014-12-01 11:03:37 -0800251RECORD2(Restore, SkIRect, devBounds, TypedMatrix, matrix);
Florin Malita5f6102d2014-06-30 10:13:28 -0400252RECORD0(Save);
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000253RECORD3(SaveLayer, Optional<SkRect>, bounds, Optional<SkPaint>, paint, SkCanvas::SaveFlags, flags);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000254
mtkleinaf579032014-12-01 11:03:37 -0800255RECORD1(SetMatrix, TypedMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000256
mtkleincdeeb092014-11-20 09:14:28 -0800257struct RegionOpAndAA {
mtklein9db912c2015-05-19 11:11:26 -0700258 RegionOpAndAA() {}
mtkleincdeeb092014-11-20 09:14:28 -0800259 RegionOpAndAA(SkRegion::Op op, bool aa) : op(op), aa(aa) {}
260 SkRegion::Op op : 31; // This really only needs to be 3, but there's no win today to do so.
261 unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned.
262};
263SK_COMPILE_ASSERT(sizeof(RegionOpAndAA) == 4, RegionOpAndAASize);
264
mtklein14ed0fd2015-01-20 13:47:19 -0800265RECORD3(ClipPath, SkIRect, devBounds, PreCachedPath, path, RegionOpAndAA, opAA);
266RECORD3(ClipRRect, SkIRect, devBounds, SkRRect, rrect, RegionOpAndAA, opAA);
267RECORD3(ClipRect, SkIRect, devBounds, SkRect, rect, RegionOpAndAA, opAA);
268RECORD3(ClipRegion, SkIRect, devBounds, SkRegion, region, SkRegion::Op, op);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000269
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000270// While not strictly required, if you have an SkPaint, it's fastest to put it first.
271RECORD4(DrawBitmap, Optional<SkPaint>, paint,
272 ImmutableBitmap, bitmap,
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000273 SkScalar, left,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000274 SkScalar, top);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000275RECORD4(DrawBitmapNine, Optional<SkPaint>, paint,
276 ImmutableBitmap, bitmap,
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000277 SkIRect, center,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000278 SkRect, dst);
mtklein42ddcd42014-11-21 08:48:35 -0800279RECORD4(DrawBitmapRectToRect, Optional<SkPaint>, paint,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000280 ImmutableBitmap, bitmap,
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000281 Optional<SkRect>, src,
mtklein42ddcd42014-11-21 08:48:35 -0800282 SkRect, dst);
283RECORD4(DrawBitmapRectToRectBleed, Optional<SkPaint>, paint,
284 ImmutableBitmap, bitmap,
285 Optional<SkRect>, src,
286 SkRect, dst);
mtklein64b4c782015-07-01 13:56:53 -0700287RECORD5(DrawBitmapRectToRectFixedSize, SkPaint, paint,
288 ImmutableBitmap, bitmap,
289 SkRect, src,
290 SkRect, dst,
291 SkCanvas::DrawBitmapRectFlags, flags);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000292RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner);
reeda8db7282015-07-07 10:22:31 -0700293RECORD3(DrawDrawable, Optional<SkMatrix>, matrix, SkRect, worstCaseBounds, int32_t, index);
piotaixr65151752014-10-16 11:58:39 -0700294RECORD4(DrawImage, Optional<SkPaint>, paint,
295 RefBox<const SkImage>, image,
296 SkScalar, left,
297 SkScalar, top);
298RECORD4(DrawImageRect, Optional<SkPaint>, paint,
299 RefBox<const SkImage>, image,
300 Optional<SkRect>, src,
301 SkRect, dst);
reed4c21dc52015-06-25 12:32:03 -0700302RECORD4(DrawImageNine, Optional<SkPaint>, paint,
303 RefBox<const SkImage>, image,
304 SkIRect, center,
305 SkRect, dst);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000306RECORD2(DrawOval, SkPaint, paint, SkRect, oval);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000307RECORD1(DrawPaint, SkPaint, paint);
mtklein14ed0fd2015-01-20 13:47:19 -0800308RECORD2(DrawPath, SkPaint, paint, PreCachedPath, path);
mtklein53fecfb2014-08-21 09:11:37 -0700309RECORD3(DrawPicture, Optional<SkPaint>, paint,
310 RefBox<const SkPicture>, picture,
mtkleinaf579032014-12-01 11:03:37 -0800311 TypedMatrix, matrix);
mtklein42ddcd42014-11-21 08:48:35 -0800312RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, unsigned, count, SkPoint*, pts);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000313RECORD4(DrawPosText, SkPaint, paint,
314 PODArray<char>, text,
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000315 size_t, byteLength,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000316 PODArray<SkPoint>, pos);
317RECORD5(DrawPosTextH, SkPaint, paint,
318 PODArray<char>, text,
mtklein42ddcd42014-11-21 08:48:35 -0800319 unsigned, byteLength,
320 SkScalar, y,
321 PODArray<SkScalar>, xpos);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000322RECORD2(DrawRRect, SkPaint, paint, SkRRect, rrect);
323RECORD2(DrawRect, SkPaint, paint, SkRect, rect);
324RECORD4(DrawSprite, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, int, left, int, top);
325RECORD5(DrawText, SkPaint, paint,
326 PODArray<char>, text,
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000327 size_t, byteLength,
328 SkScalar, x,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000329 SkScalar, y);
fmalita00d5c2c2014-08-21 08:53:26 -0700330RECORD4(DrawTextBlob, SkPaint, paint,
mtklein53fecfb2014-08-21 09:11:37 -0700331 RefBox<const SkTextBlob>, blob,
fmalita00d5c2c2014-08-21 08:53:26 -0700332 SkScalar, x,
333 SkScalar, y);
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000334RECORD5(DrawTextOnPath, SkPaint, paint,
335 PODArray<char>, text,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000336 size_t, byteLength,
mtklein14ed0fd2015-01-20 13:47:19 -0800337 PreCachedPath, path,
mtkleinaf579032014-12-01 11:03:37 -0800338 TypedMatrix, matrix);
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000339
mtklein9b222a52014-09-18 11:16:31 -0700340RECORD5(DrawPatch, SkPaint, paint,
341 PODArray<SkPoint>, cubics,
342 PODArray<SkColor>, colors,
343 PODArray<SkPoint>, texCoords,
344 RefBox<SkXfermode>, xmode);
345
reed71c3c762015-06-24 10:29:17 -0700346RECORD8(DrawAtlas, Optional<SkPaint>, paint,
347 RefBox<const SkImage>, atlas,
348 PODArray<SkRSXform>, xforms,
349 PODArray<SkRect>, texs,
350 PODArray<SkColor>, colors,
351 int, count,
352 SkXfermode::Mode, mode,
353 Optional<SkRect>, cull);
354
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000355// This guy is so ugly we just write it manually.
356struct DrawVertices {
357 static const Type kType = DrawVertices_Type;
358
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000359 DrawVertices(const SkPaint& paint,
360 SkCanvas::VertexMode vmode,
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000361 int vertexCount,
362 SkPoint* vertices,
363 SkPoint* texs,
364 SkColor* colors,
365 SkXfermode* xmode,
366 uint16_t* indices,
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000367 int indexCount)
368 : paint(paint)
369 , vmode(vmode)
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000370 , vertexCount(vertexCount)
371 , vertices(vertices)
372 , texs(texs)
373 , colors(colors)
374 , xmode(SkSafeRef(xmode))
375 , indices(indices)
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000376 , indexCount(indexCount) {}
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000377
commit-bot@chromium.org37f6e622014-05-07 22:59:38 +0000378 SkPaint paint;
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000379 SkCanvas::VertexMode vmode;
380 int vertexCount;
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000381 PODArray<SkPoint> vertices;
382 PODArray<SkPoint> texs;
383 PODArray<SkColor> colors;
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000384 SkAutoTUnref<SkXfermode> xmode;
commit-bot@chromium.org653d5182014-04-15 14:27:14 +0000385 PODArray<uint16_t> indices;
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000386 int indexCount;
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000387};
mtklein6cfa73a2014-08-13 13:33:49 -0700388
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000389#undef RECORD0
390#undef RECORD1
391#undef RECORD2
392#undef RECORD3
393#undef RECORD4
394#undef RECORD5
reed71c3c762015-06-24 10:29:17 -0700395#undef RECORD8
commit-bot@chromium.orge3ff5582014-04-01 16:24:06 +0000396
397} // namespace SkRecords
398
399#endif//SkRecords_DEFINED