| 1 | == Subpixel Layout == |
| 2 | |
| 3 | Started by Google 2 years ago |
| 4 | |
| 5 | * to do better space distribution in the short term |
| 6 | * sub pixel layout |
| 7 | |
| 8 | * support hiDPI displays by painting on odd device pixels in the long term |
| 9 | * sub pixel painting |
| 10 | |
| 11 | Subpixel Layout works right now |
| 12 | has some directional rounding errors for non-horizontal-tb flows |
| 13 | Subpixel painting/rendering |
| 14 | work in progress |
| 15 | |
| 16 | === how does it work? === |
| 17 | |
| 18 | ==== what is a layout unit ==== |
| 19 | |
| 20 | * made integer based to support fractional values without the burden of float arithmetic |
| 21 | * 1 layout unit == 1/64 CSS pixels |
| 22 | |
| 23 | * Layout units are not rounded/etc during layout except in some cases, like in RenderLayer |
| 24 | |
| 25 | * value is snapped during painting time |
| 26 | |
| 27 | ==== how does snapping work? ==== |
| 28 | |
| 29 | * float value gets snapped to device pixel boundary, still a float after being snapped |
| 30 | * this mostly happens in paint() in RenderObject classes |
| 31 | * can't do in GraphicsContext since sometimes you need to do floor or ceil instead of rounding |
| 32 | * border types like groove, ridge, double require floor/ceil to keep the spacing |
| 33 | |
| 34 | ==== Testing ==== |
| 35 | |
| 36 | * prefix test case with 'hidpi-' |
| 37 | * that will cause the test framework to switch to hidpi mode |
| 38 | |
| 39 | |