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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html

Issue 2276033002: Pass SkPaint instead of its alpha and mode in WebMediaPlayer::paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android should compile Created 4 years, 3 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
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html
new file mode 100644
index 0000000000000000000000000000000000000000..eff78293a56a37afa42ad4771b7857ea108e1ec1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+function createNewCanvas(width, height)
+{
+ var canvas = document.createElement("canvas");
+ canvas.width = width;
+ canvas.height = height;
+ var ctx = canvas.getContext("2d");
+ ctx.clearRect(0, 0, width, height);
+ return ctx;
+}
+
+function compareTwoCanvases(ctx1, ctx2, width, height)
+{
+ var data1 = ctx1.getImageData(0, 0, width, height).data;
+ var data2 = ctx2.getImageData(0, 0, width, height).data;
+ var dataMatched = true;
+ for (var i = 0; i < data1.length; i++) {
+ if (data1[i] != data2[i]) {
+ dataMatched = false;
+ break;
+ }
+ }
+ assert_false(dataMatched);
+}
+
+async_test(function(t) {
+ var video = document.createElement("video");
+ video.oncanplaythrough = t.step_func_done(function() {
+ video.pause();
+ var width = 100;
+ var height = 100;
+ var ctx1 = createNewCanvas(width, height);
+ var ctx2 = createNewCanvas(width, height);
+ ctx1.imageSmoothingEnabled = true;
+ ctx1.imageSmoothingQuality = 'low';
+ ctx2.imageSmoothingEnabled = true;
+ ctx2.imageSmoothingQuality = 'high';
+ ctx1.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, width, height);
+ ctx2.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, width, height);
+ compareTwoCanvases(ctx1, ctx2, width, height);
+ });
+ video.src = "../../compositing/resources/video.ogv";
+}, 'drawImage from a video should look differently with different imageSmoothingQuality');
+</script>

Powered by Google App Engine
This is Rietveld 408576698