OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkImageRef_DEFINED | 10 #ifndef SkImageRef_DEFINED |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 /** Override if you want to install a custom allocator. | 65 /** Override if you want to install a custom allocator. |
66 When this is called we will have already acquired the mutex! | 66 When this is called we will have already acquired the mutex! |
67 */ | 67 */ |
68 virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable*, SkBitmap*, | 68 virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable*, SkBitmap*, |
69 SkBitmap::Config, SkImageDecoder::Mode); | 69 SkBitmap::Config, SkImageDecoder::Mode); |
70 | 70 |
71 /* Overrides from SkPixelRef | 71 /* Overrides from SkPixelRef |
72 When these are called, we will have already acquired the mutex! | 72 When these are called, we will have already acquired the mutex! |
73 */ | 73 */ |
74 | 74 |
75 virtual void* onLockPixels(SkColorTable**); | 75 virtual bool onGetInfo(SkImageInfo*) SK_OVERRIDE; |
| 76 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
76 // override this in your subclass to clean up when we're unlocking pixels | 77 // override this in your subclass to clean up when we're unlocking pixels |
77 virtual void onUnlockPixels() {} | 78 virtual void onUnlockPixels() SK_OVERRIDE {} |
78 | 79 |
79 SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL); | 80 SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL); |
80 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 81 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
81 | 82 |
82 SkBitmap fBitmap; | 83 SkBitmap fBitmap; |
83 | 84 |
84 private: | 85 private: |
85 SkStreamRewindable* setStream(SkStreamRewindable*); | 86 SkStreamRewindable* setStream(SkStreamRewindable*); |
86 // called with mutex already held. returns true if the bitmap is in the | 87 // called with mutex already held. returns true if the bitmap is in the |
87 // requested state (or further, i.e. has pixels) | 88 // requested state (or further, i.e. has pixels) |
88 bool prepareBitmap(SkImageDecoder::Mode); | 89 bool prepareBitmap(SkImageDecoder::Mode); |
89 | 90 |
90 SkImageDecoderFactory* fFactory; // may be null | 91 SkImageDecoderFactory* fFactory; // may be null |
91 SkStreamRewindable* fStream; | 92 SkStreamRewindable* fStream; |
92 SkBitmap::Config fConfig; | 93 SkBitmap::Config fConfig; |
93 int fSampleSize; | 94 int fSampleSize; |
94 bool fDoDither; | 95 bool fDoDither; |
95 bool fErrorInDecoding; | 96 bool fErrorInDecoding; |
96 | 97 |
97 friend class SkImageRefPool; | 98 friend class SkImageRefPool; |
98 | 99 |
99 SkImageRef* fPrev, *fNext; | 100 SkImageRef* fPrev, *fNext; |
100 size_t ramUsed() const; | 101 size_t ramUsed() const; |
101 | 102 |
102 typedef SkPixelRef INHERITED; | 103 typedef SkPixelRef INHERITED; |
103 }; | 104 }; |
104 | 105 |
105 #endif | 106 #endif |
OLD | NEW |