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

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: rebase mayhem 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
« no previous file with comments | « Source/core/frame/Frame.cpp ('k') | Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/ImageBitmap.cpp
diff --git a/Source/core/frame/ImageBitmap.cpp b/Source/core/frame/ImageBitmap.cpp
index 27b5c8d64e34a478432110b8274546a41f5ade60..ec54c645533cccae4a850809fe191e67073c4ae5 100644
--- a/Source/core/frame/ImageBitmap.cpp
+++ b/Source/core/frame/ImageBitmap.cpp
@@ -63,7 +63,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 +99,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())));
« no previous file with comments | « Source/core/frame/Frame.cpp ('k') | Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698