| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkCachingPixelRef_DEFINED | 8 #ifndef SkCachingPixelRef_DEFINED |
| 9 #define SkCachingPixelRef_DEFINED | 9 #define SkCachingPixelRef_DEFINED |
| 10 | 10 |
| 11 #include "SkBitmapCache.h" | 11 #include "SkBitmapCache.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 #include "SkImageGenerator.h" | 13 #include "SkImageGenerator.h" |
| 14 #include "SkPixelRef.h" | 14 #include "SkPixelRef.h" |
| 15 | 15 |
| 16 class SkColorTable; | 16 class SkColorTable; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * PixelRef which defers decoding until SkBitmap::lockPixels() is | 19 * PixelRef which defers decoding until SkBitmap::lockPixels() is |
| 20 * called. Caches the decoded images in the global | 20 * called. Caches the decoded images in the global |
| 21 * SkScaledImageCache. When the pixels are unlocked, this cache may | 21 * SkScaledImageCache. When the pixels are unlocked, this cache may |
| 22 * or be destroyed before the next lock. If so, onLockPixels will | 22 * or be destroyed before the next lock. If so, onLockPixels will |
| 23 * attempt to re-decode. | 23 * attempt to re-decode. |
| 24 * | 24 * |
| 25 * Decoding is handled by the SkImageGenerator | 25 * Decoding is handled by the SkImageGenerator |
| 26 */ | 26 */ |
| 27 class SkCachingPixelRef : public SkPixelRef { | 27 class SkCachingPixelRef : public SkPixelRef { |
| 28 public: | 28 public: |
| 29 SK_DECLARE_INST_COUNT(SkCachingPixelRef) | 29 |
| 30 /** | 30 /** |
| 31 * Takes ownership of SkImageGenerator. If this method fails for | 31 * Takes ownership of SkImageGenerator. If this method fails for |
| 32 * whatever reason, it will return false and immediatetely delete | 32 * whatever reason, it will return false and immediatetely delete |
| 33 * the generator. If it succeeds, it will modify destination | 33 * the generator. If it succeeds, it will modify destination |
| 34 * bitmap. | 34 * bitmap. |
| 35 * | 35 * |
| 36 * If Install fails or when the SkCachingPixelRef that is | 36 * If Install fails or when the SkCachingPixelRef that is |
| 37 * installed into destination is destroyed, it will call | 37 * installed into destination is destroyed, it will call |
| 38 * SkDELETE() on the generator. Therefore, generator should be | 38 * SkDELETE() on the generator. Therefore, generator should be |
| 39 * allocated with SkNEW() or SkNEW_ARGS(). | 39 * allocated with SkNEW() or SkNEW_ARGS(). |
| (...skipping 16 matching lines...) Expand all Loading... |
| 56 const size_t fRowBytes; | 56 const size_t fRowBytes; |
| 57 | 57 |
| 58 SkBitmap fLockedBitmap; | 58 SkBitmap fLockedBitmap; |
| 59 | 59 |
| 60 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes); | 60 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes); |
| 61 | 61 |
| 62 typedef SkPixelRef INHERITED; | 62 typedef SkPixelRef INHERITED; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 #endif // SkCachingPixelRef_DEFINED | 65 #endif // SkCachingPixelRef_DEFINED |
| OLD | NEW |