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 SkPictureRecorder_DEFINED | 8 #ifndef SkPictureRecorder_DEFINED |
9 #define SkPictureRecorder_DEFINED | 9 #define SkPictureRecorder_DEFINED |
10 | 10 |
11 #include "SkBBHFactory.h" | 11 #include "SkBBHFactory.h" |
12 #include "SkPicture.h" | 12 #include "SkPicture.h" |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 | 14 |
15 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 15 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
16 namespace android { | 16 namespace android { |
17 class Picture; | 17 class Picture; |
18 }; | 18 }; |
19 #endif | 19 #endif |
20 | 20 |
21 class SkCanvas; | 21 class SkCanvas; |
22 class SkDrawable; | 22 class SkCanvasDrawable; |
23 class SkPictureRecord; | 23 class SkPictureRecord; |
24 class SkRecord; | 24 class SkRecord; |
25 class SkRecorder; | 25 class SkRecorder; |
26 | 26 |
27 class SK_API SkPictureRecorder : SkNoncopyable { | 27 class SK_API SkPictureRecorder : SkNoncopyable { |
28 public: | 28 public: |
29 SkPictureRecorder(); | 29 SkPictureRecorder(); |
30 ~SkPictureRecorder(); | 30 ~SkPictureRecorder(); |
31 | 31 |
32 enum RecordFlags { | 32 enum RecordFlags { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 /** | 72 /** |
73 * Signal that the caller is done recording. This invalidates the canvas re
turned by | 73 * Signal that the caller is done recording. This invalidates the canvas re
turned by |
74 * beginRecording/getRecordingCanvas. Ownership of the object is passed to
the caller, who | 74 * beginRecording/getRecordingCanvas. Ownership of the object is passed to
the caller, who |
75 * must call unref() when they are done using it. | 75 * must call unref() when they are done using it. |
76 * | 76 * |
77 * Unlike endRecordingAsPicture(), which returns an immutable picture, the
returned drawable | 77 * Unlike endRecordingAsPicture(), which returns an immutable picture, the
returned drawable |
78 * may contain live references to other drawables (if they were added to th
e recording canvas) | 78 * may contain live references to other drawables (if they were added to th
e recording canvas) |
79 * and therefore this drawable will reflect the current state of those nest
ed drawables anytime | 79 * and therefore this drawable will reflect the current state of those nest
ed drawables anytime |
80 * it is drawn or a new picture is snapped from it (by calling drawable->ne
wPictureSnapshot()). | 80 * it is drawn or a new picture is snapped from it (by calling drawable->ne
wPictureSnapshot()). |
81 */ | 81 */ |
82 SkDrawable* endRecordingAsDrawable(); | 82 SkCanvasDrawable* EXPERIMENTAL_endRecordingAsDrawable(); |
83 | 83 |
84 // Legacy API -- use endRecordingAsPicture instead. | 84 // Legacy API -- use endRecordingAsPicture instead. |
85 SkPicture* endRecording() { return this->endRecordingAsPicture(); } | 85 SkPicture* endRecording() { return this->endRecordingAsPicture(); } |
86 | 86 |
87 private: | 87 private: |
88 void reset(); | 88 void reset(); |
89 | 89 |
90 /** Replay the current (partially recorded) operation stream into | 90 /** Replay the current (partially recorded) operation stream into |
91 canvas. This call doesn't close the current recording. | 91 canvas. This call doesn't close the current recording. |
92 */ | 92 */ |
93 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 93 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
94 friend class android::Picture; | 94 friend class android::Picture; |
95 #endif | 95 #endif |
96 friend class SkPictureRecorderReplayTester; // for unit testing | 96 friend class SkPictureRecorderReplayTester; // for unit testing |
97 void partialReplay(SkCanvas* canvas) const; | 97 void partialReplay(SkCanvas* canvas) const; |
98 | 98 |
99 uint32_t fFlags; | 99 uint32_t fFlags; |
100 SkRect fCullRect; | 100 SkRect fCullRect; |
101 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 101 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
102 SkAutoTUnref<SkRecorder> fRecorder; | 102 SkAutoTUnref<SkRecorder> fRecorder; |
103 SkAutoTUnref<SkRecord> fRecord; | 103 SkAutoTUnref<SkRecord> fRecord; |
104 | 104 |
105 typedef SkNoncopyable INHERITED; | 105 typedef SkNoncopyable INHERITED; |
106 }; | 106 }; |
107 | 107 |
108 #endif | 108 #endif |
OLD | NEW |