mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #11801 - mbrubeck:snaptopix, r=pcwalton
webrender: Don't use OpenGL round() for snapping pixels Fixes #11751. See servo/webrender#294 for some details. r? @pcwalton <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11801) <!-- Reviewable:end -->
This commit is contained in:
commit
461d7c4eeb
6 changed files with 42 additions and 2 deletions
|
@ -65,6 +65,6 @@ vec2 SnapToPixels(vec2 pos)
|
||||||
// Snap the vertex to pixel position to guarantee correct texture
|
// Snap the vertex to pixel position to guarantee correct texture
|
||||||
// sampling when using bilinear filtering.
|
// 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;
|
return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,5 +62,8 @@ vec2 SnapToPixels(vec2 pos)
|
||||||
{
|
{
|
||||||
// Snap the vertex to pixel position to guarantee correct texture
|
// Snap the vertex to pixel position to guarantee correct texture
|
||||||
// sampling when using bilinear filtering.
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4022,6 +4022,18 @@
|
||||||
"viewport_size": "300x300"
|
"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": [
|
"css/pixel_snapping_position_a.html": [
|
||||||
{
|
{
|
||||||
"dpi": "2",
|
"dpi": "2",
|
||||||
|
@ -11122,6 +11134,18 @@
|
||||||
"viewport_size": "300x300"
|
"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": [
|
"css/pixel_snapping_position_a.html": [
|
||||||
{
|
{
|
||||||
"dpi": "2",
|
"dpi": "2",
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[pixel_snapping_glyphs.html]
|
||||||
|
type: reftest
|
||||||
|
expected:
|
||||||
|
if os == "mac": FAIL
|
5
tests/wpt/mozilla/tests/css/pixel_snapping_glyphs.html
Normal file
5
tests/wpt/mozilla/tests/css/pixel_snapping_glyphs.html
Normal 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>
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue