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 29 matching lines...) Expand all Loading... | |
40 // types polymorphically. (See SkRecord::Record::{visit,mutate} for an example. ) | 40 // types polymorphically. (See SkRecord::Record::{visit,mutate} for an example. ) |
41 // | 41 // |
42 // Order doesn't technically matter here, but the compiler can generally generat e better code if | 42 // Order doesn't technically matter here, but the compiler can generally generat e better code if |
43 // you keep them semantically grouped, especially the Draws. It's also nice to leave NoOp at 0. | 43 // you keep them semantically grouped, especially the Draws. It's also nice to leave NoOp at 0. |
44 #define SK_RECORD_TYPES(M) \ | 44 #define SK_RECORD_TYPES(M) \ |
45 M(NoOp) \ | 45 M(NoOp) \ |
46 M(Restore) \ | 46 M(Restore) \ |
47 M(Save) \ | 47 M(Save) \ |
48 M(SaveLayer) \ | 48 M(SaveLayer) \ |
49 M(SetMatrix) \ | 49 M(SetMatrix) \ |
50 M(SetZ) \ | |
50 M(Concat) \ | 51 M(Concat) \ |
51 M(ClipPath) \ | 52 M(ClipPath) \ |
52 M(ClipRRect) \ | 53 M(ClipRRect) \ |
53 M(ClipRect) \ | 54 M(ClipRect) \ |
54 M(ClipRegion) \ | 55 M(ClipRegion) \ |
55 M(DrawBitmap) \ | 56 M(DrawBitmap) \ |
56 M(DrawBitmapNine) \ | 57 M(DrawBitmapNine) \ |
57 M(DrawBitmapRect) \ | 58 M(DrawBitmapRect) \ |
58 M(DrawBitmapRectFast) \ | 59 M(DrawBitmapRectFast) \ |
59 M(DrawBitmapRectFixedSize) \ | 60 M(DrawBitmapRectFixedSize) \ |
(...skipping 12 matching lines...) Expand all Loading... | |
72 M(DrawPosTextH) \ | 73 M(DrawPosTextH) \ |
73 M(DrawText) \ | 74 M(DrawText) \ |
74 M(DrawTextOnPath) \ | 75 M(DrawTextOnPath) \ |
75 M(DrawRRect) \ | 76 M(DrawRRect) \ |
76 M(DrawRect) \ | 77 M(DrawRect) \ |
77 M(DrawTextBlob) \ | 78 M(DrawTextBlob) \ |
78 M(DrawAtlas) \ | 79 M(DrawAtlas) \ |
79 M(DrawVertices) \ | 80 M(DrawVertices) \ |
80 M(DrawAnnotation) | 81 M(DrawAnnotation) |
81 | 82 |
83 // setZ is Victor | |
jvanverth1
2016/07/07 18:43:02
Remove this comment?
vjiaoblack
2016/07/07 19:04:10
Done.
| |
84 | |
82 // Defines SkRecords::Type, an enum of all record types. | 85 // Defines SkRecords::Type, an enum of all record types. |
83 #define ENUM(T) T##_Type, | 86 #define ENUM(T) T##_Type, |
84 enum Type { SK_RECORD_TYPES(ENUM) }; | 87 enum Type { SK_RECORD_TYPES(ENUM) }; |
85 #undef ENUM | 88 #undef ENUM |
86 | 89 |
87 #define ACT_AS_PTR(ptr) \ | 90 #define ACT_AS_PTR(ptr) \ |
88 operator T*() const { return ptr; } \ | 91 operator T*() const { return ptr; } \ |
89 T* operator->() const { return ptr; } | 92 T* operator->() const { return ptr; } |
90 | 93 |
91 template <typename T> | 94 template <typename T> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 Optional<SkRect> bounds; | 213 Optional<SkRect> bounds; |
211 Optional<SkPaint> paint; | 214 Optional<SkPaint> paint; |
212 RefBox<const SkImageFilter> backdrop; | 215 RefBox<const SkImageFilter> backdrop; |
213 SkCanvas::SaveLayerFlags saveLayerFlags); | 216 SkCanvas::SaveLayerFlags saveLayerFlags); |
214 | 217 |
215 RECORD(SetMatrix, 0, | 218 RECORD(SetMatrix, 0, |
216 TypedMatrix matrix); | 219 TypedMatrix matrix); |
217 RECORD(Concat, 0, | 220 RECORD(Concat, 0, |
218 TypedMatrix matrix); | 221 TypedMatrix matrix); |
219 | 222 |
223 // TEST_VICTOR | |
jvanverth1
2016/07/07 18:43:02
Remove this comment?
| |
224 RECORD(SetZ, 0, uint32_t z); | |
225 | |
220 struct RegionOpAndAA { | 226 struct RegionOpAndAA { |
221 RegionOpAndAA() {} | 227 RegionOpAndAA() {} |
222 RegionOpAndAA(SkRegion::Op op, bool aa) : op(op), aa(aa) {} | 228 RegionOpAndAA(SkRegion::Op op, bool aa) : op(op), aa(aa) {} |
223 SkRegion::Op op : 31; // This really only needs to be 3, but there's no win today to do so. | 229 SkRegion::Op op : 31; // This really only needs to be 3, but there's no win today to do so. |
224 unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call t his an unsigned. | 230 unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call t his an unsigned. |
225 }; | 231 }; |
226 static_assert(sizeof(RegionOpAndAA) == 4, "RegionOpAndAASize"); | 232 static_assert(sizeof(RegionOpAndAA) == 4, "RegionOpAndAASize"); |
227 | 233 |
228 RECORD(ClipPath, 0, | 234 RECORD(ClipPath, 0, |
229 SkIRect devBounds; | 235 SkIRect devBounds; |
(...skipping 11 matching lines...) Expand all Loading... | |
241 SkIRect devBounds; | 247 SkIRect devBounds; |
242 SkRegion region; | 248 SkRegion region; |
243 SkRegion::Op op); | 249 SkRegion::Op op); |
244 | 250 |
245 // While not strictly required, if you have an SkPaint, it's fastest to put it f irst. | 251 // While not strictly required, if you have an SkPaint, it's fastest to put it f irst. |
246 RECORD(DrawBitmap, kDraw_Tag|kHasImage_Tag, | 252 RECORD(DrawBitmap, kDraw_Tag|kHasImage_Tag, |
247 Optional<SkPaint> paint; | 253 Optional<SkPaint> paint; |
248 ImmutableBitmap bitmap; | 254 ImmutableBitmap bitmap; |
249 SkScalar left; | 255 SkScalar left; |
250 SkScalar top); | 256 SkScalar top); |
257 //uint8_t zLevel); | |
jvanverth1
2016/07/07 18:43:02
Is this needed?
| |
251 RECORD(DrawBitmapNine, kDraw_Tag|kHasImage_Tag, | 258 RECORD(DrawBitmapNine, kDraw_Tag|kHasImage_Tag, |
252 Optional<SkPaint> paint; | 259 Optional<SkPaint> paint; |
253 ImmutableBitmap bitmap; | 260 ImmutableBitmap bitmap; |
254 SkIRect center; | 261 SkIRect center; |
255 SkRect dst); | 262 SkRect dst); |
256 RECORD(DrawBitmapRect, kDraw_Tag|kHasImage_Tag, | 263 RECORD(DrawBitmapRect, kDraw_Tag|kHasImage_Tag, |
257 Optional<SkPaint> paint; | 264 Optional<SkPaint> paint; |
258 ImmutableBitmap bitmap; | 265 ImmutableBitmap bitmap; |
259 Optional<SkRect> src; | 266 Optional<SkRect> src; |
260 SkRect dst); | 267 SkRect dst); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 int indexCount); | 378 int indexCount); |
372 RECORD(DrawAnnotation, 0, | 379 RECORD(DrawAnnotation, 0, |
373 SkRect rect; | 380 SkRect rect; |
374 SkString key; | 381 SkString key; |
375 RefBox<SkData> value); | 382 RefBox<SkData> value); |
376 #undef RECORD | 383 #undef RECORD |
377 | 384 |
378 } // namespace SkRecords | 385 } // namespace SkRecords |
379 | 386 |
380 #endif//SkRecords_DEFINED | 387 #endif//SkRecords_DEFINED |
OLD | NEW |