| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // This can be used to invalidate caches keyed by SkPixelRef generation ID. | 262 // This can be used to invalidate caches keyed by SkPixelRef generation ID. |
| 263 struct GenIDChangeListener { | 263 struct GenIDChangeListener { |
| 264 virtual ~GenIDChangeListener() {} | 264 virtual ~GenIDChangeListener() {} |
| 265 virtual void onChange() = 0; | 265 virtual void onChange() = 0; |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 // Takes ownership of listener. | 268 // Takes ownership of listener. |
| 269 void addGenIDChangeListener(GenIDChangeListener* listener); | 269 void addGenIDChangeListener(GenIDChangeListener* listener); |
| 270 | 270 |
| 271 protected: | 271 protected: |
| 272 #ifdef SK_SUPPORT_LEGACY_ONLOCKPIXELS | |
| 273 virtual void* onLockPixels(SkColorTable**); | |
| 274 virtual bool onNewLockPixels(LockRec*); | |
| 275 #else | |
| 276 /** | 272 /** |
| 277 * On success, returns true and fills out the LockRec for the pixels. On | 273 * On success, returns true and fills out the LockRec for the pixels. On |
| 278 * failure returns false and ignores the LockRec parameter. | 274 * failure returns false and ignores the LockRec parameter. |
| 279 * | 275 * |
| 280 * The caller will have already acquired a mutex for thread safety, so this | 276 * The caller will have already acquired a mutex for thread safety, so this |
| 281 * method need not do that. | 277 * method need not do that. |
| 282 */ | 278 */ |
| 283 virtual bool onNewLockPixels(LockRec*) = 0; | 279 virtual bool onNewLockPixels(LockRec*) = 0; |
| 284 #endif | |
| 285 | 280 |
| 286 /** | 281 /** |
| 287 * Balancing the previous successful call to onNewLockPixels. The locked | 282 * Balancing the previous successful call to onNewLockPixels. The locked |
| 288 * pixel address will no longer be referenced, so the subclass is free to | 283 * pixel address will no longer be referenced, so the subclass is free to |
| 289 * move or discard that memory. | 284 * move or discard that memory. |
| 290 * | 285 * |
| 291 * The caller will have already acquired a mutex for thread safety, so this | 286 * The caller will have already acquired a mutex for thread safety, so this |
| 292 * method need not do that. | 287 * method need not do that. |
| 293 */ | 288 */ |
| 294 virtual void onUnlockPixels() = 0; | 289 virtual void onUnlockPixels() = 0; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 /** | 371 /** |
| 377 * Allocate a new pixelref matching the specified ImageInfo, allocating | 372 * Allocate a new pixelref matching the specified ImageInfo, allocating |
| 378 * the memory for the pixels. If the ImageInfo requires a ColorTable, | 373 * the memory for the pixels. If the ImageInfo requires a ColorTable, |
| 379 * the pixelref will ref() the colortable. | 374 * the pixelref will ref() the colortable. |
| 380 * On failure return NULL. | 375 * On failure return NULL. |
| 381 */ | 376 */ |
| 382 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; | 377 virtual SkPixelRef* create(const SkImageInfo&, SkColorTable*) = 0; |
| 383 }; | 378 }; |
| 384 | 379 |
| 385 #endif | 380 #endif |
| OLD | NEW |