Skip to content

Commit

Permalink
Increase error tolerance for transform changes in RasterInvalidator
Browse files Browse the repository at this point in the history
In the bug case, the errors of the translation of some SVG elements
exceeded 1e-3 during scroll on very highdpi devices, causing raster
invalidation during scroll. The SVG elements have large viewbox scales
so the absolute values and errors of the translations are also large.

Bug: b/268276087
Change-Id: I32f2400b209c6e633cb15bb0b7d814f66e475b30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4300935
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1112415}
  • Loading branch information
wangxianzhu authored and Chromium LUCI CQ committed Mar 2, 2023
1 parent 8ddfbd9 commit c605ed4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ PaintInvalidationReason RasterInvalidator::ChunkPropertiesChanged(
// transform nodes when no raster invalidation is needed. For example, when
// a composited layer previously not transformed now gets transformed.
// Check for real accumulated transform change instead.
static constexpr double kTolerance = 1e-5f;
static constexpr double kAbsTranslationTolerance = 1e-2f;
static constexpr double kOtherTolerance = 1e-4f;
if (!new_chunk_info.chunk_to_layer_transform.ApproximatelyEqual(
old_chunk_info.chunk_to_layer_transform, kTolerance, kTolerance,
kTolerance)) {
old_chunk_info.chunk_to_layer_transform, kAbsTranslationTolerance,
kOtherTolerance, kOtherTolerance)) {
return PaintInvalidationReason::kPaintProperty;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,9 @@ TEST_P(RasterInvalidatorTest, TransformPropertyTinyChange) {

auto matrix_with_tiny_change = [](const gfx::Transform matrix) {
gfx::Transform m = matrix;
m.Translate(0.0000001, -0.0000001);
m.Scale(1.0000001);
m.Rotate(0.0000001);
m.Translate(0.0001, -0.0001);
m.Scale(1.000001);
m.Rotate(0.000001);
return m;
};

Expand Down

0 comments on commit c605ed4

Please sign in to comment.