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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 protected: | 42 protected: |
43 virtual ~SkCachingPixelRef(); | 43 virtual ~SkCachingPixelRef(); |
44 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | 44 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
45 virtual void onUnlockPixels() SK_OVERRIDE; | 45 virtual void onUnlockPixels() SK_OVERRIDE; |
46 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 46 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
47 | 47 |
48 virtual SkData* onRefEncodedData() SK_OVERRIDE { | 48 virtual SkData* onRefEncodedData() SK_OVERRIDE { |
49 return fImageGenerator->refEncodedData(); | 49 return fImageGenerator->refEncodedData(); |
50 } | 50 } |
51 | 51 |
52 #ifdef SK_SUPPORT_LEGACY_PIXELREF_UNFLATTENABLE | |
53 // No need to flatten this object. When flattening an SkBitmap, | |
54 // SkWriteBuffer will check the encoded data and write that | |
55 // instead. | |
56 // Future implementations of SkWriteBuffer will need to | |
57 // special case for onRefEncodedData as well. | |
58 SK_DECLARE_UNFLATTENABLE_OBJECT() | |
59 #endif | |
60 | |
61 private: | 52 private: |
62 SkImageGenerator* const fImageGenerator; | 53 SkImageGenerator* const fImageGenerator; |
63 bool fErrorInDecoding; | 54 bool fErrorInDecoding; |
64 void* fScaledCacheId; | 55 void* fScaledCacheId; |
65 const size_t fRowBytes; | 56 const size_t fRowBytes; |
66 | 57 |
67 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes); | 58 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes); |
68 | 59 |
69 typedef SkPixelRef INHERITED; | 60 typedef SkPixelRef INHERITED; |
70 }; | 61 }; |
71 | 62 |
72 #endif // SkCachingPixelRef_DEFINED | 63 #endif // SkCachingPixelRef_DEFINED |
OLD | NEW |