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

Unified Diff: sky/engine/core/frame/ImageBitmap.cpp

Issue 1001913003: Remove <canvas> (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months 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 | « sky/engine/core/frame/ImageBitmap.h ('k') | sky/engine/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/frame/ImageBitmap.cpp
diff --git a/sky/engine/core/frame/ImageBitmap.cpp b/sky/engine/core/frame/ImageBitmap.cpp
index 1927ce2ddbc21387dba7b6003cc78ce907200920..dce731e045f8224583306bd15c9bee4af6b3e966 100644
--- a/sky/engine/core/frame/ImageBitmap.cpp
+++ b/sky/engine/core/frame/ImageBitmap.cpp
@@ -5,9 +5,7 @@
#include "sky/engine/config.h"
#include "sky/engine/core/frame/ImageBitmap.h"
-#include "sky/engine/core/html/HTMLCanvasElement.h"
#include "sky/engine/core/html/ImageData.h"
-#include "sky/engine/core/html/canvas/CanvasRenderingContext.h"
#include "sky/engine/platform/graphics/BitmapImage.h"
#include "sky/engine/platform/graphics/GraphicsContext.h"
#include "sky/engine/platform/graphics/ImageBuffer.h"
@@ -50,20 +48,6 @@ ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect)
}
-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();
-
- 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)
@@ -123,12 +107,6 @@ PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRe
return adoptRef(new ImageBitmap(image, normalizedCropRect));
}
-PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect)
-{
- IntRect normalizedCropRect = normalizeRect(cropRect);
- return adoptRef(new ImageBitmap(canvas, normalizedCropRect));
-}
-
PassRefPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect)
{
IntRect normalizedCropRect = normalizeRect(cropRect);
@@ -162,28 +140,4 @@ PassRefPtr<Image> ImageBitmap::bitmapImage() const
return m_bitmap;
}
-PassRefPtr<Image> ImageBitmap::getSourceImageForCanvas(SourceImageMode, SourceImageStatus* status) const
-{
- *status = NormalSourceImageStatus;
- return bitmapImage();
-}
-
-void ImageBitmap::adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const
-{
- FloatRect intersectRect = intersection(m_bitmapRect, *srcRect);
- FloatRect newSrcRect = intersectRect;
- newSrcRect.move(m_bitmapOffset - m_bitmapRect.location());
- FloatRect newDstRect(FloatPoint(intersectRect.location() - srcRect->location()), m_bitmapRect.size());
- newDstRect.scale(dstRect->width() / srcRect->width() * intersectRect.width() / m_bitmapRect.width(),
- dstRect->height() / srcRect->height() * intersectRect.height() / m_bitmapRect.height());
- newDstRect.moveBy(dstRect->location());
- *srcRect = newSrcRect;
- *dstRect = newDstRect;
-}
-
-FloatSize ImageBitmap::sourceSize() const
-{
- return FloatSize(width(), height());
-}
-
}
« no previous file with comments | « sky/engine/core/frame/ImageBitmap.h ('k') | sky/engine/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698