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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 * @return true iff successful. | 43 * @return true iff successful. |
44 */ | 44 */ |
45 static bool Install(SkImageGenerator* generator, | 45 static bool Install(SkImageGenerator* generator, |
46 SkBitmap* destination, | 46 SkBitmap* destination, |
47 SkDiscardableMemory::Factory* factory = NULL); | 47 SkDiscardableMemory::Factory* factory = NULL); |
48 | 48 |
49 SK_DECLARE_UNFLATTENABLE_OBJECT() | 49 SK_DECLARE_UNFLATTENABLE_OBJECT() |
50 | 50 |
51 protected: | 51 protected: |
52 ~SkDiscardablePixelRef(); | 52 ~SkDiscardablePixelRef(); |
53 | 53 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; |
54 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | |
55 virtual void onUnlockPixels() SK_OVERRIDE; | 54 virtual void onUnlockPixels() SK_OVERRIDE; |
56 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 55 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
57 | 56 |
58 virtual SkData* onRefEncodedData() SK_OVERRIDE { | 57 virtual SkData* onRefEncodedData() SK_OVERRIDE { |
59 return fGenerator->refEncodedData(); | 58 return fGenerator->refEncodedData(); |
60 } | 59 } |
61 | 60 |
62 private: | 61 private: |
63 SkImageGenerator* const fGenerator; | 62 SkImageGenerator* const fGenerator; |
64 SkDiscardableMemory::Factory* const fDMFactory; | 63 SkDiscardableMemory::Factory* const fDMFactory; |
| 64 const SkImageInfo fInfo; |
| 65 const size_t fSize; // size of memory to be allocated |
65 const size_t fRowBytes; | 66 const size_t fRowBytes; |
66 // These const members should not change over the life of the | 67 // These const members should not change over the life of the |
67 // PixelRef, since the SkBitmap doesn't expect them to change. | 68 // PixelRef, since the SkBitmap doesn't expect them to change. |
68 | 69 |
69 SkDiscardableMemory* fDiscardableMemory; | 70 SkDiscardableMemory* fDiscardableMemory; |
70 | 71 |
71 /* Takes ownership of SkImageGenerator. */ | 72 /* Takes ownership of SkImageGenerator. */ |
72 SkDiscardablePixelRef(SkImageGenerator* generator, | 73 SkDiscardablePixelRef(SkImageGenerator* generator, |
73 const SkImageInfo& info, | 74 const SkImageInfo& info, |
| 75 size_t size, |
74 size_t rowBytes, | 76 size_t rowBytes, |
75 SkDiscardableMemory::Factory* factory); | 77 SkDiscardableMemory::Factory* factory); |
76 | |
77 typedef SkPixelRef INHERITED; | |
78 }; | 78 }; |
79 | |
80 #endif // SkDiscardablePixelRef_DEFINED | 79 #endif // SkDiscardablePixelRef_DEFINED |
OLD | NEW |