OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 SkPixelRef_DEFINED | 8 #ifndef SkPixelRef_DEFINED |
9 #define SkPixelRef_DEFINED | 9 #define SkPixelRef_DEFINED |
10 | 10 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 * | 313 * |
314 * @return default impl returns 0. | 314 * @return default impl returns 0. |
315 */ | 315 */ |
316 virtual size_t getAllocatedSizeInBytes() const; | 316 virtual size_t getAllocatedSizeInBytes() const; |
317 | 317 |
318 /** Return the mutex associated with this pixelref. This value is assigned | 318 /** Return the mutex associated with this pixelref. This value is assigned |
319 in the constructor, and cannot change during the lifetime of the object. | 319 in the constructor, and cannot change during the lifetime of the object. |
320 */ | 320 */ |
321 SkBaseMutex* mutex() const { return fMutex; } | 321 SkBaseMutex* mutex() const { return fMutex; } |
322 | 322 |
323 // serialization | |
324 SkPixelRef(SkReadBuffer&, SkBaseMutex*); | |
325 | |
326 // only call from constructor. Flags this to always be locked, removing | 323 // only call from constructor. Flags this to always be locked, removing |
327 // the need to grab the mutex and call onLockPixels/onUnlockPixels. | 324 // the need to grab the mutex and call onLockPixels/onUnlockPixels. |
328 // Performance tweak to avoid those calls (esp. in multi-thread use case). | 325 // Performance tweak to avoid those calls (esp. in multi-thread use case). |
329 void setPreLocked(void*, size_t rowBytes, SkColorTable*); | 326 void setPreLocked(void*, size_t rowBytes, SkColorTable*); |
330 | 327 |
331 private: | 328 private: |
332 SkBaseMutex* fMutex; // must remain in scope for the life of this object | 329 SkBaseMutex* fMutex; // must remain in scope for the life of this object |
333 | 330 |
334 // mostly const. fInfo.fAlpahType can be changed at runtime. | 331 // mostly const. fInfo.fAlpahType can be changed at runtime. |
335 const SkImageInfo fInfo; | 332 const SkImageInfo fInfo; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 /** | 365 /** |
369 * Allocate a new pixelref matching the specified ImageInfo, allocating | 366 * Allocate a new pixelref matching the specified ImageInfo, allocating |
370 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 367 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
371 * the pixelref will ref() the colortable. | 368 * the pixelref will ref() the colortable. |
372 * On failure return NULL. | 369 * On failure return NULL. |
373 */ | 370 */ |
374 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable
*) = 0; | 371 virtual SkPixelRef* create(const SkImageInfo&, size_t rowBytes, SkColorTable
*) = 0; |
375 }; | 372 }; |
376 | 373 |
377 #endif | 374 #endif |
OLD | NEW |