summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2018-04-03 01:05:33 +1000
committerTomaž Vajngerl <quikee@gmail.com>2018-04-03 04:46:19 +0200
commit8e0eb015e74775b9bf02326ffd7b67e83ad6c60d (patch)
tree3efb6da3014389a326bedd5c6504be05a077fc5f
parent55d5d9d365ea18e66cef045756f772e2fa9d0648 (diff)
vcl: use BitmapEx::Scale() where needed and SetSizePixel() elsewhere
Change-Id: If4b2f3c209d1aefbe5756645d448c992387bae16 Reviewed-on: https://gerrit.libreoffice.org/52268 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/vcl/bitmapex.hxx2
-rw-r--r--sd/source/ui/view/viewoverlaymanager.cxx2
-rw-r--r--svx/source/gallery2/galobj.cxx2
-rw-r--r--vcl/source/gdi/bitmapex.cxx15
-rw-r--r--vcl/source/graphic/GraphicObject2.cxx2
-rw-r--r--vcl/source/window/menubarwindow.cxx2
6 files changed, 11 insertions, 14 deletions
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index c61969869b33..dedd064b17d3 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -79,7 +79,7 @@ public:
AlphaMask GetAlpha() const;
const Size& GetSizePixel() const { return maBitmapSize; }
- void SetSizePixel( const Size& rNewSize, BmpScaleFlag nScaleFlag = BmpScaleFlag::Default );
+ void SetSizePixel(const Size& rNewSize);
const Size& GetPrefSize() const { return maBitmap.GetPrefSize(); }
void SetPrefSize( const Size& rPrefSize ) { maBitmap.SetPrefSize( rPrefSize ); }
diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx
index f7646704b3fb..215a3a0038e7 100644
--- a/sd/source/ui/view/viewoverlaymanager.cxx
+++ b/sd/source/ui/view/viewoverlaymanager.cxx
@@ -340,7 +340,7 @@ BitmapEx ChangePlaceholderTag::createOverlayImage( int nHighlight )
Size aSize( getButtonImage( 0, bLarge )->GetSizePixel() );
- aRet.SetSizePixel( Size( aSize.Width() << 1, aSize.Height() << 1 ) );
+ aRet.Scale(Size(aSize.Width() << 1, aSize.Height() << 1));
const ::tools::Rectangle aRectSrc( Point( 0, 0 ), aSize );
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index d307b65bfd47..d9e6a205cbfe 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -118,7 +118,7 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic )
else
aBmpSize.setHeight( FRound( aBmpSize.Width() / fFactorLog ) );
- aBmpEx.SetSizePixel( aBmpSize, BmpScaleFlag::BestQuality );
+ aBmpEx.Scale(aBmpSize, BmpScaleFlag::BestQuality);
}
}
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 63856412e01a..6dac0651ff9c 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -64,7 +64,7 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize )
return;
maBitmap = Bitmap( aSize, rBitmapEx.maBitmap.GetBitCount() );
- maBitmapSize = aSize;
+ SetSizePixel(aSize);
if( rBitmapEx.IsAlpha() )
{
mbAlpha = true;
@@ -297,12 +297,9 @@ BitmapChecksum BitmapEx::GetChecksum() const
return nCrc;
}
-void BitmapEx::SetSizePixel( const Size& rNewSize, BmpScaleFlag nScaleFlag )
+void BitmapEx::SetSizePixel(const Size& rNewSize)
{
- if(GetSizePixel() != rNewSize)
- {
- Scale( rNewSize, nScaleFlag );
- }
+ maBitmapSize = rNewSize;
}
bool BitmapEx::Invert()
@@ -348,7 +345,7 @@ bool BitmapEx::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag
maMask.Scale( rScaleX, rScaleY, nScaleFlag );
}
- maBitmapSize = maBitmap.GetSizePixel();
+ SetSizePixel(maBitmap.GetSizePixel());
SAL_WARN_IF( !!maMask && maBitmap.GetSizePixel() != maMask.GetSizePixel(), "vcl",
"BitmapEx::Scale(): size mismatch for bitmap and alpha mask." );
@@ -430,7 +427,7 @@ bool BitmapEx::Crop( const tools::Rectangle& rRectPixel )
if( bRet && ( meTransparent == TransparentType::Bitmap ) && !!maMask )
maMask.Crop( rRectPixel );
- maBitmapSize = maBitmap.GetSizePixel();
+ SetSizePixel(maBitmap.GetSizePixel());
SAL_WARN_IF( !!maMask && maBitmap.GetSizePixel() != maMask.GetSizePixel(), "vcl",
"BitmapEx::Crop(): size mismatch for bitmap and alpha mask." );
@@ -463,7 +460,7 @@ void BitmapEx::Expand( sal_uLong nDX, sal_uLong nDY, bool bExpandTransparent )
maMask.Expand( nDX, nDY, &aColor );
}
- maBitmapSize = maBitmap.GetSizePixel();
+ SetSizePixel(maBitmap.GetSizePixel());
SAL_WARN_IF( !!maMask && maBitmap.GetSizePixel() != maMask.GetSizePixel(), "vcl",
"BitmapEx::Expand(): size mismatch for bitmap and alpha mask." );
diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx
index 7e951479912a..e46b035f60b7 100644
--- a/vcl/source/graphic/GraphicObject2.cxx
+++ b/vcl/source/graphic/GraphicObject2.cxx
@@ -2036,7 +2036,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
rBmpEx = aBmpEx2;
}
- aBmpEx2.SetSizePixel( Size(nPadTotalWidth, nPadTotalHeight) );
+ aBmpEx2.Scale(Size(nPadTotalWidth, nPadTotalHeight));
aBmpEx2.Erase( Color(0xFF,0,0,0) );
aBmpEx2.CopyPixel( tools::Rectangle( Point(nPadLeft, nPadTop), aBmpSize ), tools::Rectangle( Point(0, 0), aBmpSize ), &rBmpEx );
rBmpEx = aBmpEx2;
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index c25c29e49db0..c264e89fba0a 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -98,7 +98,7 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
aEraseColor.SetTransparency( 255 );
aBmpExDst.Erase( aEraseColor );
- aBmpExDst.SetSizePixel( Size( lastSize, lastSize ) );
+ aBmpExDst.Scale( Size( lastSize, lastSize ) );
tools::Rectangle aSrcRect( Point(0,0), maImage.GetSizePixel() );
tools::Rectangle aDestRect( Point((lastSize - maImage.GetSizePixel().Width())/2,