diff options
author | reed <reed@google.com> | 2014-09-02 12:50:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-02 12:50:45 -0700 |
commit | 848250415eddc54075f7eb8795e8db79e749c6ab (patch) | |
tree | eb60aea6e61c9b3a9e195ab3cfb01d571351f78b /src | |
parent | 00f30bdc9e34b013da54b4406f36556c5be8d041 (diff) |
make allocPixels throw on failure
BUG=skia:
R=mtklein@google.com, fmalita@google.com, fmalita@chromium.org
Author: reed@google.com
Review URL: https://codereview.chromium.org/510423005
Diffstat (limited to 'src')
28 files changed, 43 insertions, 46 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index d83199ddc4..928a4b74ed 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -268,7 +268,7 @@ void SkBitmap::setPixels(void* p, SkColorTable* ctable) { SkDEBUGCODE(this->validate();) } -bool SkBitmap::allocPixels(Allocator* allocator, SkColorTable* ctable) { +bool SkBitmap::tryAllocPixels(Allocator* allocator, SkColorTable* ctable) { HeapAllocator stdalloc; if (NULL == allocator) { @@ -279,7 +279,7 @@ bool SkBitmap::allocPixels(Allocator* allocator, SkColorTable* ctable) { /////////////////////////////////////////////////////////////////////////////// -bool SkBitmap::allocPixels(const SkImageInfo& requestedInfo, size_t rowBytes) { +bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes) { if (kIndex_8_SkColorType == requestedInfo.colorType()) { return reset_return_false(this); } @@ -308,8 +308,8 @@ bool SkBitmap::allocPixels(const SkImageInfo& requestedInfo, size_t rowBytes) { return true; } -bool SkBitmap::allocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactory* factory, - SkColorTable* ctable) { +bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactory* factory, + SkColorTable* ctable) { if (kIndex_8_SkColorType == requestedInfo.fColorType && NULL == ctable) { return reset_return_false(this); } @@ -950,7 +950,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, Allocator* alloc) // TODO: can we just ref() the src colortable? Is it reentrant-safe? ctable.reset(SkNEW_ARGS(SkColorTable, (*src->getColorTable()))); } - if (!tmpDst.allocPixels(alloc, ctable)) { + if (!tmpDst.tryAllocPixels(alloc, ctable)) { return false; } @@ -1122,7 +1122,7 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint, } else { NO_FILTER_CASE: tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes); - if (!tmpBitmap.allocPixels(allocator, NULL)) { + if (!tmpBitmap.tryAllocPixels(allocator, NULL)) { // Allocation of pixels for alpha bitmap failed. SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", tmpBitmap.width(), tmpBitmap.height()); @@ -1146,7 +1146,7 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint, tmpBitmap.setInfo(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()), dstM.fRowBytes); - if (!tmpBitmap.allocPixels(allocator, NULL)) { + if (!tmpBitmap.tryAllocPixels(allocator, NULL)) { // Allocation of pixels for alpha bitmap failed. SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", tmpBitmap.width(), tmpBitmap.height()); diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 5f205ce1e6..2287864bae 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -82,7 +82,7 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, return NULL; } } else { - if (!bitmap.allocPixels(info)) { + if (!bitmap.tryAllocPixels(info)) { return NULL; } if (!bitmap.info().isOpaque()) { diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 717878c82a..f071fc99fc 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -568,7 +568,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap, int x, int y) { bool weAllocated = false; if (NULL == bitmap->pixelRef()) { - if (!bitmap->allocPixels()) { + if (!bitmap->tryAllocPixels()) { return false; } weAllocated = true; @@ -594,7 +594,7 @@ bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) { return false; } - if (!bitmap->allocN32Pixels(r.width(), r.height())) { + if (!bitmap->tryAllocN32Pixels(r.width(), r.height())) { // bitmap will already be reset. return false; } @@ -1006,7 +1006,7 @@ SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) { fAddr = canvas->peekPixels(&fInfo, &fRowBytes); if (NULL == fAddr) { fInfo = canvas->imageInfo(); - if (kUnknown_SkColorType == fInfo.colorType() || !fBitmap.allocPixels(fInfo)) { + if (kUnknown_SkColorType == fInfo.colorType() || !fBitmap.tryAllocPixels(fInfo)) { return; // failure, fAddr is NULL } if (!canvas->readPixels(&fBitmap, 0, 0)) { @@ -2535,7 +2535,7 @@ SkCanvas* SkCanvas::NewRaster(const SkImageInfo& info) { } SkBitmap bitmap; - if (!bitmap.allocPixels(info)) { + if (!bitmap.tryAllocPixels(info)) { return NULL; } diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index 73ab170f11..a7b5412b5a 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -107,7 +107,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri if (!fCachedBitmapShader || tileScale != fCachedTileScale) { SkBitmap bm; - if (!bm.allocN32Pixels(tileSize.width(), tileSize.height())) { + if (!bm.tryAllocN32Pixels(tileSize.width(), tileSize.height())) { return NULL; } bm.eraseColor(SK_ColorTRANSPARENT); diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index db3c0fb2f5..4d7f3629eb 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -437,7 +437,7 @@ static void generateMask(const SkMask& mask, const SkPath& path, SkBitmap bm; if (0 == dstRB) { - if (!bm.allocPixels(info)) { + if (!bm.tryAllocPixels(info)) { // can't allocate offscreen, so empty the mask and return sk_bzero(mask.fImage, mask.computeImageSize()); return; diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index ce35ba2baa..261640f3e9 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -343,7 +343,7 @@ bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src, return false; } - if (!dst->allocPixels(src.info())) { + if (!dst->tryAllocPixels(src.info())) { return false; } diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp index d08209874b..8590400003 100644 --- a/src/effects/SkBlurImageFilter.cpp +++ b/src/effects/SkBlurImageFilter.cpp @@ -172,7 +172,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy, return false; } - if (!dst->allocPixels(src.info().makeWH(srcBounds.width(), srcBounds.height()))) { + if (!dst->tryAllocPixels(src.info().makeWH(srcBounds.width(), srcBounds.height()))) { return false; } dst->getBounds(&dstBounds); @@ -199,7 +199,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy, } SkBitmap temp; - if (!temp.allocPixels(dst->info())) { + if (!temp.tryAllocPixels(dst->info())) { return false; } diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 5d15b4f8e8..bb71aa13e9 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -254,7 +254,7 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, return false; } - if (!dst->allocPixels(color.info().makeWH(bounds.width(), bounds.height()))) { + if (!dst->tryAllocPixels(color.info().makeWH(bounds.width(), bounds.height()))) { return false; } diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 69e27609f6..1eb2a3642e 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1016,7 +1016,7 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy, return false; } - if (!dst->allocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { + if (!dst->tryAllocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { return false; } @@ -1134,7 +1134,7 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy, return false; } - if (!dst->allocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { + if (!dst->tryAllocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { return false; } diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 70e95f6e77..9293f7fc2a 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -321,7 +321,7 @@ bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src, return false; } - if (!dst->allocPixels(src.info())) { + if (!dst->tryAllocPixels(src.info())) { return false; } diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index aa8b8049c9..c8959eecfb 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -265,7 +265,7 @@ static SkBitmap unpremultiplyBitmap(const SkBitmap& src) return SkBitmap(); } SkBitmap result; - if (!result.allocPixels(src.info())) { + if (!result.tryAllocPixels(src.info())) { return SkBitmap(); } for (int y = 0; y < src.height(); ++y) { @@ -307,7 +307,7 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy, return false; } - if (!result->allocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { + if (!result->tryAllocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { return false; } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 2b9c91eb53..c6c470c390 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -166,7 +166,7 @@ bool SkMorphologyImageFilter::filterImageGeneric(SkMorphologyImageFilter::Proc p return false; } - if (!dst->allocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { + if (!dst->tryAllocPixels(src.info().makeWH(bounds.width(), bounds.height()))) { return false; } @@ -191,7 +191,7 @@ bool SkMorphologyImageFilter::filterImageGeneric(SkMorphologyImageFilter::Proc p } SkBitmap temp; - if (!temp.allocPixels(dst->info())) { + if (!temp.tryAllocPixels(dst->info())) { return false; } diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index b7b2d1a7c6..b51bae4370 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -205,7 +205,7 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds, // allocate the pixels for a bitmap const SkImageInfo bmImageInfo = SkImageInfo::MakeA8(cmpWidth, cmpHeight); if (kBlitter_CompressionMode != fCompressionMode) { - if (!fBM.allocPixels(bmImageInfo)) { + if (!fBM.tryAllocPixels(bmImageInfo)) { return false; } diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp index a07fe67ae4..54497fe8c8 100644 --- a/src/gpu/GrSurface.cpp +++ b/src/gpu/GrSurface.cpp @@ -25,8 +25,7 @@ SkImageInfo GrSurface::info() const { bool GrSurface::savePixels(const char* filename) { SkBitmap bm; - if (!bm.allocPixels(SkImageInfo::MakeN32Premul(this->width(), - this->height()))) { + if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->height()))) { return false; } diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp index d378032c06..2371ea72e3 100644 --- a/src/gpu/SkGrPixelRef.cpp +++ b/src/gpu/SkGrPixelRef.cpp @@ -170,7 +170,7 @@ bool SkGrPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) { top = 0; height = this->info().fHeight; } - if (!dst->allocPixels(SkImageInfo::MakeN32Premul(width, height))) { + if (!dst->tryAllocN32Pixels(width, height)) { SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\n"); return false; } diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 795b8420e6..a6063846c7 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -117,9 +117,8 @@ bool SkImage_Base::onReadPixels(SkBitmap* bitmap, const SkIRect& subset) const { return false; } } else { - const SkImageInfo info = SkImageInfo::MakeN32Premul(subset.width(), subset.height()); SkBitmap tmp; - if (!tmp.allocPixels(info)) { + if (!tmp.tryAllocN32Pixels(subset.width(), subset.height())) { return false; } *bitmap = tmp; diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp index dfa093becc..5c66c94a53 100644 --- a/src/images/SkDecodingImageGenerator.cpp +++ b/src/images/SkDecodingImageGenerator.cpp @@ -69,7 +69,7 @@ public: virtual bool allocPixelRef(SkBitmap* bm, SkColorTable* ct) { if (NULL == fTarget || !equal_modulo_alpha(fInfo, bm->info())) { // Call default allocator. - return bm->allocPixels(NULL, ct); + return bm->tryAllocPixels(NULL, ct); } // TODO(halcanary): verify that all callers of this function diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp index ed2ad164a1..4a5e734628 100644 --- a/src/images/SkImageDecoder.cpp +++ b/src/images/SkImageDecoder.cpp @@ -133,7 +133,7 @@ bool SkImageDecoder::chooseFromOneChoice(SkColorType colorType, int width, int h bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) const { - return bitmap->allocPixels(fAllocator, ctable); + return bitmap->tryAllocPixels(fAllocator, ctable); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp index 9b937162b3..99401e6b62 100644 --- a/src/images/SkImageDecoder_libjpeg.cpp +++ b/src/images/SkImageDecoder_libjpeg.cpp @@ -852,7 +852,7 @@ bool SkJPEGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) { return return_false(*cinfo, bitmap, "allocPixelRef"); } } else { - if (!bitmap.allocPixels()) { + if (!bitmap.tryAllocPixels()) { return return_false(*cinfo, bitmap, "allocPixels"); } } diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp index 01b7c69c25..b69f87996c 100644 --- a/src/images/SkImageDecoder_libpng.cpp +++ b/src/images/SkImageDecoder_libpng.cpp @@ -823,7 +823,7 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) { return false; } } else { - if (!decodedBitmap.allocPixels(NULL, needColorTable ? colorTable : NULL)) { + if (!decodedBitmap.tryAllocPixels(NULL, needColorTable ? colorTable : NULL)) { return false; } } diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp index f7cfa8b4cc..f32587ddcc 100644 --- a/src/images/SkImageDecoder_libwebp.cpp +++ b/src/images/SkImageDecoder_libwebp.cpp @@ -375,7 +375,7 @@ bool SkWEBPImageDecoder::onDecodeSubset(SkBitmap* decodedBitmap, // alloc from native heap if it is a temp bitmap. (prevent GC) bool allocResult = (bitmap == decodedBitmap) ? allocPixelRef(bitmap, NULL) - : bitmap->allocPixels(); + : bitmap->tryAllocPixels(); if (!allocResult) { return return_false(*decodedBitmap, "allocPixelRef"); } diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp index decefd5acc..3810db5662 100644 --- a/src/images/SkMovie_gif.cpp +++ b/src/images/SkMovie_gif.cpp @@ -364,11 +364,11 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm) startIndex = 0; // create bitmap - if (!bm->allocPixels(SkImageInfo::MakeN32Premul(width, height))) { + if (!bm->tryAllocN32Pixels(width, height)) { return false; } // create bitmap for backup - if (!fBackup.allocPixels(SkImageInfo::MakeN32Premul(width, height))) { + if (!fBackup.tryAllocN32Pixels(width, height)) { return false; } } else if (startIndex > fCurrIndex) { diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp index 56431880c9..bd675324f1 100644 --- a/src/lazy/SkCachingPixelRef.cpp +++ b/src/lazy/SkCachingPixelRef.cpp @@ -46,7 +46,7 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) { const SkImageInfo& info = this->info(); if (!SkBitmapCache::Find(this->getGenerationID(), info.fWidth, info.fHeight, &fLockedBitmap)) { // Cache has been purged, must re-decode. - if (!fLockedBitmap.allocPixels(info, fRowBytes)) { + if (!fLockedBitmap.tryAllocPixels(info, fRowBytes)) { fErrorInDecoding = true; return false; } diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp index a86c3deff4..ec8d5ea9af 100644 --- a/src/lazy/SkDiscardablePixelRef.cpp +++ b/src/lazy/SkDiscardablePixelRef.cpp @@ -110,7 +110,7 @@ bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst, SkASSERT(info.colorType() != kUnknown_SkColorType); if (dst->empty()) { // Use a normal pixelref. - return dst->allocPixels(); + return dst->tryAllocPixels(); } SkAutoTUnref<SkDiscardablePixelRef> ref( SkNEW_ARGS(SkDiscardablePixelRef, diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index ec07a8ff0e..f4ea694451 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -2120,7 +2120,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix, const int w = SkScalarCeilToInt(physicalPerspectiveOutline.getBounds().width()); const int h = SkScalarCeilToInt(physicalPerspectiveOutline.getBounds().height()); - if (!perspectiveBitmap.allocPixels(SkImageInfo::MakeN32Premul(w, h))) { + if (!perspectiveBitmap.tryAllocN32Pixels(w, h)) { return; } perspectiveBitmap.eraseColor(SK_ColorTRANSPARENT); diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp index 49460510d9..0c9b7417a1 100644 --- a/src/pdf/SkPDFImage.cpp +++ b/src/pdf/SkPDFImage.cpp @@ -375,8 +375,7 @@ static uint16_t get_argb4444_neighbor_avg_color(const SkBitmap& bitmap, static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap, const SkIRect& srcRect) { SkBitmap outBitmap; - SkAssertResult(outBitmap.allocPixels( - bitmap.info().makeWH(srcRect.width(), srcRect.height()))); + outBitmap.allocPixels(bitmap.info().makeWH(srcRect.width(), srcRect.height())); int dstRow = 0; SkAutoLockPixels outBitmapPixelLock(outBitmap); diff --git a/src/utils/SkPDFRasterizer.cpp b/src/utils/SkPDFRasterizer.cpp index 66634804bc..1cb792fb81 100644 --- a/src/utils/SkPDFRasterizer.cpp +++ b/src/utils/SkPDFRasterizer.cpp @@ -50,7 +50,7 @@ bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) { char *imgData = image.data(); SkBitmap bitmap; - if (!bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height))) { + if (!bitmap.tryAllocN32Pixels(width, height)) { return false; } bitmap.eraseColor(SK_ColorWHITE); diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp index 01b774df09..14a24d8710 100644 --- a/src/utils/mac/SkCreateCGImageRef.cpp +++ b/src/utils/mac/SkCreateCGImageRef.cpp @@ -221,7 +221,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) { int h = (int)CGRectGetHeight(bounds); SkBitmap bitmap; - if (!bitmap.allocPixels(SkImageInfo::MakeN32Premul(w, h))) { + if (!bitmap.tryAllocN32Pixels(w, h)) { return false; } bitmap.eraseColor(SK_ColorWHITE); @@ -287,7 +287,7 @@ bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef image, SkISize* scaleTo SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); SkBitmap tmp; - if (!tmp.allocPixels(info)) { + if (!tmp.tryAllocPixels(info)) { return false; } |