wiki:2014 Meeting Subpixel Layout

Version 1 (modified by Bem Jones-Bey, 10 years ago) (diff)


Subpixel Layout

Started by Google 2 years ago

  • to do better space distribution in the short term
    • sub pixel layout
  • support hiDPI displays by painting on odd device pixels in the long term
    • sub pixel painting

Subpixel Layout works right now has some directional rounding errors for non-horizontal-tb flows Subpixel painting/rendering work in progress

how does it work?

what is a layout unit

  • made integer based to support fractional values without the burden of float arithmetic
  • 1 layout unit == 1/64 CSS pixels
  • Layout units are not rounded/etc during layout except in some cases, like in RenderLayer
  • value is snapped during painting time

how does snapping work?

  • float value gets snapped to device pixel boundary, still a float after being snapped
  • this mostly happens in paint() in RenderObject classes
  • can't do in GraphicsContext since sometimes you need to do floor or ceil instead of rounding
    • border types like groove, ridge, double require floor/ceil to keep the spacing


  • prefix test case with 'hidpi-'
    • that will cause the test framework to switch to hidpi mode