OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPicture_DEFINED | 10 #ifndef SkPicture_DEFINED |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 */ | 174 */ |
175 void flatten(SkWriteBuffer&) const; | 175 void flatten(SkWriteBuffer&) const; |
176 | 176 |
177 /** | 177 /** |
178 * Returns true if any bitmaps may be produced when this SkPicture | 178 * Returns true if any bitmaps may be produced when this SkPicture |
179 * is replayed. | 179 * is replayed. |
180 * Returns false if called while still recording. | 180 * Returns false if called while still recording. |
181 */ | 181 */ |
182 bool willPlayBackBitmaps() const; | 182 bool willPlayBackBitmaps() const; |
183 | 183 |
184 #ifdef SK_BUILD_FOR_ANDROID | |
185 /** Signals that the caller is prematurely done replaying the drawing | |
186 commands. This can be called from a canvas virtual while the picture | |
187 is drawing. Has no effect if the picture is not drawing. | |
188 @deprecated preserving for legacy purposes | |
189 */ | |
190 void abortPlayback(); | |
191 #endif | |
192 | |
193 /** Return true if the SkStream/Buffer represents a serialized picture, and | 184 /** Return true if the SkStream/Buffer represents a serialized picture, and |
194 fills out SkPictInfo. After this function returns, the data source is no
t | 185 fills out SkPictInfo. After this function returns, the data source is no
t |
195 rewound so it will have to be manually reset before passing to | 186 rewound so it will have to be manually reset before passing to |
196 CreateFromStream or CreateFromBuffer. Note, CreateFromStream and | 187 CreateFromStream or CreateFromBuffer. Note, CreateFromStream and |
197 CreateFromBuffer perform this check internally so these entry points are | 188 CreateFromBuffer perform this check internally so these entry points are |
198 intended for stand alone tools. | 189 intended for stand alone tools. |
199 If false is returned, SkPictInfo is unmodified. | 190 If false is returned, SkPictInfo is unmodified. |
200 */ | 191 */ |
201 static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*); | 192 static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*); |
202 static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*); | 193 static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 private: | 256 private: |
266 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); | 257 static void WriteTagSize(SkWriteBuffer& buffer, uint32_t tag, size_t size); |
267 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); | 258 static void WriteTagSize(SkWStream* stream, uint32_t tag, size_t size); |
268 | 259 |
269 // An OperationList encapsulates a set of operation offsets into the picture
byte | 260 // An OperationList encapsulates a set of operation offsets into the picture
byte |
270 // stream along with the CTMs needed for those operation. | 261 // stream along with the CTMs needed for those operation. |
271 class OperationList : ::SkNoncopyable { | 262 class OperationList : ::SkNoncopyable { |
272 public: | 263 public: |
273 virtual ~OperationList() {} | 264 virtual ~OperationList() {} |
274 | 265 |
275 // If valid returns false then there is no optimization data | |
276 // present. All the draw operations need to be issued. | |
277 virtual bool valid() const { return false; } | |
278 | |
279 // The following three entry points should only be accessed if | 266 // The following three entry points should only be accessed if |
280 // 'valid' returns true. | 267 // 'valid' returns true. |
281 virtual int numOps() const { SkASSERT(false); return 0; }; | 268 virtual int numOps() const { SkASSERT(false); return 0; }; |
282 // The offset in the picture of the operation to execute. | 269 // The offset in the picture of the operation to execute. |
283 virtual uint32_t offset(int index) const { SkASSERT(false); return 0; }; | 270 virtual uint32_t offset(int index) const { SkASSERT(false); return 0; }; |
284 // The CTM that must be installed for the operation to behave correctly | 271 // The CTM that must be installed for the operation to behave correctly |
285 virtual const SkMatrix& matrix(int index) const { SkASSERT(false); retur
n SkMatrix::I(); } | 272 virtual const SkMatrix& matrix(int index) const { SkASSERT(false); retur
n SkMatrix::I(); } |
286 | |
287 static const OperationList& InvalidList(); | |
288 }; | 273 }; |
289 | 274 |
290 /** PRIVATE / EXPERIMENTAL -- do not call | 275 /** PRIVATE / EXPERIMENTAL -- do not call |
291 Return the operations required to render the content inside 'queryRect'. | 276 Return the operations required to render the content inside 'queryRect'. |
292 */ | 277 */ |
293 const OperationList& EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) con
st; | 278 const OperationList* EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) con
st; |
294 | |
295 /** PRIVATE / EXPERIMENTAL -- do not call | |
296 Return the ID of the operation currently being executed when playing | |
297 back. 0 indicates no call is active. | |
298 */ | |
299 size_t EXPERIMENTAL_curOpID() const; | |
300 | 279 |
301 void createHeader(SkPictInfo* info) const; | 280 void createHeader(SkPictInfo* info) const; |
302 static bool IsValidPictInfo(const SkPictInfo& info); | 281 static bool IsValidPictInfo(const SkPictInfo& info); |
303 | 282 |
304 friend class SkFlatPicture; | 283 friend class SkFlatPicture; |
305 friend class SkPictureData; | 284 friend class SkPictureData; |
306 friend class SkPictureRecorder; // just for SkPicture-based constructor | 285 friend class SkPictureRecorder; // just for SkPicture-based constructor |
307 friend class SkGpuDevice; | 286 friend class SkGpuDevice; |
308 friend class GrGatherCanvas; | 287 friend class GrGatherCanvas; |
309 friend class GrGatherDevice; | 288 friend class GrGatherDevice; |
310 friend class SkDebugCanvas; | 289 friend class SkDebugCanvas; |
| 290 friend class SkPicturePlayback; // to get fData |
311 | 291 |
312 typedef SkRefCnt INHERITED; | 292 typedef SkRefCnt INHERITED; |
313 | 293 |
314 SkPicture(int width, int height, SkRecord*); // Takes ownership. | 294 SkPicture(int width, int height, SkRecord*); // Takes ownership. |
315 SkAutoTDelete<SkRecord> fRecord; | 295 SkAutoTDelete<SkRecord> fRecord; |
316 bool fRecordWillPlayBackBitmaps; // TODO: const | 296 bool fRecordWillPlayBackBitmaps; // TODO: const |
317 }; | 297 }; |
318 | 298 |
319 #endif | 299 #endif |
OLD | NEW |