OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkBitmap_DEFINED | 8 #ifndef SkBitmap_DEFINED |
9 #define SkBitmap_DEFINED | 9 #define SkBitmap_DEFINED |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 any pixel/colortable ownership, just like reset(). | 241 any pixel/colortable ownership, just like reset(). |
242 */ | 242 */ |
243 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); | 243 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); |
244 | 244 |
245 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { | 245 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { |
246 return this->setConfig(config, width, height, rowBytes, | 246 return this->setConfig(config, width, height, rowBytes, |
247 kPremul_SkAlphaType); | 247 kPremul_SkAlphaType); |
248 } | 248 } |
249 | 249 |
250 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); | 250 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); |
251 | 251 |
252 /** | |
253 * Allocate a pixelref to match the specified image info, using the default | |
254 * allocator, computing a minimum rowBytes based on info. | |
255 * On failure, the bitmap will be set to empty and return false. | |
256 */ | |
257 bool allocPixels(const SkImageInfo&, SkColorTable* ctable = NULL); | |
258 | |
259 /** | |
260 * Install a pixelref that wraps the specified pixels and rowBytes, and | |
261 * optional ReleaseProc and context. When the pixels are no longer | |
262 * referenced, if ReleaseProc is not null, it will be called with the | |
263 * pixels and context as parameters. | |
264 * On failure, the bitmap will be set to empty and return false. | |
265 */ | |
266 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, | |
267 void (*ReleaseProc)(void* addr, void* context), | |
268 void* context); | |
hal.canary
2014/01/23 21:39:10
bool installPixels(const SkImageInfo&, void* pixel
| |
269 | |
252 /** | 270 /** |
253 * If the bitmap's config can be represented as SkImageInfo, return true, | 271 * If the bitmap's config can be represented as SkImageInfo, return true, |
254 * and if info is not-null, set it to the bitmap's info. If it cannot be | 272 * and if info is not-null, set it to the bitmap's info. If it cannot be |
255 * represented as SkImageInfo, return false and ignore the info parameter. | 273 * represented as SkImageInfo, return false and ignore the info parameter. |
256 */ | 274 */ |
257 bool asImageInfo(SkImageInfo* info) const; | 275 bool asImageInfo(SkImageInfo* info) const; |
258 | 276 |
259 /** Use this to assign a new pixel address for an existing bitmap. This | 277 /** Use this to assign a new pixel address for an existing bitmap. This |
260 will automatically release any pixelref previously installed. Only call | 278 will automatically release any pixelref previously installed. Only call |
261 this if you are handling ownership/lifetime of the pixel memory. | 279 this if you are handling ownership/lifetime of the pixel memory. |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
827 | 845 |
828 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 846 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
829 SkASSERT(fPixels); | 847 SkASSERT(fPixels); |
830 SkASSERT(fConfig == kIndex8_Config); | 848 SkASSERT(fConfig == kIndex8_Config); |
831 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 849 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
832 SkASSERT(fColorTable); | 850 SkASSERT(fColorTable); |
833 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 851 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
834 } | 852 } |
835 | 853 |
836 #endif | 854 #endif |
OLD | NEW |