Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: Source/core/frame/ImageBitmap.cpp

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: mac+win build fix Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())));

Powered by Google App Engine
This is Rietveld 408576698