skia /
skia /
0adae44dd9cde8036ade811077929016bab485bd [graphite][PathAtlas]: Apply correct subpixel offset
Previously the atlas transform was calculated by un-doing a shape's
device space translation. This canceled any subpixel translation and
snapped the mask bounding box to an exact pixel boundary. This led to
incorrect coverage sampling in AtlasShapeRenderStep as it uses the
hardware nearest-neighbor filter to sample the atlas. Changing the
filter to bi-linear is of course one solution.
This is now fixed by preserving any sub-pixel translation while
calculating the atlas transform and taking that into account later while
assigning UV coordinates. The bounds management has also changed to
localize some of this accouinting, such that:
* AtlasShape now defines all of its bounds information as integer
vectors rather than floating point, formalizing the fact that all of
this data is pixel-aligned and the mask itself is rendered at a
fractional offset.
* PathAtlas now takes care of the pixel-border adjustment when computing
mask bounds and returns the adjusted bounds to Device for it to use
when constructing the AtlasShape. In particular, the device offset and
mask size parameters are now defined to include the 1-pixel AA border
embedded in the sample region (which is further enclosed by an
additional 1-pixel border as buffer space between atlas entries).
* AtlasShapeRenderStep now defines the device offset attribute as an
an int2 and the instance attributes are written out directly from the
AtlasShape without any adjustment.
Bug: b/291348288
Change-Id: I1b2c2e14ce96b5ec7da7e69f6bfcb42e334472a7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/724777
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
5 files changed