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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 * | 33 * |
34 * If Install fails or when the SkCachingPixelRef that is | 34 * If Install fails or when the SkCachingPixelRef that is |
35 * installed into destination is destroyed, it will call | 35 * installed into destination is destroyed, it will call |
36 * SkDELETE() on the generator. Therefore, generator should be | 36 * SkDELETE() on the generator. Therefore, generator should be |
37 * allocated with SkNEW() or SkNEW_ARGS(). | 37 * allocated with SkNEW() or SkNEW_ARGS(). |
38 */ | 38 */ |
39 static bool Install(SkImageGenerator* gen, SkBitmap* dst); | 39 static bool Install(SkImageGenerator* gen, SkBitmap* dst); |
40 | 40 |
41 protected: | 41 protected: |
42 virtual ~SkCachingPixelRef(); | 42 virtual ~SkCachingPixelRef(); |
43 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | 43 virtual void* onLockPixels(SkColorTable** colorTable) SK_OVERRIDE; |
44 virtual void onUnlockPixels() SK_OVERRIDE; | 44 virtual void onUnlockPixels() SK_OVERRIDE; |
45 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 45 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
46 | 46 |
47 virtual SkData* onRefEncodedData() SK_OVERRIDE { | 47 virtual SkData* onRefEncodedData() SK_OVERRIDE { |
48 return fImageGenerator->refEncodedData(); | 48 return fImageGenerator->refEncodedData(); |
49 } | 49 } |
50 // No need to flatten this object. When flattening an SkBitmap, | 50 // No need to flatten this object. When flattening an SkBitmap, |
51 // SkOrderedWriteBuffer will check the encoded data and write that | 51 // SkOrderedWriteBuffer will check the encoded data and write that |
52 // instead. | 52 // instead. |
53 // Future implementations of SkFlattenableWriteBuffer will need to | 53 // Future implementations of SkFlattenableWriteBuffer will need to |
54 // special case for onRefEncodedData as well. | 54 // special case for onRefEncodedData as well. |
55 SK_DECLARE_UNFLATTENABLE_OBJECT() | 55 SK_DECLARE_UNFLATTENABLE_OBJECT() |
56 | 56 |
57 private: | 57 private: |
58 SkImageGenerator* const fImageGenerator; | 58 SkImageGenerator* const fImageGenerator; |
59 bool fErrorInDecoding; | 59 bool fErrorInDecoding; |
60 void* fScaledCacheId; | 60 void* fScaledCacheId; |
| 61 const SkImageInfo fInfo; |
61 const size_t fRowBytes; | 62 const size_t fRowBytes; |
62 | 63 |
63 SkCachingPixelRef(SkImageGenerator* imageGenerator, | 64 SkCachingPixelRef(SkImageGenerator* imageGenerator, |
64 const SkImageInfo& info, | 65 const SkImageInfo& info, |
65 size_t rowBytes); | 66 size_t rowBytes); |
66 | |
67 typedef SkPixelRef INHERITED; | 67 typedef SkPixelRef INHERITED; |
68 }; | 68 }; |
69 | 69 |
70 #endif // SkCachingPixelRef_DEFINED | 70 #endif // SkCachingPixelRef_DEFINED |
OLD | NEW |