Title: [106837] branches/safari-534.54-branch/Source/WebCore

Diff

Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (106836 => 106837)


--- branches/safari-534.54-branch/Source/WebCore/ChangeLog	2012-02-06 20:54:13 UTC (rev 106836)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog	2012-02-06 20:56:38 UTC (rev 106837)
@@ -1,5 +1,30 @@
 2011-02-06  Lucas Forschler  <[email protected]>
 
+    Merge 106729
+
+    2012-02-03  Tim Horton  <[email protected]>
+
+            Canvas-into-canvas drawing should respect backing store scale ratio
+            https://bugs.webkit.org/show_bug.cgi?id=77784
+            <rdar://problem/10549729>
+
+            Reviewed by Dan Bernstein.
+
+            Respect the backing store scale ratio when drawing a canvas into another
+            canvas via ctx.drawImage(canvas, x, y). Previous behavior caused canvas
+            drawing to differ based on the size of the backing store, which is ideally
+            an implementation detail to authors.
+
+            Also, rename the source canvas arguments to CanvasRenderingContext2D::drawImage
+            to be more clear.
+
+            No new tests.
+
+            * html/canvas/CanvasRenderingContext2D.cpp:
+            (WebCore::CanvasRenderingContext2D::drawImage):
+
+2011-02-06  Lucas Forschler  <[email protected]>
+
     Merge 104356
 
     2012-01-06  Tim Horton  <[email protected]>

Modified: branches/safari-534.54-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (106836 => 106837)


--- branches/safari-534.54-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-02-06 20:54:13 UTC (rev 106836)
+++ branches/safari-534.54-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-02-06 20:56:38 UTC (rev 106837)
@@ -1320,38 +1320,31 @@
     didDraw(normalizedDstRect);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionCode& ec)
 {
-    if (!canvas) {
+    if (!sourceCanvas) {
         ec = TYPE_MISMATCH_ERR;
         return;
     }
 
-    // In order to emulate drawing the result of toDataURL() into the canvas, we
-    // need to deflate the size of the source rectangle by the source canvas's
-    // backing store scale factor.
-    // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=15041 for motivation.
-
-    FloatSize logicalSize = canvas->convertDeviceToLogical(canvas->size());
-
-    drawImage(canvas, 0, 0, logicalSize.width(), logicalSize.height(), x, y, canvas->width(), canvas->height(), ec);
+    drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(), x, y, sourceCanvas->width(), sourceCanvas->height(), ec);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas,
+void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas,
     float x, float y, float width, float height, ExceptionCode& ec)
 {
-    if (!canvas) {
+    if (!sourceCanvas) {
         ec = TYPE_MISMATCH_ERR;
         return;
     }
-    drawImage(canvas, FloatRect(0, 0, canvas->width(), canvas->height()), FloatRect(x, y, width, height), ec);
+    drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas->height()), FloatRect(x, y, width, height), ec);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas,
+void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas,
     float sx, float sy, float sw, float sh,
     float dx, float dy, float dw, float dh, ExceptionCode& ec)
 {
-    drawImage(canvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec);
+    drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const FloatRect& srcRect,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to