| 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 SkMallocPixelRef_DEFINED | 10 #ifndef SkMallocPixelRef_DEFINED |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * | 25 * |
| 26 * The pixelref will ref() the colortable (if not NULL). | 26 * The pixelref will ref() the colortable (if not NULL). |
| 27 * | 27 * |
| 28 * Returns NULL on failure. | 28 * Returns NULL on failure. |
| 29 */ | 29 */ |
| 30 static SkMallocPixelRef* NewDirect(const SkImageInfo&, void* addr, | 30 static SkMallocPixelRef* NewDirect(const SkImageInfo&, void* addr, |
| 31 size_t rowBytes, SkColorTable*); | 31 size_t rowBytes, SkColorTable*); |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Return a new SkMallocPixelRef, automatically allocating storage for the | 34 * Return a new SkMallocPixelRef, automatically allocating storage for the |
| 35 * pixels. | 35 * pixels. If rowBytes are 0, an optimal value will be chosen automatically
. |
| 36 * | 36 * If rowBytes is > 0, then it will be respected, or NULL will be returned |
| 37 * If rowBytes is 0, an optimal value will be chosen automatically. | 37 * if rowBytes is invalid for the specified info. |
| 38 * If rowBytes is > 0, then it will be used, unless it is invald for the | |
| 39 * specified info, in which case NULL will be returned (failure). | |
| 40 * | 38 * |
| 41 * This pixelref will ref() the specified colortable (if not NULL). | 39 * This pixelref will ref() the specified colortable (if not NULL). |
| 42 * | 40 * |
| 43 * Returns NULL on failure. | 41 * Returns NULL on failure. |
| 44 */ | 42 */ |
| 45 static SkMallocPixelRef* NewAllocate(const SkImageInfo& info, | 43 static SkMallocPixelRef* NewAllocate(const SkImageInfo& info, |
| 46 size_t rowBytes, SkColorTable*); | 44 size_t rowBytes, SkColorTable*); |
| 47 | 45 |
| 48 /** | 46 /** |
| 49 * Return a new SkMallocPixelRef with the provided pixel storage, | 47 * Return a new SkMallocPixelRef with the provided pixel storage, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 81 |
| 84 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) | 82 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef) |
| 85 | 83 |
| 86 protected: | 84 protected: |
| 87 // The ownPixels version of this constructor is deprecated. | 85 // The ownPixels version of this constructor is deprecated. |
| 88 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, | 86 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, |
| 89 bool ownPixels); | 87 bool ownPixels); |
| 90 SkMallocPixelRef(SkFlattenableReadBuffer& buffer); | 88 SkMallocPixelRef(SkFlattenableReadBuffer& buffer); |
| 91 virtual ~SkMallocPixelRef(); | 89 virtual ~SkMallocPixelRef(); |
| 92 | 90 |
| 93 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; | 91 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
| 94 virtual void onUnlockPixels() SK_OVERRIDE; | 92 virtual void onUnlockPixels() SK_OVERRIDE; |
| 95 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 93 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 96 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE; | 94 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE; |
| 97 | 95 |
| 98 private: | 96 private: |
| 99 void* fStorage; | 97 void* fStorage; |
| 100 SkColorTable* fCTable; | 98 SkColorTable* fCTable; |
| 101 size_t fRB; | 99 size_t fRB; |
| 102 ReleaseProc fReleaseProc; | 100 ReleaseProc fReleaseProc; |
| 103 void* fReleaseProcContext; | 101 void* fReleaseProcContext; |
| 104 | 102 |
| 105 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, | 103 SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*, |
| 106 ReleaseProc proc, void* context); | 104 ReleaseProc proc, void* context); |
| 107 | 105 |
| 108 typedef SkPixelRef INHERITED; | 106 typedef SkPixelRef INHERITED; |
| 109 }; | 107 }; |
| 110 | 108 |
| 111 | 109 |
| 112 #endif | 110 #endif |
| OLD | NEW |