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

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: update layout expectation Created 4 years, 4 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..00151790e6030a77a65950662e65cd452ee60b1c
--- /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";
+}, 'createImageBitmap from a HTMLVideoElement with resize option.');
Justin Novosad 2016/08/25 19:18:19 Wrong text here.
xidachen 2016/08/26 02:21:39 Done.
+</script>

Powered by Google App Engine
This is Rietveld 408576698