mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-19 23:07:33 +09:00
Issue #2364 - Limit the growth of scaling for animated nsDisplayTransform in the fallback case.
This ensures we don't scale the underlying size of the layer beyond what is close to the current display size. When box shadows get much larger than this, they start taking so much time to render that successive frames grow in scale too fast for any inter-frame reuse to be possible. With this, we avoid that and no longer get crushed by re-rendering gigantic box shadows every single frame. See BZ 1383825
This commit is contained in:
parent
d4cdecec81
commit
0db18745f4
3 changed files with 42 additions and 21 deletions
|
|
@ -692,7 +692,7 @@ gfxUtils::ClipToRegion(DrawTarget* aTarget, const nsIntRegion& aRegion)
|
|||
}
|
||||
|
||||
/*static*/ gfxFloat
|
||||
gfxUtils::ClampToScaleFactor(gfxFloat aVal)
|
||||
gfxUtils::ClampToScaleFactor(gfxFloat aVal, bool aRoundDown)
|
||||
{
|
||||
// Arbitary scale factor limitation. We can increase this
|
||||
// for better scaling performance at the cost of worse
|
||||
|
|
@ -713,14 +713,17 @@ gfxUtils::ClampToScaleFactor(gfxFloat aVal)
|
|||
|
||||
gfxFloat power = log(aVal)/log(kScaleResolution);
|
||||
|
||||
// If power is within 1e-5 of an integer, round to nearest to
|
||||
// prevent floating point errors, otherwise round up to the
|
||||
// next integer value.
|
||||
if (fabs(power - NS_round(power)) < 1e-5) {
|
||||
// If power is within 1e-5 of an integer, round to nearest to
|
||||
// prevent floating point errors.
|
||||
power = NS_round(power);
|
||||
} else if (inverse) {
|
||||
} else if (inverse != aRoundDown) {
|
||||
// Use floor when we are either inverted or rounding down, but
|
||||
// not both.
|
||||
power = floor(power);
|
||||
} else {
|
||||
// Otherwise, ceil when we are not inverted and not rounding
|
||||
// down, or we are inverted and rounding down.
|
||||
power = ceil(power);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue