[Libreoffice-commits] core.git: include/vcl vcl/source
Chris Sherlock (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 8 08:10:46 UTC 2021
include/vcl/outdev.hxx | 4 +++-
vcl/source/outdev/bitmap.cxx | 6 ++----
vcl/source/outdev/transparent.cxx | 4 +---
3 files changed, 6 insertions(+), 8 deletions(-)
New commits:
commit f83d1b824c1abd07d24318adda6c876b9471ccec
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Fri Sep 3 17:20:41 2021 +1000
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Sep 8 10:10:12 2021 +0200
vcl: make GetDownsampledBitmap() take destination size in units of twips
This removes the need to use OutputDevice functions, which means we can
later move this function to bitmaptools.cxx
Change-Id: If547563808c2656d395d4669507f5f8dcfadcabe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121580
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 2995769bd060..fbebf0a1a3d8 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1415,11 +1415,13 @@ protected:
double &fMaximumArea);
/** Retrieve downsampled and cropped bitmap
+
+ Takes destination size in twips units.
@attention This method ignores negative rDstSz values, thus
mirroring must happen outside this method (e.g. in DrawBitmap)
*/
- Bitmap GetDownsampledBitmap(
+ static Bitmap GetDownsampledBitmap(
const Size& rDstSz,
const Point& rSrcPt,
const Size& rSrcSz,
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index e86055d9df1e..5466340c2bfe 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -170,7 +170,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
}
}
-Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz,
+Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSizeTwip,
const Point& rSrcPt, const Size& rSrcSz,
const Bitmap& rBmp, tools::Long nMaxBmpDPIX, tools::Long nMaxBmpDPIY )
{
@@ -193,10 +193,8 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz,
if( !aBmp.IsEmpty() )
{
// do downsampling if necessary
- Size aDstSizeTwip( PixelToLogic(LogicToPixel(rDstSz), MapMode(MapUnit::MapTwip)) );
-
// #103209# Normalize size (mirroring has to happen outside of this method)
- aDstSizeTwip = Size( std::abs(aDstSizeTwip.Width()), std::abs(aDstSizeTwip.Height()) );
+ Size aDstSizeTwip(std::abs(rDstSizeTwip.Width()), std::abs(rDstSizeTwip.Height()));
const Size aBmpSize( aBmp.GetSizePixel() );
const double fBmpPixelX = aBmpSize.Width();
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 6a7921b43814..8cb2cf51632f 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -1836,11 +1836,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
// scale down bitmap, if requested
if( bDownsampleBitmaps )
- {
- aBandBmp = GetDownsampledBitmap( aDstSzPix,
+ aBandBmp = GetDownsampledBitmap( PixelToLogic(LogicToPixel(aDstSzPix), MapMode(MapUnit::MapTwip)),
Point(), aBandBmp.GetSizePixel(),
aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY );
- }
rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_BEGIN" ) );
rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) );
More information about the Libreoffice-commits
mailing list