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

Unified Diff: Source/core/html/HTMLCanvasElement.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/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLCanvasElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 24bd1e3bee912b6a8d843fb1362c0aff6b18c242..3fa3d4499e79ebd1a73f5fa51f7b8be9e4b12370 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -599,4 +599,40 @@ void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument)
HTMLElement::didMoveToNewDocument(oldDocument);
}
+PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mode, SourceImageStatus* status) const
+{
+ if (!width() || !height()) {
+ *status = ZeroSizeCanvasSourceImageStatus;
+ return nullptr;
+ }
+
+ if (!buffer()) {
+ *status = InvalidSourceImageStatus;
+ return nullptr;
+ }
+
+ if (mode == CopySourceImageIfVolatile) {
+ *status = NormalSourceImageStatus;
+ return copiedImage();
+ }
+
+ if (m_context && m_context->is3d()) {
+ m_context->paintRenderingResultsToCanvas();
+ *status = ExternalSourceImageStatus;
+ } else {
+ *status = NormalSourceImageStatus;
+ }
+ return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled);
+}
+
+bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const
+{
+ return !originClean();
+}
+
+FloatSize HTMLCanvasElement::sourceSize() const
+{
+ return FloatSize(width(), height());
+}
+
}
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/HTMLCanvasElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698