diff options
author | Armin Le Grand <Armin.Le.Grand@me.com> | 2020-01-22 17:20:13 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2020-01-23 17:48:55 +0100 |
commit | 2da7a82f6b7a78e1e4b34b0b3c7a27d2b3c47a35 (patch) | |
tree | dd09d82b6c691c79b50289f9091be02fec276d7d /basegfx | |
parent | d03c46eba1bd1d3399ee3d4e6af1c9e16c2c1718 (diff) |
tdf#129845: Better solution using already existing info
Use calculateCombinedHoldCyclesInSeconds() in central
places of system-dependent buffering and the zero value
to early exclude data from buffering. This solves the
problem on all system-dependent usages in a central
place. Also enhanced to roughly allow buffering for
bitmaps unchanged, for polygons starting with ca. 50
coordinate pairs.
Added special treatments to Cairo version to allow
temp buffer objects without copying the path data. This
needed some extra stuff due to Cairo not allowing
to work with it's cr-internal path object directly.
Change-Id: Icd0a0d8091707fe356a82f5c7ec48f36ad44ccde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87199
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/tools/systemdependentdata.cxx | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/basegfx/source/tools/systemdependentdata.cxx b/basegfx/source/tools/systemdependentdata.cxx index 223b607ffae0..53b1465eaf55 100644 --- a/basegfx/source/tools/systemdependentdata.cxx +++ b/basegfx/source/tools/systemdependentdata.cxx @@ -77,39 +77,48 @@ namespace basegfx if(0 == mnCalculatedCycles) { const sal_Int64 nBytes(estimateUsageInBytes()); - const sal_uInt32 nSeconds = 60; // HoldCyclesInSeconds - // default is Seconds (minimal is one) - sal_uInt32 nResult(0 == nSeconds ? 1 : nSeconds); - - if(0 != nBytes) + // tdf#129845 as indicator for no need to buffer trivial data, stay at and + // return zero. As border, use 450 bytes. For polygons, this means to buffer + // starting with ca. 50 points (GDIPLUS uses 9 bytes per coordinate). For + // Bitmap data this means to more or less always buffer (as it was before). + // For the future, a more sophisticated differentioation may be added + if(nBytes > 450) { - // use sqrt to get some curved shape. With a default of 60s we get - // a single second at 3600 byte. To get close to 10mb, multiply by - // a corresponding scaling factor - const double fScaleToMB(3600.0 / (1024.0 * 1024.0 * 10.0)); - - // also use a multiplier to move the start point higher - const double fMultiplierSeconds(10.0); + const sal_uInt32 nSeconds = 60; // HoldCyclesInSeconds - // calculate - nResult = static_cast<sal_uInt32>((fMultiplierSeconds * nSeconds) / sqrt(nBytes * fScaleToMB)); + // default is Seconds (minimal is one) + sal_uInt32 nResult(0 == nSeconds ? 1 : nSeconds); - // minimal value is 1 - if(nResult < 1) + if(0 != nBytes) { - nResult = 1; + // use sqrt to get some curved shape. With a default of 60s we get + // a single second at 3600 byte. To get close to 10mb, multiply by + // a corresponding scaling factor + const double fScaleToMB(3600.0 / (1024.0 * 1024.0 * 10.0)); + + // also use a multiplier to move the start point higher + const double fMultiplierSeconds(10.0); + + // calculate + nResult = static_cast<sal_uInt32>((fMultiplierSeconds * nSeconds) / sqrt(nBytes * fScaleToMB)); + + // minimal value is 1 + if(nResult < 1) + { + nResult = 1; + } + + // maximal value is nSeconds + if(nResult > nSeconds) + { + nResult = nSeconds; + } } - // maximal value is nSeconds - if(nResult > nSeconds) - { - nResult = nSeconds; - } + // set locally (once, on-demand created, non-zero) + const_cast<SystemDependentData*>(this)->mnCalculatedCycles = nResult; } - - // set locally (once, on-demand created, non-zero) - const_cast<SystemDependentData*>(this)->mnCalculatedCycles = nResult; } return mnCalculatedCycles; |