| Index: src/core/SkBitmap.cpp
|
| diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
|
| index 2464d5d5967409f77d87ce7cbf26cc5e4b82ab4d..75845b15d610babe5f5f665cbe1df58dcd030aeb 100644
|
| --- a/src/core/SkBitmap.cpp
|
| +++ b/src/core/SkBitmap.cpp
|
| @@ -495,6 +495,33 @@ bool SkBitmap::allocPixels(Allocator* allocator, SkColorTable* ctable) {
|
| return allocator->allocPixelRef(this, ctable);
|
| }
|
|
|
| +bool SkBitmap::allocPixels(const SkImageInfo& info, SkColorTable* ctable) {
|
| + if (!this->setConfig(info) && !this->allocPixels(ctable)) {
|
| + this->reset();
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb,
|
| + void (*releaseProc)(void* addr, void* context),
|
| + void* context) {
|
| + if (!this->setConfig(info)) {
|
| + this->reset();
|
| + return false;
|
| + }
|
| +
|
| + SkPixelRef* pr = SkMallocPixelRef::NewWithProc(info, rb, NULL, pixels,
|
| + releaseProc, context);
|
| + if (!pr) {
|
| + this->reset();
|
| + return false;
|
| + }
|
| +
|
| + this->setPixelRef(pr)->unref();
|
| + return true;
|
| +}
|
| +
|
| void SkBitmap::freePixels() {
|
| // if we're gonna free the pixels, we certainly need to free the mipmap
|
| this->freeMipMap();
|
|
|