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 SkDiscardablePixelRef_DEFINED | 8 #ifndef SkDiscardablePixelRef_DEFINED |
9 #define SkDiscardablePixelRef_DEFINED | 9 #define SkDiscardablePixelRef_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 * Since SkColorTable is reference-counted, we do not support indexed | 21 * Since SkColorTable is reference-counted, we do not support indexed |
22 * color with this class; there would be no way for the discardable | 22 * color with this class; there would be no way for the discardable |
23 * memory system to unref the color table. | 23 * memory system to unref the color table. |
24 */ | 24 */ |
25 class SkDiscardablePixelRef : public SkPixelRef { | 25 class SkDiscardablePixelRef : public SkPixelRef { |
26 public: | 26 public: |
27 SK_DECLARE_UNFLATTENABLE_OBJECT() | 27 SK_DECLARE_UNFLATTENABLE_OBJECT() |
28 | 28 |
29 protected: | 29 protected: |
30 ~SkDiscardablePixelRef(); | 30 ~SkDiscardablePixelRef(); |
31 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; | 31 |
| 32 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
32 virtual void onUnlockPixels() SK_OVERRIDE; | 33 virtual void onUnlockPixels() SK_OVERRIDE; |
33 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 34 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
34 | 35 |
35 virtual SkData* onRefEncodedData() SK_OVERRIDE { | 36 virtual SkData* onRefEncodedData() SK_OVERRIDE { |
36 return fGenerator->refEncodedData(); | 37 return fGenerator->refEncodedData(); |
37 } | 38 } |
38 | 39 |
39 private: | 40 private: |
40 SkImageGenerator* const fGenerator; | 41 SkImageGenerator* const fGenerator; |
41 SkDiscardableMemory::Factory* const fDMFactory; | 42 SkDiscardableMemory::Factory* const fDMFactory; |
42 const size_t fRowBytes; | 43 const size_t fRowBytes; |
43 // These const members should not change over the life of the | 44 // These const members should not change over the life of the |
44 // PixelRef, since the SkBitmap doesn't expect them to change. | 45 // PixelRef, since the SkBitmap doesn't expect them to change. |
45 | 46 |
46 SkDiscardableMemory* fDiscardableMemory; | 47 SkDiscardableMemory* fDiscardableMemory; |
47 | 48 |
48 /* Takes ownership of SkImageGenerator. */ | 49 /* Takes ownership of SkImageGenerator. */ |
49 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, | 50 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, |
50 size_t rowBytes, | 51 size_t rowBytes, |
51 SkDiscardableMemory::Factory* factory); | 52 SkDiscardableMemory::Factory* factory); |
| 53 |
52 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, | 54 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, |
53 SkBitmap*, | 55 SkBitmap*, |
54 SkDiscardableMemory::Factory*); | 56 SkDiscardableMemory::Factory*); |
| 57 |
55 typedef SkPixelRef INHERITED; | 58 typedef SkPixelRef INHERITED; |
56 }; | 59 }; |
| 60 |
57 #endif // SkDiscardablePixelRef_DEFINED | 61 #endif // SkDiscardablePixelRef_DEFINED |
OLD | NEW |