diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-13 15:11:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-16 09:25:50 +0000 |
commit | 7dd6b261853ad53207fe5c367f98c4db1dfd54dc (patch) | |
tree | 076e35af0001bac6f1590ed77df5f0618a0740df | |
parent | 8569c6d0ad70c32a08774fa6f5ec25b465ea98ee (diff) |
use cairo-compatible top-down direction virtual devices everywhere
that way we can use cairo to text render etc onto our basebmp-backed
headless/gtk3 virtual devices
Change-Id: I91002b610b72a4fe1d2094a57c5cb1b6b5d69cb1
Reviewed-on: https://gerrit.libreoffice.org/19957
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | desktop/source/lib/init.cxx | 4 | ||||
-rw-r--r-- | include/vcl/virdev.hxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 | ||||
-rw-r--r-- | vcl/headless/svpbmp.cxx | 4 | ||||
-rw-r--r-- | vcl/headless/svpframe.cxx | 5 | ||||
-rw-r--r-- | vcl/headless/svpinst.cxx | 4 | ||||
-rw-r--r-- | vcl/headless/svpvd.cxx | 11 | ||||
-rw-r--r-- | vcl/inc/headless/svpframe.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/headless/svpvd.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/salvd.hxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 19 |
12 files changed, 28 insertions, 42 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 94b81e049cd2..838073fa57a7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -859,7 +859,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), - aBuffer, aAlphaBuffer, true); + aBuffer, aAlphaBuffer); pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); @@ -881,7 +881,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), - aBuffer, aAlphaBuffer, true ); + aBuffer, aAlphaBuffer); pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index b5d99cb3cbc0..740b9bf7db24 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -44,12 +44,10 @@ private: SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = nullptr ); SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const basebmp::RawMemorySharedArray &pBuffer, - const bool bTopDown ); + const basebmp::RawMemorySharedArray &pBuffer ); SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer, - const basebmp::RawMemorySharedArray &pAlphaBuffer, - const bool bTopDown ); + const basebmp::RawMemorySharedArray &pAlphaBuffer ); VirtualDevice (const VirtualDevice &) = delete; VirtualDevice & operator= (const VirtualDevice &) = delete; @@ -127,8 +125,8 @@ public: const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer, - const basebmp::RawMemorySharedArray &pAlphaBuffer, - const bool bTopDown = false ); + const basebmp::RawMemorySharedArray &pAlphaBuffer ); + bool SetOutputSize( const Size& rNewSize, bool bErase = true ) { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 19dfa31dfc66..0a9d900472dc 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -772,7 +772,7 @@ DECLARE_OOXMLIMPORT_TEST(testN777345, "n777345.docx") Graphic aGraphic(xGraphic); // If this changes later, feel free to update it, but make sure it's not // the checksum of a white/transparent placeholder rectangle. - CPPUNIT_ASSERT_EQUAL(BitmapChecksum(3652741777587093783), aGraphic.GetChecksum()); + CPPUNIT_ASSERT_EQUAL(BitmapChecksum(SAL_CONST_UINT64(16427281842367305761)), aGraphic.GetChecksum()); #endif } diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx index de06cd00ea00..4ae1afed0c4f 100644 --- a/vcl/headless/svpbmp.cxx +++ b/vcl/headless/svpbmp.cxx @@ -54,7 +54,7 @@ bool SvpSalBitmap::Create( const Size& rSize, aSize.setY( 1 ); sal_Int32 nStride = getBitmapDeviceStrideForWidth(nFormat, aSize.getX()); if( nBitCount > 8 ) - m_aBitmap = createBitmapDevice( aSize, false, nFormat, nStride ); + m_aBitmap = createBitmapDevice( aSize, true, nFormat, nStride ); else { // prepare palette @@ -67,7 +67,7 @@ bool SvpSalBitmap::Create( const Size& rSize, const BitmapColor& rCol = rPalette[i]; (*pPalette)[i] = basebmp::Color( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() ); } - m_aBitmap = createBitmapDevice( aSize, false, nFormat, nStride, + m_aBitmap = createBitmapDevice( aSize, true, nFormat, nStride, basebmp::RawMemorySharedArray(), basebmp::PaletteMemorySharedVector( pPalette ) ); diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index b881d2ca1e67..39f12506cda4 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -70,7 +70,6 @@ void SvpSalFrame::enableDamageTracker( bool bOn ) SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance, SalFrame* pParent, SalFrameStyleFlags nSalFrameStyle, - bool bTopDown, basebmp::Format nScanlineFormat, SystemParentData* ) : m_pInstance( pInstance ), @@ -78,7 +77,6 @@ SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance, m_nStyle( nSalFrameStyle ), m_bVisible( false ), #ifndef IOS - m_bTopDown( bTopDown ), m_bDamageTracking( false ), m_nScanlineFormat( nScanlineFormat ), #endif @@ -92,7 +90,6 @@ SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance, memset( static_cast<void *>(&m_aSystemChildData), 0, sizeof( SystemEnvData ) ); m_aSystemChildData.nSize = sizeof( SystemEnvData ); #ifdef IOS - (void) bTopDown; (void) nScanlineFormat; #elif defined ANDROID // Nothing @@ -295,7 +292,7 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u if( aFrameSize.getY() == 0 ) aFrameSize.setY( 1 ); sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(m_nScanlineFormat, aFrameSize.getX()); - m_aFrame = createBitmapDevice( aFrameSize, m_bTopDown, m_nScanlineFormat, nStride ); + m_aFrame = createBitmapDevice( aFrameSize, true, m_nScanlineFormat, nStride ); if (m_bDamageTracking) m_aFrame->setDamageTracker( basebmp::IBitmapDeviceDamageTrackerSharedPtr( new DamageTracker ) ); diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 0d3aa65d3805..c5df6b760863 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -200,12 +200,12 @@ bool SvpSalInstance::CheckTimeout( bool bExecuteTimers ) SalFrame* SvpSalInstance::CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) { - return new SvpSalFrame( this, nullptr, nStyle, false, SVP_DEFAULT_BITMAP_FORMAT, pParent ); + return new SvpSalFrame( this, nullptr, nStyle, SVP_DEFAULT_BITMAP_FORMAT, pParent ); } SalFrame* SvpSalInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) { - return new SvpSalFrame( this, pParent, nStyle, false, SVP_DEFAULT_BITMAP_FORMAT ); + return new SvpSalFrame( this, pParent, nStyle, SVP_DEFAULT_BITMAP_FORMAT ); } void SvpSalInstance::DestroyFrame( SalFrame* pFrame ) diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index 4ed3fc5909a2..fab2c153fa49 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -52,12 +52,11 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY ) { - return SetSizeUsingBuffer( nNewDX, nNewDY, basebmp::RawMemorySharedArray(), false ); + return SetSizeUsingBuffer(nNewDX, nNewDY, basebmp::RawMemorySharedArray()); } bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, - const basebmp::RawMemorySharedArray &pBuffer, - const bool bTopDown ) + const basebmp::RawMemorySharedArray &pBuffer ) { B2IVector aDevSize( nNewDX, nNewDY ); if( aDevSize.getX() == 0 ) @@ -76,14 +75,14 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, std::vector< basebmp::Color > aDevPal(2); aDevPal[0] = basebmp::Color( 0, 0, 0 ); aDevPal[1] = basebmp::Color( 0xff, 0xff, 0xff ); - m_aDevice = createBitmapDevice( aDevSize, bTopDown, nFormat, nStride, + m_aDevice = createBitmapDevice( aDevSize, true, nFormat, nStride, PaletteMemorySharedVector( new std::vector< basebmp::Color >(aDevPal) ) ); } else { m_aDevice = pBuffer ? - createBitmapDevice( aDevSize, bTopDown, nFormat, nStride, pBuffer, PaletteMemorySharedVector() ) - : createBitmapDevice( aDevSize, bTopDown, nFormat, nStride ); + createBitmapDevice( aDevSize, true, nFormat, nStride, pBuffer, PaletteMemorySharedVector() ) + : createBitmapDevice( aDevSize, true, nFormat, nStride ); } // update device in existing graphics diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 78c31fbdcd01..c338bb33b8db 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -44,7 +44,6 @@ class VCL_DLLPUBLIC SvpSalFrame : public SalFrame SalFrameStyleFlags m_nStyle; bool m_bVisible; #ifndef IOS - bool m_bTopDown; basebmp::BitmapDeviceSharedPtr m_aFrame; bool m_bDamageTracking; basebmp::Format m_nScanlineFormat; @@ -63,7 +62,6 @@ public: SvpSalFrame( SvpSalInstance* pInstance, SalFrame* pParent, SalFrameStyleFlags nSalFrameStyle, - bool bTopDown, basebmp::Format nScanlineFormat, SystemParentData* pSystemParent = nullptr ); virtual ~SvpSalFrame(); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index ac24df4cf086..8449ce157b8a 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -54,9 +54,9 @@ class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics public: static GlyphCache& getPlatformGlyphCache(); - void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice); void BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask, const basegfx::B2IPoint &rDstPoint); + void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice); private: bool m_bClipSetup; diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index 1dd39f8c2b29..bfa055f99f40 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -42,8 +42,7 @@ public: virtual bool SetSize( long nNewDX, long nNewDY ) override; virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - const basebmp::RawMemorySharedArray &pBuffer, - const bool bTopDown + const basebmp::RawMemorySharedArray &pBuffer ) override; // SalGeometryProvider diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index 6f2156a15c3f..872a73edff29 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -47,9 +47,7 @@ public: // Set new size using a buffer at the given address virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - const basebmp::RawMemorySharedArray & /* pBuffer */, - const bool /* bTopDown */ - ) + const basebmp::RawMemorySharedArray & /* pBuffer */ ) { // Only the headless virtual device has an implementation that uses // pBuffer (and bTopDown). diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index bc28605cba0e..c6987c1d2cb1 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -285,8 +285,7 @@ void VirtualDevice::dispose() } bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, - const basebmp::RawMemorySharedArray &pBuffer, - const bool bTopDown ) + const basebmp::RawMemorySharedArray &pBuffer ) { SAL_INFO( "vcl.gdi", "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", " @@ -315,7 +314,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra if ( bErase ) { if ( pBuffer ) - bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer, bTopDown ); + bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer ); else bRet = mpVirDev->SetSize( nNewWidth, nNewHeight ); @@ -393,10 +392,9 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect ) bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer, - const basebmp::RawMemorySharedArray &pAlphaBuffer, - const bool bTopDown ) + const basebmp::RawMemorySharedArray &pAlphaBuffer ) { - if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer, bTopDown) ) + if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) ) { if( mnAlphaDepth != -1 ) { @@ -410,8 +408,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, { mpAlphaVDev = VclPtr<VirtualDevice>::Create( *this, mnAlphaDepth ); mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, - pAlphaBuffer, - bTopDown ); + pAlphaBuffer); } // TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev @@ -444,12 +441,12 @@ void VirtualDevice::EnableRTL( bool bEnable ) bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase ) { - return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), basebmp::RawMemorySharedArray(), false ); + return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), basebmp::RawMemorySharedArray()); } bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, - const basebmp::RawMemorySharedArray &pBuffer, const basebmp::RawMemorySharedArray &pAlphaBuffer, const bool bTopDown ) + const basebmp::RawMemorySharedArray &pBuffer, const basebmp::RawMemorySharedArray &pAlphaBuffer ) { if (pAlphaBuffer) mnAlphaDepth = 8; @@ -461,7 +458,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( mm.SetScaleY( rScale ); SetMapMode( mm ); } - return ImplSetOutputSizePixel( rNewSize, true, pBuffer, pAlphaBuffer, bTopDown ); + return ImplSetOutputSizePixel( rNewSize, true, pBuffer, pAlphaBuffer ); } void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) |