summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorreed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-24 13:30:39 +0000
committerreed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-24 13:30:39 +0000
commitbe44c2b278ccbb8602ff254806e160e606661c3b (patch)
tree4c1f7bdab89f8251f6a317fe91dba69653ab4826 /skia
parent7685135e75cd186aed942f78fc46779e255dc63f (diff)
downloadchromium_src-be44c2b278ccbb8602ff254806e160e606661c3b.zip
chromium_src-be44c2b278ccbb8602ff254806e160e606661c3b.tar.gz
chromium_src-be44c2b278ccbb8602ff254806e160e606661c3b.tar.bz2
check for allocPixels failures during resize
Review URL: http://codereview.chromium.org/7685056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/image_operations.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc
index 0f19d21..7808370 100644
--- a/skia/ext/image_operations.cc
+++ b/skia/ext/image_operations.cc
@@ -409,7 +409,13 @@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
result.setConfig(SkBitmap::kARGB_8888_Config, dest_subset.width(),
dest_subset.height());
result.allocPixels();
+ if (!result.readyToDraw())
+ return img;
+
SkAutoLockPixels locker(img);
+ if (!img.readyToDraw())
+ return img;
+
uint32* src_row = img.getAddr32(0, 0);
uint32* dst_row = result.getAddr32(0, 0);
for (int y = 0; y < dest_subset.height(); y++) {
@@ -503,6 +509,8 @@ SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
(method <= ImageOperations::RESIZE_LAST_ALGORITHM_METHOD));
SkAutoLockPixels locker(source);
+ if (!source.readyToDraw())
+ return SkBitmap();
ResizeFilter filter(method, source.width(), source.height(),
dest_width, dest_height, dest_subset);
@@ -519,6 +527,9 @@ SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
result.setConfig(SkBitmap::kARGB_8888_Config,
dest_subset.width(), dest_subset.height());
result.allocPixels();
+ if (!result.readyToDraw())
+ return SkBitmap();
+
BGRAConvolve2D(source_subset, static_cast<int>(source.rowBytes()),
!source.isOpaque(), filter.x_filter(), filter.y_filter(),
static_cast<int>(result.rowBytes()),