[go: nahoru, domu]

Ensure that thin, aliased strokes are always rasterized

Without anti-aliasing, thin strokes (device width < 1) may or may not
raster, depending on their position relative to sample points.

This is generally undesirable, and can be avoided with Skia's hairline
stroke mode or by enabling anti-aliasing.

This CL adds logic to detect subpixel aliased strokes at raster time,
and adjust the paint on the fly to ensure that the stroke is visible.

The implementation is based on a ScopedImageFlags refactoring:

1) rename to ScopedRasterFlags (more accurate, considering it already
   performs some non-image flags filtering)

2) get rid of instantiation preconditions - they are duplicated in
   in the ctor, as filter triggers

3) store a reference to the original flags and construct the modified
   flags lazily, only when/if needed

4) if no filtering is triggered/performed, return the original flags

BUG=791111

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I029efcf97be8a201d3224957a42c3394be6c272a
Reviewed-on: https://chromium-review.googlesource.com/811606
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522652}
14 files changed