| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkRecords_DEFINED | 8 #ifndef SkRecords_DEFINED |
| 9 #define SkRecords_DEFINED | 9 #define SkRecords_DEFINED |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 #define RECORD5(T, A, a, B, b, C, c, D, d, E, e) \ | 113 #define RECORD5(T, A, a, B, b, C, c, D, d, E, e) \ |
| 114 struct T { \ | 114 struct T { \ |
| 115 static const Type kType = T##_Type; \ | 115 static const Type kType = T##_Type; \ |
| 116 template <typename Z, typename Y, typename X, typename W, typename V> \ | 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) {} \ | 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; \ | 118 A a; B b; C c; D d; E e; \ |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 #define RECORD6(T, A, a, B, b, C, c, D, d, E, e, F, f) \ |
| 122 struct T { \ |
| 123 static const Type kType = T##_Type; \ |
| 124 template <typename Z, typename Y, typename X, typename W, typename V, typena
me U> \ |
| 125 T(Z a, Y b, X c, W d, V e, U f) : a(a), b(b), c(c), d(d), e(e), f(f) {} \ |
| 126 A a; B b; C c; D d; E e; F f; \ |
| 127 }; |
| 128 |
| 121 #define ACT_AS_PTR(ptr) \ | 129 #define ACT_AS_PTR(ptr) \ |
| 122 operator T*() const { return ptr; } \ | 130 operator T*() const { return ptr; } \ |
| 123 T* operator->() const { return ptr; } | 131 T* operator->() const { return ptr; } |
| 124 | 132 |
| 125 template <typename T> | 133 template <typename T> |
| 126 class RefBox : SkNoncopyable { | 134 class RefBox : SkNoncopyable { |
| 127 public: | 135 public: |
| 128 RefBox(T* obj) : fObj(SkSafeRef(obj)) {} | 136 RefBox(T* obj) : fObj(SkSafeRef(obj)) {} |
| 129 ~RefBox() { SkSafeUnref(fObj); } | 137 ~RefBox() { SkSafeUnref(fObj); } |
| 130 | 138 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 RECORD4(DrawSprite, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, int, left
, int, top); | 298 RECORD4(DrawSprite, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, int, left
, int, top); |
| 291 RECORD5(DrawText, SkPaint, paint, | 299 RECORD5(DrawText, SkPaint, paint, |
| 292 PODArray<char>, text, | 300 PODArray<char>, text, |
| 293 size_t, byteLength, | 301 size_t, byteLength, |
| 294 SkScalar, x, | 302 SkScalar, x, |
| 295 SkScalar, y); | 303 SkScalar, y); |
| 296 RECORD4(DrawTextBlob, SkPaint, paint, | 304 RECORD4(DrawTextBlob, SkPaint, paint, |
| 297 RefBox<const SkTextBlob>, blob, | 305 RefBox<const SkTextBlob>, blob, |
| 298 SkScalar, x, | 306 SkScalar, x, |
| 299 SkScalar, y); | 307 SkScalar, y); |
| 300 RECORD5(DrawTextOnPath, SkPaint, paint, | 308 |
| 309 RECORD6(DrawTextOnPath, SkPaint, paint, |
| 301 PODArray<char>, text, | 310 PODArray<char>, text, |
| 302 size_t, byteLength, | 311 size_t, byteLength, |
| 303 PreCachedPath, path, | 312 PreCachedPath, path, |
| 313 SkCanvas::TextOnPathMethod, method, |
| 304 TypedMatrix, matrix); | 314 TypedMatrix, matrix); |
| 305 | 315 |
| 306 RECORD5(DrawPatch, SkPaint, paint, | 316 RECORD5(DrawPatch, SkPaint, paint, |
| 307 PODArray<SkPoint>, cubics, | 317 PODArray<SkPoint>, cubics, |
| 308 PODArray<SkColor>, colors, | 318 PODArray<SkColor>, colors, |
| 309 PODArray<SkPoint>, texCoords, | 319 PODArray<SkPoint>, texCoords, |
| 310 RefBox<SkXfermode>, xmode); | 320 RefBox<SkXfermode>, xmode); |
| 311 | 321 |
| 312 // This guy is so ugly we just write it manually. | 322 // This guy is so ugly we just write it manually. |
| 313 struct DrawVertices { | 323 struct DrawVertices { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 #undef RECORD0 | 356 #undef RECORD0 |
| 347 #undef RECORD1 | 357 #undef RECORD1 |
| 348 #undef RECORD2 | 358 #undef RECORD2 |
| 349 #undef RECORD3 | 359 #undef RECORD3 |
| 350 #undef RECORD4 | 360 #undef RECORD4 |
| 351 #undef RECORD5 | 361 #undef RECORD5 |
| 352 | 362 |
| 353 } // namespace SkRecords | 363 } // namespace SkRecords |
| 354 | 364 |
| 355 #endif//SkRecords_DEFINED | 365 #endif//SkRecords_DEFINED |
| OLD | NEW |