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

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

Issue 758493004: canvas: make a temporary buffer when a context doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 50290cbbeced454f1e425d3d0bf3966b3e73ba75..789b861c9e2a1b8f1bec8e32ba72f057ff50bfb0 100644
--- a/Source/core/frame/ImageBitmap.cpp
+++ b/Source/core/frame/ImageBitmap.cpp
@@ -5,10 +5,8 @@
#include "config.h"
#include "core/frame/ImageBitmap.h"
-#include "core/html/HTMLCanvasElement.h"
#include "core/html/HTMLVideoElement.h"
#include "core/html/ImageData.h"
-#include "core/html/canvas/CanvasRenderingContext.h"
#include "platform/graphics/BitmapImage.h"
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/ImageBuffer.h"
@@ -75,20 +73,6 @@ ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())), srcRect.size());
}
-ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
- : m_imageElement(nullptr)
- , m_cropRect(cropRect)
- , m_bitmapOffset(IntPoint())
-{
- CanvasRenderingContext* sourceContext = canvas->renderingContext();
- if (sourceContext && sourceContext->is3d())
- sourceContext->paintRenderingResultsToCanvas(BackBuffer);
-
- IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size()));
- m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())), srcRect.size());
- m_bitmap = cropImage(canvas->buffer()->copyImage(CopyBackingStore).get(), cropRect);
-}
-
ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect)
: m_imageElement(nullptr)
, m_cropRect(cropRect)
@@ -154,12 +138,6 @@ PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video,
return adoptRefWillBeNoop(new ImageBitmap(video, normalizedCropRect));
}
-PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect)
-{
- IntRect normalizedCropRect = normalizeRect(cropRect);
- return adoptRefWillBeNoop(new ImageBitmap(canvas, normalizedCropRect));
-}
-
PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect)
{
IntRect normalizedCropRect = normalizeRect(cropRect);

Powered by Google App Engine
This is Rietveld 408576698