SkPixelRef* BitmapFactoryGlue::installPixelRef(SkBitmap* bitmap, SkStream* stream, int sampleSize, bool ditherImage) { SkImageRef* pr = new SkImageRef_GlobalPool(stream, bitmap->config(), sampleSize); pr->setDitherImage(ditherImage); bitmap->setPixelRef(pr)->unref(); pr->isOpaque(bitmap); return pr; }
static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream, int sampleSize, bool ditherImage) { SkImageRef* pr; // only use ashmem for large images, since mmaps come at a price if (bitmap->getSize() >= 32 * 1024) { pr = new SkImageRef_ashmem(stream, bitmap->config(), sampleSize); } else { pr = new SkImageRef_GlobalPool(stream, bitmap->config(), sampleSize); } pr->setDitherImage(ditherImage); bitmap->setPixelRef(pr)->unref(); pr->isOpaque(bitmap); return pr; }
static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStreamRewindable* stream, int sampleSize, bool ditherImage) { SkImageInfo bitmapInfo; if (!bitmap->asImageInfo(&bitmapInfo)) { ALOGW("bitmap has unknown configuration so no memory has been allocated"); return NULL; } SkImageRef* pr; // only use ashmem for large images, since mmaps come at a price if (bitmap->getSize() >= 32 * 1024) { pr = new SkImageRef_ashmem(bitmapInfo, stream, sampleSize); } else { pr = new SkImageRef_GlobalPool(bitmapInfo, stream, sampleSize); } pr->setDitherImage(ditherImage); bitmap->setPixelRef(pr)->unref(); pr->isOpaque(bitmap); return pr; }