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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothing-disabled-scaling-down.html

Issue 2157953002: Change filter quality when scaling-down in drawImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test expectation Created 4 years, 5 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 | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingQuality.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothing-disabled-scaling-down.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothing-disabled-scaling-down.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothing-disabled-scaling-down.html
new file mode 100644
index 0000000000000000000000000000000000000000..a5b032f271b8b30685f4343710360f55226934f3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothing-disabled-scaling-down.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+function getCanvasDataFromDrawImage(source, disableSmoothing)
+{
+ var canvas = document.createElement("canvas");
+ canvas.width = 100;
+ canvas.height = 100;
+ var ctx = canvas.getContext("2d");
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.scale(0.9, 0.9);
+ ctx.rotate(45 * Math.PI / 180);
+ if (disableSmoothing)
+ ctx.imageSmoothingEnabled = false;
+ ctx.drawImage(source, 0, 0, source.width, source.height, 0, 0, 100, 100);
+ var d = ctx.getImageData(0, 0, 100, 100).data;
+ return d;
+}
+
+test(function() {
+ var canvas = document.createElement('canvas');
+ canvas.height = 100;
+ canvas.width = 100;
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = '#FF0000';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ var data1 = getCanvasDataFromDrawImage(canvas, false);
+ var data2 = getCanvasDataFromDrawImage(canvas, true);
+ assert_array_equals(data1, data2, "drawImage() should have the same results with imageSmoothingEnabled = true and false when scaling down.");
+}, 'Test drawImage with imageSmoothingEnabled=false and scaling down the source.');
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingQuality.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698