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 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkPicture.h" | 12 #include "SkPicture.h" |
13 | 13 |
14 class SkPictureBox { | 14 class SkPictureBox { |
15 public: | 15 public: |
16 SkPictureBox(const SkPicture* obj) : fObj(SkRef(obj)) {} | 16 SkPictureBox(const SkPicture* obj) : fObj(SkRef(obj)) {} |
17 SkPictureBox(const SkPictureBox& src) : fObj(SkRef(src.fObj)) {} | |
18 ~SkPictureBox() { fObj->unref(); } | 17 ~SkPictureBox() { fObj->unref(); } |
19 | 18 |
20 SkPictureBox& operator=(const SkPictureBox& src) { | |
21 SkRefCnt_SafeAssign(fObj, src.fObj); | |
22 return *this; | |
23 } | |
24 | |
25 operator const SkPicture*() const { return fObj; } | 19 operator const SkPicture*() const { return fObj; } |
26 | 20 |
27 private: | 21 private: |
| 22 SkPictureBox(const SkPictureBox&); |
| 23 SkPictureBox& operator=(const SkPictureBox&); |
| 24 |
28 const SkPicture* fObj; | 25 const SkPicture* fObj; |
29 }; | 26 }; |
30 | 27 |
31 namespace SkRecords { | 28 namespace SkRecords { |
32 | 29 |
33 // A list of all the types of canvas calls we can record. | 30 // A list of all the types of canvas calls we can record. |
34 // Each of these is reified into a struct below. | 31 // Each of these is reified into a struct below. |
35 // | 32 // |
36 // (We're using the macro-of-macro trick here to do several different things wit
h the same list.) | 33 // (We're using the macro-of-macro trick here to do several different things wit
h the same list.) |
37 // | 34 // |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 RECORD5(DrawBitmapRectToRect, Optional<SkPaint>, paint, | 226 RECORD5(DrawBitmapRectToRect, Optional<SkPaint>, paint, |
230 ImmutableBitmap, bitmap, | 227 ImmutableBitmap, bitmap, |
231 Optional<SkRect>, src, | 228 Optional<SkRect>, src, |
232 SkRect, dst, | 229 SkRect, dst, |
233 SkCanvas::DrawBitmapRectFlags, flags); | 230 SkCanvas::DrawBitmapRectFlags, flags); |
234 RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner); | 231 RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner); |
235 RECORD2(DrawOval, SkPaint, paint, SkRect, oval); | 232 RECORD2(DrawOval, SkPaint, paint, SkRect, oval); |
236 RECORD1(DrawPaint, SkPaint, paint); | 233 RECORD1(DrawPaint, SkPaint, paint); |
237 RECORD2(DrawPath, SkPaint, paint, SkPath, path); | 234 RECORD2(DrawPath, SkPaint, paint, SkPath, path); |
238 RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch); | 235 RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch); |
239 RECORD1(DrawPicture, SkPictureBox, picture); | 236 RECORD3(DrawPicture, Optional<SkPaint>, paint, SkPictureBox, picture, Optional<S
kMatrix>, matrix); |
240 RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, Sk
Point*, pts); | 237 RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, Sk
Point*, pts); |
241 RECORD4(DrawPosText, SkPaint, paint, | 238 RECORD4(DrawPosText, SkPaint, paint, |
242 PODArray<char>, text, | 239 PODArray<char>, text, |
243 size_t, byteLength, | 240 size_t, byteLength, |
244 PODArray<SkPoint>, pos); | 241 PODArray<SkPoint>, pos); |
245 RECORD5(DrawPosTextH, SkPaint, paint, | 242 RECORD5(DrawPosTextH, SkPaint, paint, |
246 PODArray<char>, text, | 243 PODArray<char>, text, |
247 size_t, byteLength, | 244 size_t, byteLength, |
248 PODArray<SkScalar>, xpos, | 245 PODArray<SkScalar>, xpos, |
249 SkScalar, y); | 246 SkScalar, y); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 #undef RECORD0 | 295 #undef RECORD0 |
299 #undef RECORD1 | 296 #undef RECORD1 |
300 #undef RECORD2 | 297 #undef RECORD2 |
301 #undef RECORD3 | 298 #undef RECORD3 |
302 #undef RECORD4 | 299 #undef RECORD4 |
303 #undef RECORD5 | 300 #undef RECORD5 |
304 | 301 |
305 } // namespace SkRecords | 302 } // namespace SkRecords |
306 | 303 |
307 #endif//SkRecords_DEFINED | 304 #endif//SkRecords_DEFINED |
OLD | NEW |