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 | 31 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; |
32 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | |
33 virtual void onUnlockPixels() SK_OVERRIDE; | 32 virtual void onUnlockPixels() SK_OVERRIDE; |
34 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 33 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
35 | 34 |
36 virtual SkData* onRefEncodedData() SK_OVERRIDE { | 35 virtual SkData* onRefEncodedData() SK_OVERRIDE { |
37 return fGenerator->refEncodedData(); | 36 return fGenerator->refEncodedData(); |
38 } | 37 } |
39 | 38 |
40 private: | 39 private: |
41 SkImageGenerator* const fGenerator; | 40 SkImageGenerator* const fGenerator; |
42 SkDiscardableMemory::Factory* const fDMFactory; | 41 SkDiscardableMemory::Factory* const fDMFactory; |
43 const size_t fRowBytes; | 42 const size_t fRowBytes; |
44 // These const members should not change over the life of the | 43 // These const members should not change over the life of the |
45 // PixelRef, since the SkBitmap doesn't expect them to change. | 44 // PixelRef, since the SkBitmap doesn't expect them to change. |
46 | 45 |
47 SkDiscardableMemory* fDiscardableMemory; | 46 SkDiscardableMemory* fDiscardableMemory; |
48 | 47 |
49 /* Takes ownership of SkImageGenerator. */ | 48 /* Takes ownership of SkImageGenerator. */ |
50 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, | 49 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, |
51 size_t rowBytes, | 50 size_t rowBytes, |
52 SkDiscardableMemory::Factory* factory); | 51 SkDiscardableMemory::Factory* factory); |
53 | |
54 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, | 52 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, |
55 SkBitmap*, | 53 SkBitmap*, |
56 SkDiscardableMemory::Factory*); | 54 SkDiscardableMemory::Factory*); |
57 | |
58 typedef SkPixelRef INHERITED; | 55 typedef SkPixelRef INHERITED; |
59 }; | 56 }; |
60 | |
61 #endif // SkDiscardablePixelRef_DEFINED | 57 #endif // SkDiscardablePixelRef_DEFINED |
OLD | NEW |