commit-bot@chromium.org | c4b21e6 | 2014-04-11 18:33:31 +0000 | [diff] [blame] | 1 | /* |
| 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.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 8 | #ifndef SkRecords_DEFINED |
| 9 | #define SkRecords_DEFINED |
| 10 | |
| 11 | #include "SkCanvas.h" |
reed | 2347b62 | 2014-08-07 12:19:50 -0700 | [diff] [blame] | 12 | #include "SkPicture.h" |
fmalita | 00d5c2c | 2014-08-21 08:53:26 -0700 | [diff] [blame] | 13 | #include "SkTextBlob.h" |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 14 | |
| 15 | namespace SkRecords { |
| 16 | |
| 17 | // A list of all the types of canvas calls we can record. |
| 18 | // Each of these is reified into a struct below. |
| 19 | // |
| 20 | // (We're using the macro-of-macro trick here to do several different things with the same list.) |
| 21 | // |
| 22 | // We leave this SK_RECORD_TYPES macro defined for use by code that wants to operate on SkRecords |
| 23 | // types polymorphically. (See SkRecord::Record::{visit,mutate} for an example.) |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 24 | // |
| 25 | // Order doesn't technically matter here, but the compiler can generally generate better code if |
| 26 | // you keep them semantically grouped, especially the Draws. It's also nice to leave NoOp at 0. |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 27 | #define SK_RECORD_TYPES(M) \ |
| 28 | M(NoOp) \ |
| 29 | M(Restore) \ |
| 30 | M(Save) \ |
| 31 | M(SaveLayer) \ |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 32 | M(PushCull) \ |
| 33 | M(PopCull) \ |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 34 | M(SetMatrix) \ |
| 35 | M(ClipPath) \ |
| 36 | M(ClipRRect) \ |
| 37 | M(ClipRect) \ |
| 38 | M(ClipRegion) \ |
| 39 | M(Clear) \ |
mtklein | 5f0e822 | 2014-08-22 11:44:26 -0700 | [diff] [blame] | 40 | M(BeginCommentGroup) \ |
| 41 | M(AddComment) \ |
| 42 | M(EndCommentGroup) \ |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 43 | M(DrawBitmap) \ |
| 44 | M(DrawBitmapMatrix) \ |
| 45 | M(DrawBitmapNine) \ |
| 46 | M(DrawBitmapRectToRect) \ |
| 47 | M(DrawDRRect) \ |
| 48 | M(DrawOval) \ |
| 49 | M(DrawPaint) \ |
| 50 | M(DrawPath) \ |
dandov | 963137b | 2014-08-07 07:49:53 -0700 | [diff] [blame] | 51 | M(DrawPatch) \ |
reed | 2347b62 | 2014-08-07 12:19:50 -0700 | [diff] [blame] | 52 | M(DrawPicture) \ |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 53 | M(DrawPoints) \ |
| 54 | M(DrawPosText) \ |
| 55 | M(DrawPosTextH) \ |
mtklein | c551d9f | 2014-08-20 08:09:46 -0700 | [diff] [blame] | 56 | M(DrawText) \ |
| 57 | M(DrawTextOnPath) \ |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 58 | M(DrawRRect) \ |
| 59 | M(DrawRect) \ |
| 60 | M(DrawSprite) \ |
mtklein | 29dfaa8 | 2014-09-04 14:12:44 -0700 | [diff] [blame^] | 61 | M(DrawTextBlob) \ |
| 62 | M(DrawData) \ |
mtklein | f4078ad | 2014-08-08 10:05:19 -0700 | [diff] [blame] | 63 | M(DrawVertices) |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 64 | |
| 65 | // Defines SkRecords::Type, an enum of all record types. |
| 66 | #define ENUM(T) T##_Type, |
| 67 | enum Type { SK_RECORD_TYPES(ENUM) }; |
| 68 | #undef ENUM |
| 69 | |
| 70 | // Macros to make it easier to define a record for a draw call with 0 args, 1 args, 2 args, etc. |
| 71 | // These should be clearer when you look at their use below. |
| 72 | #define RECORD0(T) \ |
| 73 | struct T { \ |
| 74 | static const Type kType = T##_Type; \ |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | // We try to be flexible about the types the constructors take. Instead of requring the exact type |
| 78 | // A here, we take any type Z which implicitly casts to A. This allows the delay_copy() trick to |
| 79 | // work, allowing the caller to decide whether to pass by value or by const&. |
| 80 | |
| 81 | #define RECORD1(T, A, a) \ |
| 82 | struct T { \ |
| 83 | static const Type kType = T##_Type; \ |
| 84 | template <typename Z> \ |
| 85 | T(Z a) : a(a) {} \ |
| 86 | A a; \ |
| 87 | }; |
| 88 | |
| 89 | #define RECORD2(T, A, a, B, b) \ |
| 90 | struct T { \ |
| 91 | static const Type kType = T##_Type; \ |
| 92 | template <typename Z, typename Y> \ |
| 93 | T(Z a, Y b) : a(a), b(b) {} \ |
| 94 | A a; B b; \ |
| 95 | }; |
| 96 | |
| 97 | #define RECORD3(T, A, a, B, b, C, c) \ |
| 98 | struct T { \ |
| 99 | static const Type kType = T##_Type; \ |
| 100 | template <typename Z, typename Y, typename X> \ |
| 101 | T(Z a, Y b, X c) : a(a), b(b), c(c) {} \ |
| 102 | A a; B b; C c; \ |
| 103 | }; |
| 104 | |
| 105 | #define RECORD4(T, A, a, B, b, C, c, D, d) \ |
| 106 | struct T { \ |
| 107 | static const Type kType = T##_Type; \ |
| 108 | template <typename Z, typename Y, typename X, typename W> \ |
| 109 | T(Z a, Y b, X c, W d) : a(a), b(b), c(c), d(d) {} \ |
| 110 | A a; B b; C c; D d; \ |
| 111 | }; |
| 112 | |
| 113 | #define RECORD5(T, A, a, B, b, C, c, D, d, E, e) \ |
| 114 | struct T { \ |
| 115 | static const Type kType = T##_Type; \ |
| 116 | template <typename Z, typename Y, typename X, typename W, typename V> \ |
| 117 | T(Z a, Y b, X c, W d, V e) : a(a), b(b), c(c), d(d), e(e) {} \ |
| 118 | A a; B b; C c; D d; E e; \ |
| 119 | }; |
| 120 | |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 121 | #define ACT_AS_PTR(ptr) \ |
| 122 | operator T*() { return ptr; } \ |
| 123 | operator const T*() const { return ptr; } \ |
| 124 | T* operator->() { return ptr; } \ |
| 125 | const T* operator->() const { return ptr; } |
| 126 | |
mtklein | 53fecfb | 2014-08-21 09:11:37 -0700 | [diff] [blame] | 127 | template <typename T> |
| 128 | class RefBox : SkNoncopyable { |
| 129 | public: |
| 130 | RefBox(T* obj) : fObj(SkRef(obj)) {} |
| 131 | ~RefBox() { fObj->unref(); } |
| 132 | |
| 133 | ACT_AS_PTR(fObj); |
| 134 | |
| 135 | private: |
| 136 | T* fObj; |
| 137 | }; |
| 138 | |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 139 | // An Optional doesn't own the pointer's memory, but may need to destroy non-POD data. |
| 140 | template <typename T> |
| 141 | class Optional : SkNoncopyable { |
| 142 | public: |
| 143 | Optional(T* ptr) : fPtr(ptr) {} |
| 144 | ~Optional() { if (fPtr) fPtr->~T(); } |
| 145 | |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 146 | ACT_AS_PTR(fPtr); |
| 147 | private: |
| 148 | T* fPtr; |
| 149 | }; |
| 150 | |
| 151 | // Like Optional, but ptr must not be NULL. |
| 152 | template <typename T> |
| 153 | class Adopted : SkNoncopyable { |
| 154 | public: |
| 155 | Adopted(T* ptr) : fPtr(ptr) { SkASSERT(fPtr); } |
commit-bot@chromium.org | f0ae5e4 | 2014-04-24 15:33:48 +0000 | [diff] [blame] | 156 | Adopted(Adopted* source) { |
| 157 | // Transfer ownership from source to this. |
| 158 | fPtr = source->fPtr; |
| 159 | source->fPtr = NULL; |
| 160 | } |
| 161 | ~Adopted() { if (fPtr) fPtr->~T(); } |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 162 | |
| 163 | ACT_AS_PTR(fPtr); |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 164 | private: |
| 165 | T* fPtr; |
| 166 | }; |
| 167 | |
| 168 | // PODArray doesn't own the pointer's memory, and we assume the data is POD. |
| 169 | template <typename T> |
commit-bot@chromium.org | f0ae5e4 | 2014-04-24 15:33:48 +0000 | [diff] [blame] | 170 | class PODArray { |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 171 | public: |
| 172 | PODArray(T* ptr) : fPtr(ptr) {} |
commit-bot@chromium.org | f0ae5e4 | 2014-04-24 15:33:48 +0000 | [diff] [blame] | 173 | // Default copy and assign. |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 174 | |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 175 | ACT_AS_PTR(fPtr); |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 176 | private: |
| 177 | T* fPtr; |
| 178 | }; |
| 179 | |
commit-bot@chromium.org | 16307bd | 2014-04-22 18:32:58 +0000 | [diff] [blame] | 180 | #undef ACT_AS_PTR |
| 181 | |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 182 | // Like SkBitmap, but deep copies pixels if they're not immutable. |
| 183 | // Using this, we guarantee the immutability of all bitmaps we record. |
mtklein | ee36952 | 2014-08-27 13:02:24 -0700 | [diff] [blame] | 184 | class ImmutableBitmap : SkNoncopyable { |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 185 | public: |
| 186 | explicit ImmutableBitmap(const SkBitmap& bitmap) { |
| 187 | if (bitmap.isImmutable()) { |
| 188 | fBitmap = bitmap; |
| 189 | } else { |
| 190 | bitmap.copyTo(&fBitmap); |
| 191 | } |
| 192 | fBitmap.setImmutable(); |
| 193 | } |
| 194 | |
| 195 | operator const SkBitmap& () const { return fBitmap; } |
| 196 | |
| 197 | private: |
| 198 | SkBitmap fBitmap; |
| 199 | }; |
| 200 | |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 201 | RECORD0(NoOp); |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 202 | |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 203 | RECORD2(Restore, SkIRect, devBounds, SkMatrix, matrix); |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 204 | RECORD0(Save); |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 205 | RECORD3(SaveLayer, Optional<SkRect>, bounds, Optional<SkPaint>, paint, SkCanvas::SaveFlags, flags); |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 206 | |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 207 | RECORD1(PushCull, SkRect, rect); |
commit-bot@chromium.org | 03a99b8 | 2014-04-08 15:17:17 +0000 | [diff] [blame] | 208 | RECORD0(PopCull); |
| 209 | |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 210 | RECORD1(SetMatrix, SkMatrix, matrix); |
| 211 | |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 212 | RECORD4(ClipPath, SkIRect, devBounds, SkPath, path, SkRegion::Op, op, bool, doAA); |
| 213 | RECORD4(ClipRRect, SkIRect, devBounds, SkRRect, rrect, SkRegion::Op, op, bool, doAA); |
| 214 | RECORD4(ClipRect, SkIRect, devBounds, SkRect, rect, SkRegion::Op, op, bool, doAA); |
| 215 | RECORD3(ClipRegion, SkIRect, devBounds, SkRegion, region, SkRegion::Op, op); |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 216 | |
| 217 | RECORD1(Clear, SkColor, color); |
mtklein | 5f0e822 | 2014-08-22 11:44:26 -0700 | [diff] [blame] | 218 | |
| 219 | RECORD1(BeginCommentGroup, PODArray<char>, description); |
| 220 | RECORD2(AddComment, PODArray<char>, key, PODArray<char>, value); |
| 221 | RECORD0(EndCommentGroup); |
| 222 | |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 223 | // While not strictly required, if you have an SkPaint, it's fastest to put it first. |
| 224 | RECORD4(DrawBitmap, Optional<SkPaint>, paint, |
| 225 | ImmutableBitmap, bitmap, |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 226 | SkScalar, left, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 227 | SkScalar, top); |
| 228 | RECORD3(DrawBitmapMatrix, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, SkMatrix, matrix); |
| 229 | RECORD4(DrawBitmapNine, Optional<SkPaint>, paint, |
| 230 | ImmutableBitmap, bitmap, |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 231 | SkIRect, center, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 232 | SkRect, dst); |
| 233 | RECORD5(DrawBitmapRectToRect, Optional<SkPaint>, paint, |
| 234 | ImmutableBitmap, bitmap, |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 235 | Optional<SkRect>, src, |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 236 | SkRect, dst, |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 237 | SkCanvas::DrawBitmapRectFlags, flags); |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 238 | RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner); |
| 239 | RECORD2(DrawOval, SkPaint, paint, SkRect, oval); |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 240 | RECORD1(DrawPaint, SkPaint, paint); |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 241 | RECORD2(DrawPath, SkPaint, paint, SkPath, path); |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 242 | //RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch); |
mtklein | 53fecfb | 2014-08-21 09:11:37 -0700 | [diff] [blame] | 243 | RECORD3(DrawPicture, Optional<SkPaint>, paint, |
| 244 | RefBox<const SkPicture>, picture, |
| 245 | Optional<SkMatrix>, matrix); |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 246 | RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, SkPoint*, pts); |
| 247 | RECORD4(DrawPosText, SkPaint, paint, |
| 248 | PODArray<char>, text, |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 249 | size_t, byteLength, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 250 | PODArray<SkPoint>, pos); |
| 251 | RECORD5(DrawPosTextH, SkPaint, paint, |
| 252 | PODArray<char>, text, |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 253 | size_t, byteLength, |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 254 | PODArray<SkScalar>, xpos, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 255 | SkScalar, y); |
| 256 | RECORD2(DrawRRect, SkPaint, paint, SkRRect, rrect); |
| 257 | RECORD2(DrawRect, SkPaint, paint, SkRect, rect); |
| 258 | RECORD4(DrawSprite, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, int, left, int, top); |
| 259 | RECORD5(DrawText, SkPaint, paint, |
| 260 | PODArray<char>, text, |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 261 | size_t, byteLength, |
| 262 | SkScalar, x, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 263 | SkScalar, y); |
fmalita | 00d5c2c | 2014-08-21 08:53:26 -0700 | [diff] [blame] | 264 | RECORD4(DrawTextBlob, SkPaint, paint, |
mtklein | 53fecfb | 2014-08-21 09:11:37 -0700 | [diff] [blame] | 265 | RefBox<const SkTextBlob>, blob, |
fmalita | 00d5c2c | 2014-08-21 08:53:26 -0700 | [diff] [blame] | 266 | SkScalar, x, |
| 267 | SkScalar, y); |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 268 | RECORD5(DrawTextOnPath, SkPaint, paint, |
| 269 | PODArray<char>, text, |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 270 | size_t, byteLength, |
| 271 | SkPath, path, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 272 | Optional<SkMatrix>, matrix); |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 273 | |
mtklein | 29dfaa8 | 2014-09-04 14:12:44 -0700 | [diff] [blame^] | 274 | RECORD2(DrawData, PODArray<char>, data, size_t, length); |
| 275 | |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 276 | // This guy is so ugly we just write it manually. |
| 277 | struct DrawVertices { |
| 278 | static const Type kType = DrawVertices_Type; |
| 279 | |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 280 | DrawVertices(const SkPaint& paint, |
| 281 | SkCanvas::VertexMode vmode, |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 282 | int vertexCount, |
| 283 | SkPoint* vertices, |
| 284 | SkPoint* texs, |
| 285 | SkColor* colors, |
| 286 | SkXfermode* xmode, |
| 287 | uint16_t* indices, |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 288 | int indexCount) |
| 289 | : paint(paint) |
| 290 | , vmode(vmode) |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 291 | , vertexCount(vertexCount) |
| 292 | , vertices(vertices) |
| 293 | , texs(texs) |
| 294 | , colors(colors) |
| 295 | , xmode(SkSafeRef(xmode)) |
| 296 | , indices(indices) |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 297 | , indexCount(indexCount) {} |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 298 | |
commit-bot@chromium.org | 37f6e62 | 2014-05-07 22:59:38 +0000 | [diff] [blame] | 299 | SkPaint paint; |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 300 | SkCanvas::VertexMode vmode; |
| 301 | int vertexCount; |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 302 | PODArray<SkPoint> vertices; |
| 303 | PODArray<SkPoint> texs; |
| 304 | PODArray<SkColor> colors; |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 305 | SkAutoTUnref<SkXfermode> xmode; |
commit-bot@chromium.org | 653d518 | 2014-04-15 14:27:14 +0000 | [diff] [blame] | 306 | PODArray<uint16_t> indices; |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 307 | int indexCount; |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 308 | }; |
mtklein | 6cfa73a | 2014-08-13 13:33:49 -0700 | [diff] [blame] | 309 | |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 310 | struct DrawPatch { |
| 311 | static const Type kType = DrawPatch_Type; |
mtklein | 6cfa73a | 2014-08-13 13:33:49 -0700 | [diff] [blame] | 312 | |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 313 | DrawPatch(const SkPaint& paint, SkPoint cubics[12], SkColor colors[4], |
| 314 | SkPoint texCoords[4], SkXfermode* xmode) |
| 315 | : paint(paint) |
| 316 | , cubics(cubics) |
| 317 | , colors(colors) |
| 318 | , texCoords(texCoords) |
| 319 | , xmode(SkSafeRef(xmode)) { } |
mtklein | 6cfa73a | 2014-08-13 13:33:49 -0700 | [diff] [blame] | 320 | |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 321 | SkPaint paint; |
| 322 | PODArray<SkPoint> cubics; |
| 323 | PODArray<SkColor> colors; |
| 324 | PODArray<SkPoint> texCoords; |
| 325 | SkAutoTUnref<SkXfermode> xmode; |
| 326 | }; |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 327 | |
commit-bot@chromium.org | e3ff558 | 2014-04-01 16:24:06 +0000 | [diff] [blame] | 328 | #undef RECORD0 |
| 329 | #undef RECORD1 |
| 330 | #undef RECORD2 |
| 331 | #undef RECORD3 |
| 332 | #undef RECORD4 |
| 333 | #undef RECORD5 |
| 334 | |
| 335 | } // namespace SkRecords |
| 336 | |
| 337 | #endif//SkRecords_DEFINED |