Chromium Code Reviews| Index: Source/core/frame/ImageBitmap.cpp |
| diff --git a/Source/core/frame/ImageBitmap.cpp b/Source/core/frame/ImageBitmap.cpp |
| index 27b5c8d64e34a478432110b8274546a41f5ade60..19a1c9b0f2a8d81a05922426d1853b4a129ed594 100644 |
| --- a/Source/core/frame/ImageBitmap.cpp |
| +++ b/Source/core/frame/ImageBitmap.cpp |
| @@ -12,6 +12,7 @@ |
| #include "platform/graphics/BitmapImage.h" |
| #include "platform/graphics/GraphicsContext.h" |
| #include "platform/graphics/ImageBuffer.h" |
| +#include "platform/graphics/UnacceleratedImageBufferSurface.h" |
|
Stephen White
2013/12/09 15:33:08
Please remove this if it's no longer necessary.
|
| #include "wtf/RefPtr.h" |
| using namespace std; |
| @@ -63,7 +64,9 @@ ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect) |
| IntRect srcRect = intersection(cropRect, videoRect); |
| IntRect dstRect(IntPoint(), srcRect.size()); |
| - OwnPtr<ImageBuffer> buf = ImageBuffer::create(videoRect.size(), 1, UnacceleratedNonPlatformBuffer); |
| + OwnPtr<ImageBuffer> buf = ImageBuffer::create(videoRect.size()); |
| + if (!buf) |
| + return; |
| GraphicsContext* c = buf->context(); |
| c->clip(dstRect); |
| c->translate(-srcRect.x(), -srcRect.y()); |
| @@ -97,7 +100,9 @@ ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect) |
| { |
| IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size())); |
| - OwnPtr<ImageBuffer> buf = ImageBuffer::create(data->size(), 1, UnacceleratedNonPlatformBuffer); |
| + OwnPtr<ImageBuffer> buf = ImageBuffer::create(data->size()); |
| + if (!buf) |
| + return; |
| if (srcRect.width() > 0 && srcRect.height() > 0) |
| buf->putByteArray(Premultiplied, data->data(), data->size(), srcRect, IntPoint(min(0, -cropRect.x()), min(0, -cropRect.y()))); |