Skip to content

Commit

Permalink
Fix scaling issue in canvas image rendering test (#3236)
Browse files Browse the repository at this point in the history
IIUC the issue is scaling can happen edge cases, especially
given some APIs render with flipped Y so in the pixelated/crisp-edges
case they might choose a different edge than the canvas API.

Making the display size exactly double the rendered size seems like it
might solve this issue. The test would still show a difference between
image-rendering: initial and image-rendeirng: pixelated / crisp-edges
but should probably not show any difference otherwise
  • Loading branch information
greggman authored Jan 4, 2024
1 parent ae15a59 commit 67c1786
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<link rel="help" href="https://gpuweb.github.io/gpuweb/" />
<meta name="assert" content="WebGPU canvas with image-rendering set should be rendered correctly" />
<link rel="match" href="./ref/canvas_image_rendering-ref.html" />
<canvas id="elem1" width="64" height="64" style="width: 99px; height: 99px;"></canvas>
<canvas id="elem2" width="64" height="64" style="width: 99px; height: 99px; image-rendering: pixelated;"></canvas>
<canvas id="elem3" width="64" height="64" style="width: 99px; height: 99px; image-rendering: crisp-edges"></canvas>
<canvas id="elem4" width="64" height="64" style="width: 99px; height: 99px;"></canvas>
<canvas id="elem5" width="64" height="64" style="width: 99px; height: 99px; image-rendering: pixelated;"></canvas>
<canvas id="elem6" width="64" height="64" style="width: 99px; height: 99px; image-rendering: crisp-edges"></canvas>
<canvas id="elem1" width="64" height="64" style="width: 128px; height: 128px;"></canvas>
<canvas id="elem2" width="64" height="64" style="width: 128px; height: 128px; image-rendering: pixelated;"></canvas>
<canvas id="elem3" width="64" height="64" style="width: 128px; height: 128px; image-rendering: crisp-edges"></canvas>
<canvas id="elem4" width="64" height="64" style="width: 128px; height: 128px;"></canvas>
<canvas id="elem5" width="64" height="64" style="width: 128px; height: 128px; image-rendering: pixelated;"></canvas>
<canvas id="elem6" width="64" height="64" style="width: 128px; height: 128px; image-rendering: crisp-edges"></canvas>
<script type="module" src="canvas_image_rendering.html.js"></script>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<title>WebGPU canvas_image_rendering (ref)</title>
<meta charset="utf-8" />
<link rel="help" href="https://gpuweb.github.io/gpuweb/" />
<img id="elem1" width="64" height="64" style="width: 99px; height: 99px;">
<img id="elem2" width="64" height="64" style="width: 99px; height: 99px; image-rendering: pixelated;">
<img id="elem3" width="64" height="64" style="width: 99px; height: 99px; image-rendering: crisp-edges">
<img id="elem4" width="64" height="64" style="width: 99px; height: 99px;">
<img id="elem5" width="64" height="64" style="width: 99px; height: 99px; image-rendering: pixelated;">
<img id="elem6" width="64" height="64" style="width: 99px; height: 99px; image-rendering: crisp-edges">
<img id="elem1" width="64" height="64" style="width: 128px; height: 128px;">
<img id="elem2" width="64" height="64" style="width: 128px; height: 128px; image-rendering: pixelated;">
<img id="elem3" width="64" height="64" style="width: 128px; height: 128px; image-rendering: crisp-edges">
<img id="elem4" width="64" height="64" style="width: 128px; height: 128px;">
<img id="elem5" width="64" height="64" style="width: 128px; height: 128px; image-rendering: pixelated;">
<img id="elem6" width="64" height="64" style="width: 128px; height: 128px; image-rendering: crisp-edges">
<script type="module">
import { takeScreenshotDelayed } from '../../../../common/util/wpt_reftest_wait.js';

Expand Down

0 comments on commit 67c1786

Please sign in to comment.