Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: include/core/SkPicture.h

Issue 225283014: Convert SkPicture's generation ID to a unique ID (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 */ 194 */
195 int width() const { return fWidth; } 195 int width() const { return fWidth; }
196 196
197 /** Return the height of the picture's recording canvas. This 197 /** Return the height of the picture's recording canvas. This
198 value reflects what was passed to setSize(), and does not necessarily 198 value reflects what was passed to setSize(), and does not necessarily
199 reflect the bounds of what has been recorded into the picture. 199 reflect the bounds of what has been recorded into the picture.
200 @return the height of the picture's recording canvas 200 @return the height of the picture's recording canvas
201 */ 201 */
202 int height() const { return fHeight; } 202 int height() const { return fHeight; }
203 203
204 static const uint32_t kInvalidGenID = 0;
205
206 /** Return a non-zero, unique value representing the picture. This call is 204 /** Return a non-zero, unique value representing the picture. This call is
207 only valid when not recording. Between a beginRecording/endRecording 205 only valid when not recording. Between a beginRecording/endRecording
208 pair it will just return 0 (the invalid gen ID). Each beginRecording/ 206 pair it will just return 0 (the invalid ID). Each beginRecording/
209 endRecording pair will cause a different generation ID to be returned. 207 endRecording pair will cause a different generation ID to be returned.
210 */ 208 */
211 uint32_t getGenerationID() const; 209 uint32_t uniqueID() const;
212 210
213 /** 211 /**
214 * Function to encode an SkBitmap to an SkData. A function with this 212 * Function to encode an SkBitmap to an SkData. A function with this
215 * signature can be passed to serialize() and SkWriteBuffer. 213 * signature can be passed to serialize() and SkWriteBuffer.
216 * Returning NULL will tell the SkWriteBuffer to use 214 * Returning NULL will tell the SkWriteBuffer to use
217 * SkBitmap::flatten() to store the bitmap. 215 * SkBitmap::flatten() to store the bitmap.
218 * 216 *
219 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0. 217 * @param pixelRefOffset DEPRECATED -- caller assumes it will return 0.
220 * @return SkData If non-NULL, holds encoded data representing the passed 218 * @return SkData If non-NULL, holds encoded data representing the passed
221 * in bitmap. The caller is responsible for calling unref(). 219 * in bitmap. The caller is responsible for calling unref().
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // V21: add pushCull, popCull 299 // V21: add pushCull, popCull
302 // V22: SK_PICT_FACTORY_TAG's size is now the chunk size in bytes 300 // V22: SK_PICT_FACTORY_TAG's size is now the chunk size in bytes
303 301
304 // Note: If the picture version needs to be increased then please follow the 302 // Note: If the picture version needs to be increased then please follow the
305 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw 303 // steps to generate new SKPs in (only accessible to Googlers): http://goo.g l/qATVcw
306 304
307 // Only SKPs within the min/current picture version range (inclusive) can be read. 305 // Only SKPs within the min/current picture version range (inclusive) can be read.
308 static const uint32_t MIN_PICTURE_VERSION = 19; 306 static const uint32_t MIN_PICTURE_VERSION = 19;
309 static const uint32_t CURRENT_PICTURE_VERSION = 22; 307 static const uint32_t CURRENT_PICTURE_VERSION = 22;
310 308
311 mutable uint32_t fGenerationID; 309 mutable uint32_t fUniqueID;
312 310
313 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to 311 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to
314 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed 312 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed
315 // recorders and set the picture size 313 // recorders and set the picture size
316 SkPicturePlayback* fPlayback; 314 SkPicturePlayback* fPlayback;
317 SkPictureRecord* fRecord; 315 SkPictureRecord* fRecord;
318 int fWidth, fHeight; 316 int fWidth, fHeight;
319 const AccelData* fAccelData; 317 const AccelData* fAccelData;
320 318
321 void needsNewGenID() { fGenerationID = kInvalidGenID; } 319 void needsNewGenID() { fUniqueID = SK_InvalidGenID; }
322 320
323 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of 321 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of
324 // playback is unchanged. 322 // playback is unchanged.
325 SkPicture(SkPicturePlayback*, int width, int height); 323 SkPicture(SkPicturePlayback*, int width, int height);
326 324
327 // For testing. Derived classes may instantiate an alternate 325 // For testing. Derived classes may instantiate an alternate
328 // SkBBoxHierarchy implementation 326 // SkBBoxHierarchy implementation
329 virtual SkBBoxHierarchy* createBBoxHierarchy() const; 327 virtual SkBBoxHierarchy* createBBoxHierarchy() const;
330 private: 328 private:
331 // An OperationList encapsulates a set of operation offsets into the picture byte 329 // An OperationList encapsulates a set of operation offsets into the picture byte
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 */ 385 */
388 class SK_API SkDrawPictureCallback { 386 class SK_API SkDrawPictureCallback {
389 public: 387 public:
390 SkDrawPictureCallback() {} 388 SkDrawPictureCallback() {}
391 virtual ~SkDrawPictureCallback() {} 389 virtual ~SkDrawPictureCallback() {}
392 390
393 virtual bool abortDrawing() = 0; 391 virtual bool abortDrawing() = 0;
394 }; 392 };
395 393
396 #endif 394 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698