svx/source/dialog/compressgraphicdialog.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit fcda481a0758c9727d126404778cc16f4ef1bb13 Author: Noel Grandin <[email protected]> AuthorDate: Thu Apr 20 11:47:43 2023 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Tue Apr 25 11:18:45 2023 +0200 tdf#153190 Compressing tool calculates compression rate wrong on large images calculation used sal_Int32, which overflowed on large values, rather use floating point to do the calculation Change-Id: I15974c5bf785a800a8f71711acfa9895361bad7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150683 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit b167bc073b6b83110242bfbace107f6978e5bca7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150627 Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 625e7b8d29913e68b451615b344662b8cfc32d8d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150632 Reviewed-by: Caolán McNamara <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Mike Kaganski <[email protected]> diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index 91399497c48e..a8be5ed6c5e8 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -377,7 +377,11 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, CalculateClickHdl, weld::Button&, void { OUString aSizeAsString = OUString::number(aSize / 1024); - OUString aReductionSizeAsString = OUString::number( m_aNativeSize > 0 ? (m_aNativeSize - aSize) * 100 / m_aNativeSize : 0 ); + OUString aReductionSizeAsString; + if (m_aNativeSize > 0 ) + aReductionSizeAsString = OUString::number( static_cast<sal_Int32>((m_aNativeSize - aSize) * 100.0 / m_aNativeSize) ); + else + aReductionSizeAsString = "0"; OUString aNewSizeString = SvxResId(STR_IMAGE_CAPACITY_WITH_REDUCTION); aNewSizeString = aNewSizeString.replaceAll("$(CAPACITY)", aSizeAsString);
