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 "../private/SkMiniRecorder.h" | 11 #include "../private/SkMiniRecorder.h" |
12 #include "SkBBHFactory.h" | 12 #include "SkBBHFactory.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
14 #include "SkRefCnt.h" | 14 #include "SkRefCnt.h" |
15 | 15 |
16 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 16 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
17 namespace android { | 17 namespace android { |
18 class Picture; | 18 class Picture; |
19 }; | 19 }; |
20 #endif | 20 #endif |
21 | 21 |
| 22 class GrContext; |
22 class SkCanvas; | 23 class SkCanvas; |
23 class SkDrawable; | 24 class SkDrawable; |
24 class SkPictureRecord; | 25 class SkPictureRecord; |
25 class SkRecord; | 26 class SkRecord; |
26 class SkRecorder; | 27 class SkRecorder; |
27 | 28 |
28 class SK_API SkPictureRecorder : SkNoncopyable { | 29 class SK_API SkPictureRecorder : SkNoncopyable { |
29 public: | 30 public: |
30 SkPictureRecorder(); | 31 SkPictureRecorder(); |
31 ~SkPictureRecorder(); | 32 ~SkPictureRecorder(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 105 } |
105 SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRec
t) { | 106 SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRec
t) { |
106 return this->finishRecordingAsPictureWithCull(cullRect).release(); | 107 return this->finishRecordingAsPictureWithCull(cullRect).release(); |
107 } | 108 } |
108 SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable() { | 109 SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable() { |
109 return this->finishRecordingAsDrawable().release(); | 110 return this->finishRecordingAsDrawable().release(); |
110 } | 111 } |
111 SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingA
sPicture(); } | 112 SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingA
sPicture(); } |
112 #endif | 113 #endif |
113 | 114 |
| 115 // Strawman API. |
| 116 void optimizeFor(GrContext* ctx) { fGrContextToOptimizeFor = ctx; } |
| 117 |
114 private: | 118 private: |
115 void reset(); | 119 void reset(); |
116 | 120 |
117 /** Replay the current (partially recorded) operation stream into | 121 /** Replay the current (partially recorded) operation stream into |
118 canvas. This call doesn't close the current recording. | 122 canvas. This call doesn't close the current recording. |
119 */ | 123 */ |
120 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 124 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
121 friend class android::Picture; | 125 friend class android::Picture; |
122 #endif | 126 #endif |
123 friend class SkPictureRecorderReplayTester; // for unit testing | 127 friend class SkPictureRecorderReplayTester; // for unit testing |
124 void partialReplay(SkCanvas* canvas) const; | 128 void partialReplay(SkCanvas* canvas) const; |
125 | 129 |
126 bool fActivelyRecording; | 130 bool fActivelyRecording; |
127 uint32_t fFlags; | 131 uint32_t fFlags; |
128 SkRect fCullRect; | 132 SkRect fCullRect; |
129 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 133 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
130 SkAutoTUnref<SkRecorder> fRecorder; | 134 SkAutoTUnref<SkRecorder> fRecorder; |
131 SkAutoTUnref<SkRecord> fRecord; | 135 SkAutoTUnref<SkRecord> fRecord; |
132 SkMiniRecorder fMiniRecorder; | 136 SkMiniRecorder fMiniRecorder; |
133 | 137 |
| 138 GrContext* fGrContextToOptimizeFor = nullptr; |
| 139 |
134 typedef SkNoncopyable INHERITED; | 140 typedef SkNoncopyable INHERITED; |
135 }; | 141 }; |
136 | 142 |
137 #endif | 143 #endif |
OLD | NEW |