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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 /** | 60 /** |
61 * Signal that the caller is done recording. This invalidates the canvas re
turned by | 61 * Signal that the caller is done recording. This invalidates the canvas re
turned by |
62 * beginRecording/getRecordingCanvas. Ownership of the object is passed to
the caller, who | 62 * beginRecording/getRecordingCanvas. Ownership of the object is passed to
the caller, who |
63 * must call unref() when they are done using it. | 63 * must call unref() when they are done using it. |
64 * | 64 * |
65 * The returned picture is immutable. If during recording drawables were ad
ded to the canvas, | 65 * The returned picture is immutable. If during recording drawables were ad
ded to the canvas, |
66 * these will have been "drawn" into a recording canvas, so that this resul
ting picture will | 66 * these will have been "drawn" into a recording canvas, so that this resul
ting picture will |
67 * reflect their current state, but will not contain a live reference to th
e drawables | 67 * reflect their current state, but will not contain a live reference to th
e drawables |
68 * themselves. | 68 * themselves. |
69 */ | 69 */ |
70 SkPicture* endRecordingAsPicture(); | 70 SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(); |
71 | 71 |
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 SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable(); |
83 | 83 |
84 // Legacy API -- use endRecordingAsPicture instead. | 84 // Legacy API -- use endRecordingAsPicture instead. |
85 SkPicture* endRecording() { return this->endRecordingAsPicture(); } | 85 SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingA
sPicture(); } |
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 bool fActivelyRecording; | 99 bool fActivelyRecording; |
100 uint32_t fFlags; | 100 uint32_t fFlags; |
101 SkRect fCullRect; | 101 SkRect fCullRect; |
102 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 102 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
103 SkAutoTUnref<SkRecorder> fRecorder; | 103 SkAutoTUnref<SkRecorder> fRecorder; |
104 SkAutoTUnref<SkRecord> fRecord; | 104 SkAutoTUnref<SkRecord> fRecord; |
105 | 105 |
106 typedef SkNoncopyable INHERITED; | 106 typedef SkNoncopyable INHERITED; |
107 }; | 107 }; |
108 | 108 |
109 #endif | 109 #endif |
OLD | NEW |