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

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

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: applied last corrections Created 6 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 | « Source/core/frame/ImageBitmap.h ('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 53567bd01655417a20ddcb3b9c280d32ba29d7a1..2b358b247a4a44f34af2e63ae90e070233cd0cda 100644
--- a/Source/core/frame/ImageBitmap.cpp
+++ b/Source/core/frame/ImageBitmap.cpp
@@ -200,4 +200,28 @@ 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 | « Source/core/frame/ImageBitmap.h ('k') | Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698