webrender: Don't use OpenGL round() for snapping pixels

Fixes #11751.
This commit is contained in:
Matt Brubeck 2016-06-20 08:41:10 -07:00
parent bc2f4c3450
commit 6c00058c5d
6 changed files with 42 additions and 2 deletions

View file

@ -65,6 +65,6 @@ vec2 SnapToPixels(vec2 pos)
// Snap the vertex to pixel position to guarantee correct texture
// sampling when using bilinear filtering.
// TODO(gw): ES2 doesn't have round(). Do we ever get negative coords here?
// TODO(gw): Do we ever get negative coords here?
return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio;
}

View file

@ -62,5 +62,8 @@ vec2 SnapToPixels(vec2 pos)
{
// Snap the vertex to pixel position to guarantee correct texture
// sampling when using bilinear filtering.
return round(pos * uDevicePixelRatio) / uDevicePixelRatio;
// Don't use round() because its behavior is implementation-defined on 0.5.
// TODO: Do we ever get negative coords here?
return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio;
}

View file

@ -3986,6 +3986,18 @@
"viewport_size": "300x300"
}
],
"css/pixel_snapping_glyphs.html": [
{
"path": "css/pixel_snapping_glyphs.html",
"references": [
[
"/_mozilla/css/pixel_snapping_glyphs_ref.html",
"=="
]
],
"url": "/_mozilla/css/pixel_snapping_glyphs.html"
}
],
"css/pixel_snapping_position_a.html": [
{
"dpi": "2",
@ -11026,6 +11038,18 @@
"viewport_size": "300x300"
}
],
"css/pixel_snapping_glyphs.html": [
{
"path": "css/pixel_snapping_glyphs.html",
"references": [
[
"/_mozilla/css/pixel_snapping_glyphs_ref.html",
"=="
]
],
"url": "/_mozilla/css/pixel_snapping_glyphs.html"
}
],
"css/pixel_snapping_position_a.html": [
{
"dpi": "2",

View file

@ -0,0 +1,4 @@
[pixel_snapping_glyphs.html]
type: reftest
expected:
if os == "mac": FAIL

View file

@ -0,0 +1,5 @@
<!doctype html>
<meta charset="utf-8">
<title>pixel snapping glyphs test</title>
<link rel="match" href="pixel_snapping_glyphs_ref.html">
<div style="font: 13px 'Helvetica Neue'; padding: 0.5px;">illisible</div>

View file

@ -0,0 +1,4 @@
<!doctype html>
<meta charset="utf-8">
<title>pixel snapping glyphs reference</title>
<div style="font: 13px 'Helvetica Neue'; padding: 1px;">illisible</div>