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 onNewLockPixels(LockRec*) SK_OVERRIDE; |
76 // override this in your subclass to clean up when we're unlocking pixels | 76 // override this in your subclass to clean up when we're unlocking pixels |
77 virtual void onUnlockPixels() {} | 77 virtual void onUnlockPixels() SK_OVERRIDE {} |
78 | 78 |
79 SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL); | 79 SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL); |
80 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 80 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
81 | 81 |
82 SkBitmap fBitmap; | 82 SkBitmap fBitmap; |
83 | 83 |
84 private: | 84 private: |
85 SkStreamRewindable* setStream(SkStreamRewindable*); | 85 SkStreamRewindable* setStream(SkStreamRewindable*); |
86 // called with mutex already held. returns true if the bitmap is in the | 86 // called with mutex already held. returns true if the bitmap is in the |
87 // requested state (or further, i.e. has pixels) | 87 // requested state (or further, i.e. has pixels) |
88 bool prepareBitmap(SkImageDecoder::Mode); | 88 bool prepareBitmap(SkImageDecoder::Mode); |
89 | 89 |
90 SkImageDecoderFactory* fFactory; // may be null | 90 SkImageDecoderFactory* fFactory; // may be null |
91 SkStreamRewindable* fStream; | 91 SkStreamRewindable* fStream; |
92 int fSampleSize; | 92 int fSampleSize; |
93 bool fDoDither; | 93 bool fDoDither; |
94 bool fErrorInDecoding; | 94 bool fErrorInDecoding; |
95 | 95 |
96 friend class SkImageRefPool; | 96 friend class SkImageRefPool; |
97 | 97 |
98 SkImageRef* fPrev, *fNext; | 98 SkImageRef* fPrev, *fNext; |
99 size_t ramUsed() const; | 99 size_t ramUsed() const; |
100 | 100 |
101 typedef SkPixelRef INHERITED; | 101 typedef SkPixelRef INHERITED; |
102 }; | 102 }; |
103 | 103 |
104 #endif | 104 #endif |
OLD | NEW |