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 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; | 53 |
| 54 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
54 virtual void onUnlockPixels() SK_OVERRIDE; | 55 virtual void onUnlockPixels() SK_OVERRIDE; |
55 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 56 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
56 | 57 |
57 virtual SkData* onRefEncodedData() SK_OVERRIDE { | 58 virtual SkData* onRefEncodedData() SK_OVERRIDE { |
58 return fGenerator->refEncodedData(); | 59 return fGenerator->refEncodedData(); |
59 } | 60 } |
60 | 61 |
61 private: | 62 private: |
62 SkImageGenerator* const fGenerator; | 63 SkImageGenerator* const fGenerator; |
63 SkDiscardableMemory::Factory* const fDMFactory; | 64 SkDiscardableMemory::Factory* const fDMFactory; |
64 const SkImageInfo fInfo; | |
65 const size_t fSize; // size of memory to be allocated | |
66 const size_t fRowBytes; | 65 const size_t fRowBytes; |
67 // These const members should not change over the life of the | 66 // These const members should not change over the life of the |
68 // PixelRef, since the SkBitmap doesn't expect them to change. | 67 // PixelRef, since the SkBitmap doesn't expect them to change. |
69 | 68 |
70 SkDiscardableMemory* fDiscardableMemory; | 69 SkDiscardableMemory* fDiscardableMemory; |
71 | 70 |
72 /* Takes ownership of SkImageGenerator. */ | 71 /* Takes ownership of SkImageGenerator. */ |
73 SkDiscardablePixelRef(SkImageGenerator* generator, | 72 SkDiscardablePixelRef(SkImageGenerator* generator, |
74 const SkImageInfo& info, | 73 const SkImageInfo& info, |
75 size_t size, | |
76 size_t rowBytes, | 74 size_t rowBytes, |
77 SkDiscardableMemory::Factory* factory); | 75 SkDiscardableMemory::Factory* factory); |
| 76 |
| 77 typedef SkPixelRef INHERITED; |
78 }; | 78 }; |
| 79 |
79 #endif // SkDiscardablePixelRef_DEFINED | 80 #endif // SkDiscardablePixelRef_DEFINED |
OLD | NEW |