Closed Bug 1009020 Opened 7 years ago Closed 7 years ago

Unnecessary invalidation during scrolling due to transform.NudgeToIntegers()

Categories

(Core :: Graphics: Layers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(2 files)

Attached file testcase
STR:
 1. Load the testcase and enable paint flashing.
 2. Scroll a bit.

We unnecessarily invalidate the square.
Attached patch v1Splinter Review
The transform in ChooseScaleAndSetTransform has a vertical translation that's -212.999756 minus the scroll position. NudgeToInteger in gfx/2d/Tools.h chooses the tolerance as (nudged value) * 1e-6. So the component gets nudged as soon as we've scrolled down 24px or more, because then the nudged value is <= -237, and
-237.0f - -237.0f * 1e-6f == -237.0f - -0.000237f == -236.999756f == -212.999756 - 24.0f

That means if we change the scroll position from 23px to 24px, our vertical translation component changes from -211.999756 to -213. For invalidation checking we first move the old value by the scroll offset in LayerPropertiesBase::MoveBy, which gives us -212.999756 for the old value, and then we compare that to the new value of -213. But mTransform.FuzzyEqual(transform) uses a fixed epsilon of 1e-4f, so the comparison fails and we invalidate.

I think we should make the NudgeToIntegers call in question use a fixed epsilon, just so that our nudging decision is independent from the scroll position.
Attachment #8421143 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/22b09f1086f9
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Depends on: 1078262
You need to log in before you can comment on or make changes to this bug.