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