OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkLazyPixelRef_DEFINED | 8 #ifndef SkLazyPixelRef_DEFINED |
9 #define SkLazyPixelRef_DEFINED | 9 #define SkLazyPixelRef_DEFINED |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 static void ResetCacheStats() { gCacheHits = gCacheMisses = 0; } | 53 static void ResetCacheStats() { gCacheHits = gCacheMisses = 0; } |
54 #endif | 54 #endif |
55 | 55 |
56 // No need to flatten this object. When flattening an SkBitmap, SkOrderedWri
teBuffer will check | 56 // No need to flatten this object. When flattening an SkBitmap, SkOrderedWri
teBuffer will check |
57 // the encoded data and write that instead. | 57 // the encoded data and write that instead. |
58 // Future implementations of SkFlattenableWriteBuffer will need to special c
ase for | 58 // Future implementations of SkFlattenableWriteBuffer will need to special c
ase for |
59 // onRefEncodedData as well. | 59 // onRefEncodedData as well. |
60 SK_DECLARE_UNFLATTENABLE_OBJECT() | 60 SK_DECLARE_UNFLATTENABLE_OBJECT() |
61 | 61 |
62 protected: | 62 protected: |
63 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; | 63 virtual bool onGetInfo(SkImageInfo*) SK_OVERRIDE; |
| 64 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
64 virtual void onUnlockPixels() SK_OVERRIDE; | 65 virtual void onUnlockPixels() SK_OVERRIDE; |
65 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 66 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
66 virtual SkData* onRefEncodedData() SK_OVERRIDE; | 67 virtual SkData* onRefEncodedData() SK_OVERRIDE; |
67 virtual bool onImplementsDecodeInto() SK_OVERRIDE; | 68 virtual bool onImplementsDecodeInto() SK_OVERRIDE; |
68 virtual bool onDecodeInto(int pow2, SkBitmap*) SK_OVERRIDE; | 69 virtual bool onDecodeInto(int pow2, SkBitmap*) SK_OVERRIDE; |
69 | 70 |
70 private: | 71 private: |
71 bool fErrorInDecoding; | 72 bool fErrorInDecoding; |
72 SkData* fData; | 73 SkData* fData; |
73 SkBitmapFactory::DecodeProc fDecodeProc; | 74 SkBitmapFactory::DecodeProc fDecodeProc; |
74 SkImageCache* fImageCache; | 75 SkImageCache* fImageCache; |
75 union { | 76 union { |
76 SkImageCache::ID fCacheId; | 77 SkImageCache::ID fCacheId; |
77 SkScaledImageCache::ID* fScaledCacheId; | 78 SkScaledImageCache::ID* fScaledCacheId; |
78 }; | 79 }; |
79 size_t fRowBytes; | 80 size_t fRowBytes; |
80 SkImageInfo fLazilyCachedInfo; | 81 SkImageInfo fLazilyCachedInfo; |
81 | 82 |
82 #if LAZY_CACHE_STATS | 83 #if LAZY_CACHE_STATS |
83 static int32_t gCacheHits; | 84 static int32_t gCacheHits; |
84 static int32_t gCacheMisses; | 85 static int32_t gCacheMisses; |
85 #endif | 86 #endif |
86 | 87 |
87 // lazily initialized our cached info. Returns NULL on failure. | 88 // lazily initialized our cached info. Returns NULL on failure. |
88 const SkImage::Info* getCachedInfo(); | 89 const SkImage::Info* getCachedInfo(); |
89 void* lockScaledImageCachePixels(); | 90 bool lockScaledImageCachePixels(LockRec*); |
90 void* lockImageCachePixels(); | 91 bool lockImageCachePixels(LockRec*); |
91 | 92 |
92 | 93 |
93 typedef SkPixelRef INHERITED; | 94 typedef SkPixelRef INHERITED; |
94 }; | 95 }; |
95 | 96 |
96 #endif // SkLazyPixelRef_DEFINED | 97 #endif // SkLazyPixelRef_DEFINED |
OLD | NEW |