Bug 1392143 - P6. Use constants in coordinate calculations. r=mattwoodrow
☠☠ backed out by b206bbf564fb ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 07 Sep 2017 19:36:20 +0200
changeset 429071 5e167360b1f93acf1962e782a1f9e8a9ea7819f3
parent 429070 c1fcfceeefae9a3c5df092f8fce41e07e1d6ddc5
child 429072 e5e14cc4b4a8c12399b728610fa52e5bb7888cbb
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1392143
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1392143 - P6. Use constants in coordinate calculations. r=mattwoodrow This shows how the coordinates were actually calculated. and will make it easier should the video size needs to ever be changed again. MozReview-Commit-ID: KkQNqz00Aw0
toolkit/components/gfx/SanityTest.js
--- a/toolkit/components/gfx/SanityTest.js
+++ b/toolkit/components/gfx/SanityTest.js
@@ -13,17 +13,20 @@ const XUL_NS = "http://www.mozilla.org/k
 const FRAME_SCRIPT_URL = "chrome://gfxsanity/content/gfxFrameScript.js";
 
 const PAGE_WIDTH = 160;
 const PAGE_HEIGHT = 234;
 const LEFT_EDGE = 8;
 const TOP_EDGE = 8;
 const CANVAS_WIDTH = 32;
 const CANVAS_HEIGHT = 64;
-
+// If those values are ever changed, make sure to update
+// WMFVideoMFTManager::CanUseDXVA accordingly.
+const VIDEO_WIDTH = 132;
+const VIDEO_HEIGHT = 132;
 const DRIVER_PREF = "sanity-test.driver-version";
 const DEVICE_PREF = "sanity-test.device-id";
 const VERSION_PREF = "sanity-test.version";
 const ADVANCED_LAYERS_PREF = "sanity-test.advanced-layers";
 const DISABLE_VIDEO_PREF = "media.hardware-video-decoding.failed";
 const RUNNING_PREF = "sanity-test.running";
 const TIMEOUT_SEC = 20;
 
@@ -102,31 +105,29 @@ function takeWindowSnapshot(win, ctx) {
   var flags = ctx.DRAWWINDOW_DRAW_CARET | ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_USE_WIDGET_LAYERS;
   ctx.drawWindow(win.ownerGlobal, 0, 0, PAGE_WIDTH, PAGE_HEIGHT, "rgb(255,255,255)", flags);
 }
 
 // Verify that all the 4 coloured squares of the video
 // render as expected (with a tolerance of 64 to allow for
 // yuv->rgb differences between platforms).
 //
-// The video is 132*132, and is split into quadrants of
-// different colours. The top left of the video is 8,72
-// and we test a pixel 33,33 into each quadrant to avoid
+// The video is VIDEO_WIDTH*VIDEO_HEIGHT, and is split into quadrants of
+// different colours. The top left of the video is LEFT_EDGE,TOP_EDGE+CANVAS_HEIGHT
+// and we test a pixel into the middle of each quadrant to avoid
 // blending differences at the edges.
-// If those values are ever changed, make sure to update
-// WMFVideoMFTManager::CanUseDXVA accordingly.
 //
 // We allow massive amounts of fuzz for the colours since
 // it can depend hugely on the yuv -> rgb conversion, and
 // we don't want to fail unnecessarily.
 function verifyVideoRendering(ctx) {
-  return testPixel(ctx, 41, 105, 255, 255, 255, 255, 64) &&
-    testPixel(ctx, 107, 105, 0, 255, 0, 255, 64) &&
-    testPixel(ctx, 41, 171, 0, 0, 255, 255, 64) &&
-    testPixel(ctx, 107, 171, 255, 0, 0, 255, 64);
+  return testPixel(ctx, LEFT_EDGE + VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + VIDEO_HEIGHT / 4, 255, 255, 255, 255, 64) &&
+    testPixel(ctx, LEFT_EDGE + 3 * VIDEO_WIDTH / 4,  TOP_EDGE + CANVAS_HEIGHT + VIDEO_HEIGHT / 4, 0, 255, 0, 255, 64) &&
+    testPixel(ctx, LEFT_EDGE + VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + 3 * VIDEO_HEIGHT / 4, 0, 0, 255, 255, 64) &&
+    testPixel(ctx, LEFT_EDGE+ 3 * VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + 3 * VIDEO_HEIGHT / 4, 255, 0, 0, 255, 64);
 }
 
 // Verify that the middle of the layers test is the color we expect.
 // It's a red CANVAS_WIDTHxCANVAS_HEIGHT square, test a pixel deep into the
 // square to prevent fuzzing, and another outside the expected limit of the
 // square to check that scaling occurred properly. The square is drawn LEFT_EDGE
 // pixels from the window's left edge and TOP_EDGE from the window's top edge.
 function verifyLayersRendering(ctx) {