diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 40cf445f0390..6025658ce099 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -57,8 +57,6 @@ private: SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, tools::Long nDX, tools::Long nDY, const SystemGraphicsData *pData = nullptr ); SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, sal_uInt8* pBuffer ); - SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - sal_uInt8* pBuffer, bool bAlphaMaskTransparent = false ); VirtualDevice (const VirtualDevice &) = delete; VirtualDevice & operator= (const VirtualDevice &) = delete; diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index b16cdb764a2b..9615cb8fa01e 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -351,10 +351,9 @@ void VirtualDevice::ImplFillOpaqueRectangle( const tools::Rectangle& rRect ) Pop(); } -bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - sal_uInt8 *const pBuffer, bool bAlphaMaskTransparent ) +bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase, bool bAlphaMaskTransparent ) { - if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) ) + if( InnerImplSetOutputSizePixel(rNewSize, bErase, /*pBuffer*/nullptr) ) { if (meFormatAndAlpha != DeviceFormat::WITHOUT_ALPHA) { @@ -402,11 +401,6 @@ void VirtualDevice::EnableRTL( bool bEnable ) OutputDevice::EnableRTL(bEnable); } -bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase, bool bAlphaMaskTransparent ) -{ - return ImplSetOutputSizePixel(rNewSize, bErase, nullptr, bAlphaMaskTransparent); -} - bool VirtualDevice::SetOutputSizePixelScaleOffsetAndLOKBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, sal_uInt8 *const pBuffer) @@ -420,7 +414,22 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndLOKBuffer( mm.SetScaleX( rScale ); mm.SetScaleY( rScale ); SetMapMode( mm ); - return ImplSetOutputSizePixel(rNewSize, true, pBuffer); + + assert(meFormatAndAlpha == DeviceFormat::WITHOUT_ALPHA); + assert(mpVirDev); + assert( rNewSize != GetOutputSizePixel() && "Trying to re-use a VirtualDevice but this time using a pre-allocated buffer"); + assert( rNewSize.Width() >= 1 ); + assert( rNewSize.Height() >= 1 ); + + bool bRet = mpVirDev->SetSizeUsingBuffer( rNewSize.Width(), rNewSize.Height(), pBuffer ); + if ( bRet ) + { + mnOutWidth = rNewSize.Width(); + mnOutHeight = rNewSize.Height(); + } + + return bRet; + } void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode )