<div style="will-change: transform,filter; transform:translate(0.4px, 0.6px); width: 100px; height: 100px">
Text
</div>
which currently produces the following render passes and quads:
RenderPass
CompositorRenderPassDrawQuad (transform=translate(8.4,8.6) tex_coord_rect=(0,0 100x100))
RenderPass
TileDrawQuad (transform=identity, tex_coord_rect=(0,0 100x100))
tile texture
The text is blurry due to the fractional transform.
I tried two methods:
1. (
CL) Exclude subpixel fraction from RenderSurface::draw_transform(), and apply that fraction to contributing layers and render surfaces, then the fraction will be applied to the texture as a
raster translation (an existing mechanism to make the text clear in a PictureLayerImpl under fractional transform).
RenderPass
CompositorRenderPassDrawQuad (transform=translate(8,8) text_coord_rect=(0,0 100x100))
RenderPass
TileDrawQuad (transform=translate(0.4,0.6), text_coord_rect=(0.4,0.6 100x100)
texture drawn under translate(0.4,0.6)
RenderPass
CompositorRenderPassDrawQuad (transform=translate(8.4,8.6) text_coord_rect=(0.4,0.6 100x100))
RenderPass
TileDrawQuad (transform=identity, text_coord_rect=(0,0 100x100))
texture drawn under translate(0.4,0.6)
Both basically work, with problems. #1 will introduce inconsistency between the render surface draw properties and the property trees, which is error-prone, so I'm inclined to abandon it.
However, #2 seems to work with the software renderer only. The text is sharp on Linux cloudtop by default, but is blurry otherwise (e.g. with -use-gl=angle --use-angle=swiftshader). My question is: Is the RenderPass tree in #2 supposed to align texels and screen pixels? If yes, there seems to be a bug in SkiaRenderer. If not, is there a way to align pixels without changing the render surface transform?
Thanks,
Xianzhu