Index: LayoutTests/fast/hidpi/resources/svg_canvas_helper.js |
diff --git a/LayoutTests/fast/hidpi/resources/svg_canvas_helper.js b/LayoutTests/fast/hidpi/resources/svg_canvas_helper.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6da130242a80d0878a39f55e4c06ef57a7aea155 |
--- /dev/null |
+++ b/LayoutTests/fast/hidpi/resources/svg_canvas_helper.js |
@@ -0,0 +1,20 @@ |
+function printSizes(imageId, outputId) { |
+ var image = document.getElementById(imageId); |
+ image.addEventListener('load', function() { |
+ var output = document.getElementById(outputId); |
+ output.innerHTML = 'image stats: ' |
+ + 'size(' + image.width + ',' + image.height + '), ' |
+ + 'naturalSize(' + image.naturalWidth + ',' + image.naturalHeight + ')<br/>' |
+ + 'image codes: ' |
+ + image.outerHTML.replace(/</g, "<").replace(/>/g, ">"); |
+ }); |
+} |
+ |
+function drawCanvas(imageId, canvasId, canvasWidth, canvasHeight) { |
+ var image = document.getElementById(imageId); |
+ var canvas = document.getElementById(canvasId); |
+ canvas.width = canvasWidth; |
+ canvas.height = canvasHeight; |
+ var context = canvas.getContext('2d'); |
+ context.drawImage(image, 0, 0); |
+} |