| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 isOpaque ? kOpaque_SkAlphaType : kPr
emul_SkAlphaType); | 266 isOpaque ? kOpaque_SkAlphaType : kPr
emul_SkAlphaType); |
| 267 this->allocPixels(info); | 267 this->allocPixels(info); |
| 268 } | 268 } |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * Install a pixelref that wraps the specified pixels and rowBytes, and | 271 * Install a pixelref that wraps the specified pixels and rowBytes, and |
| 272 * optional ReleaseProc and context. When the pixels are no longer | 272 * optional ReleaseProc and context. When the pixels are no longer |
| 273 * referenced, if releaseProc is not null, it will be called with the | 273 * referenced, if releaseProc is not null, it will be called with the |
| 274 * pixels and context as parameters. | 274 * pixels and context as parameters. |
| 275 * On failure, the bitmap will be set to empty and return false. | 275 * On failure, the bitmap will be set to empty and return false. |
| 276 * |
| 277 * If specified, the releaseProc will always be called, even on failure. It
is also possible |
| 278 * for success but the releaseProc is immediately called (e.g. valid Info b
ut NULL pixels). |
| 276 */ | 279 */ |
| 277 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, SkColo
rTable*, | 280 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, SkColo
rTable*, |
| 278 void (*releaseProc)(void* addr, void* context), void* con
text); | 281 void (*releaseProc)(void* addr, void* context), void* con
text); |
| 279 | 282 |
| 280 /** | 283 /** |
| 281 * Call installPixels with no ReleaseProc specified. This means that the | 284 * Call installPixels with no ReleaseProc specified. This means that the |
| 282 * caller must ensure that the specified pixels are valid for the lifetime | 285 * caller must ensure that the specified pixels are valid for the lifetime |
| 283 * of the created bitmap (and its pixelRef). | 286 * of the created bitmap (and its pixelRef). |
| 284 */ | 287 */ |
| 285 bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { | 288 bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 | 792 |
| 790 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 793 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 791 SkASSERT(fPixels); | 794 SkASSERT(fPixels); |
| 792 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 795 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
| 793 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 796 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
| 794 SkASSERT(fColorTable); | 797 SkASSERT(fColorTable); |
| 795 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 798 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 796 } | 799 } |
| 797 | 800 |
| 798 #endif | 801 #endif |
| OLD | NEW |