explicitly call tryAllocPixels if you want to check for failure
allows us to remove SK_SUPPORT_LEGACY_ALLOCPIXELS_BOOL
Change-Id: I095a04e358404bc413ceebe81e7e1adfbbbec027
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 099f1b0..eded678 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -386,7 +386,7 @@
// to/from unpremultiplied bitmaps.
outputBitmap->setInfo(SkImageInfo::Make(scaledWidth, scaledHeight,
colorType, decodingBitmap.alphaType()));
- if (!outputBitmap->allocPixels(outputAllocator, NULL)) {
+ if (!outputBitmap->tryAllocPixels(outputAllocator, NULL)) {
return nullObjectReturn("allocation failed for scaled bitmap");
}
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index 19aad61..265300ed 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -383,7 +383,7 @@
hasAlpha ? kN32_SkColorType : kRGB_565_SkColorType,
kPremul_SkAlphaType);
SkBitmap bitmap;
- if (!bitmap.allocPixels(info)) {
+ if (!bitmap.tryAllocPixels(info)) {
return;
}
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 652492c..ac30bda 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -390,7 +390,7 @@
hasAlpha ? kN32_SkColorType : kRGB_565_SkColorType,
kPremul_SkAlphaType);
SkBitmap* bitmap = new SkBitmap;
- if (!bitmap->allocPixels(info)) {
+ if (!bitmap->tryAllocPixels(info)) {
delete bitmap;
return;
}