diff options
author | Ben Murdoch <benm@google.com> | 2011-10-17 13:11:00 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-10-17 18:13:15 +0100 |
commit | 50dfa6485ba2846de19ccb19bda0872ced920e17 (patch) | |
tree | 7382de4413bd4fa277b55f0a27833ede4efa01a6 /Source/WebCore/platform | |
parent | 32ed6f0793dd80c69edf2c7613b58df55ce211f3 (diff) | |
download | external_webkit-50dfa6485ba2846de19ccb19bda0872ced920e17.zip external_webkit-50dfa6485ba2846de19ccb19bda0872ced920e17.tar.gz external_webkit-50dfa6485ba2846de19ccb19bda0872ced920e17.tar.bz2 |
Fix crash in ImageBufferAndroid.
In the case that we do not have sufficient free
memory to create a copy of a bitmap, we must return
an Image wrapping an empty bitmap, rather than
null itself.
This handling is particular (but not exclusive) to
Android, where we cannot pass a null NativeImagePtr
like some other platforms do (as we need it to be
valid in the BitmapImage constructor).
Bug:5409973
Change-Id: I888cf1db73a9176db2a3ea2721ca0e258d9c7773
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r-- | Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp index bbde998..691fbca 100644 --- a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp @@ -85,11 +85,9 @@ PassRefPtr<Image> ImageBuffer::copyImage() const SkDevice* device = canvas->getDevice(); const SkBitmap& orig = device->accessBitmap(false); - if (!PlatformBridge::canSatisfyMemoryAllocation(orig.getSize())) - return 0; - SkBitmap copy; - orig.copyTo(©, orig.config()); + if (PlatformBridge::canSatisfyMemoryAllocation(orig.getSize())) + orig.copyTo(©, orig.config()); SkBitmapRef* ref = new SkBitmapRef(copy); RefPtr<Image> image = BitmapImage::create(ref, 0); |