vcl/headless/svpvd.cxx | 12 ------ vcl/inc/headless/svpvd.hxx | 5 ++ vcl/inc/opengl/win/gdiimpl.hxx | 7 +-- vcl/inc/opengl/x11/gdiimpl.hxx | 7 +-- vcl/inc/opengl/x11/salvd.hxx | 7 ++- vcl/inc/openglgdiimpl.hxx | 11 +++-- vcl/inc/quartz/salvd.h | 4 +- vcl/inc/salframe.hxx | 9 ++++ vcl/inc/salgeom.hxx | 12 ++++++ vcl/inc/salvd.hxx | 8 ++-- vcl/inc/unx/salgdi.h | 2 + vcl/inc/unx/salvd.h | 9 ++-- vcl/inc/win/salgdi.h | 4 +- vcl/inc/win/salvd.h | 7 +++ vcl/opengl/gdiimpl.cxx | 4 +- vcl/opengl/win/gdiimpl.cxx | 54 +---------------------------- vcl/opengl/x11/gdiimpl.cxx | 35 ++---------------- vcl/opengl/x11/salvd.cxx | 7 --- vcl/quartz/salvd.cxx | 22 ++++------- vcl/source/gdi/virdev.cxx | 6 --- vcl/unx/generic/gdi/salgdi.cxx | 8 ++++ vcl/unx/generic/gdi/salvd.cxx | 6 --- vcl/unx/generic/gdi/x11cairotextrender.cxx | 36 ++++++++----------- vcl/win/source/gdi/salgdi.cxx | 4 +- vcl/win/source/gdi/salprn.cxx | 2 - vcl/win/source/gdi/salvd.cxx | 26 ++++++++++--- vcl/win/source/window/salframe.cxx | 4 +- 27 files changed, 132 insertions(+), 186 deletions(-)
New commits: commit 425c1ff2416db769cf7d92fe45c8b80682aeb084 Author: Markus Mohrhard <[email protected]> Date: Sun Nov 30 18:48:33 2014 +0100 implement virtual methods for OSX vcl backend Change-Id: Ifd7e06529cbf2e20bdd1560586420cda39c5a50c diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h index e1d1d51..e3c68ab 100644 --- a/vcl/inc/quartz/salvd.h +++ b/vcl/inc/quartz/salvd.h @@ -61,6 +61,9 @@ public: virtual SalGraphics* AcquireGraphics() SAL_OVERRIDE; virtual void ReleaseGraphics( SalGraphics* pGraphics ) SAL_OVERRIDE; virtual bool SetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; + + virtual long GetWidth() const SAL_OVERRIDE; + virtual long GetHeight() const SAL_OVERRIDE; }; #endif // INCLUDED_VCL_INC_QUARTZ_SALVD_H diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index a524c1e..ceb7e9b 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -277,4 +277,16 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) return (mxLayer != NULL); } +long AquaSalVirtualDevice::GetWidth() const +{ + const CGSize aSize = CGLayerGetSize( mxLayer ); + return aSize.width; +} + +long AquaSalVirtualDevice::GetHeight() const +{ + const CGSize aSize = CGLayerGetSize( mxLayer ); + return aSize.height; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 7d7de5073d13fc31abfb14f0d9b156cf52623412 Author: Markus Mohrhard <[email protected]> Date: Sun Nov 30 01:33:41 2014 +0100 Werror, Wunused-variable Change-Id: Ia361b1e37ad8b0daf49ff236c855a70d7d8bf8f4 diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 03ac781..f761ebf 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -1539,7 +1539,6 @@ void OpenGLSalGraphicsImpl::DoCopyBits( const SalTwoRect& rPosAry, OpenGLSalGrap if( pImpl->mbOffscreen ) { - Size aSize( pImpl->GetWidth(), pImpl->GetHeight() ); PreDraw(); DrawTexture( pImpl->maOffscreenTex, rPosAry ); PostDraw(); commit c28cc6b423dddcf3ad665676787c4e54ba248abd Author: Michael Meeks <[email protected]> Date: Mon Dec 1 09:27:35 2014 +0000 vcl: re-init windows graphics impl after virtualdevice size change. Change-Id: I6188617aa2cf2e237ec0724d1442564fbf3fe297 diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 6758b09..07d9ce8 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -26,6 +26,7 @@ #include <win/salinst.h> #include <win/salgdi.h> #include <win/salvd.h> +#include "opengl/win/gdiimpl.hxx" HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppData) { @@ -213,6 +214,14 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) SelectBitmap( getHDC(), hNewBmp ); DeleteBitmap( mhBmp ); mhBmp = hNewBmp; + + if (mpGraphics) + { + WinOpenGLSalGraphicsImpl *pImpl; + pImpl = dynamic_cast< WinOpenGLSalGraphicsImpl * >(mpGraphics->getImpl()); + if (pImpl) + pImpl->Init(); + } return TRUE; } else commit 6c6a5dc0d358c7c895c9d05174cd8bba31478960 Author: Michael Meeks <[email protected]> Date: Sat Nov 29 22:55:31 2014 +0000 vcl: Consolidate size information around the GeometryProvider. Change-Id: I1d764a8dba1850d2475f08e1014a085846f336c3 diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx index da1a278..30ade23 100644 --- a/vcl/inc/opengl/win/gdiimpl.hxx +++ b/vcl/inc/opengl/win/gdiimpl.hxx @@ -24,13 +24,10 @@ private: WinSalGraphics& mrParent; public: - WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics); + WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics, + SalGeometryProvider *mpProvider); protected: - virtual GLfloat GetWidth() const SAL_OVERRIDE; - virtual GLfloat GetHeight() const SAL_OVERRIDE; - virtual bool IsOffscreen() const SAL_OVERRIDE; - virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE; virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE; virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE; diff --git a/vcl/inc/opengl/x11/gdiimpl.hxx b/vcl/inc/opengl/x11/gdiimpl.hxx index 53ebe5b..d6ef010 100644 --- a/vcl/inc/opengl/x11/gdiimpl.hxx +++ b/vcl/inc/opengl/x11/gdiimpl.hxx @@ -26,10 +26,6 @@ public: virtual ~X11OpenGLSalGraphicsImpl(); protected: - GLfloat GetWidth() const SAL_OVERRIDE; - GLfloat GetHeight() const SAL_OVERRIDE; - bool IsOffscreen() const SAL_OVERRIDE; - virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE; virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE; virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE; @@ -38,6 +34,9 @@ public: // implementation of X11GraphicsImpl virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE; + + virtual void Init() SAL_OVERRIDE; + bool FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, int nY ) SAL_OVERRIDE; bool RenderPixmapToScreen( X11Pixmap* pPixmap, X11Pixmap* pMask, int nX, int nY ) SAL_OVERRIDE; }; diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index 043bd95..ad13335 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_VCL_OPENGLGDIIMPL_HXX #define INCLUDED_VCL_OPENGLGDIIMPL_HXX +#include "salgeom.hxx" #include "salgdiimpl.hxx" #include <vcl/dllapi.h> @@ -38,6 +39,8 @@ class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl protected: OpenGLContext* mpContext; + /// Pointer to the SalFrame or SalVirtualDevice + SalGeometryProvider* mpParent; OpenGLFramebuffer* mpFramebuffer; // clipping @@ -142,13 +145,13 @@ public: public: // get the width of the device - virtual GLfloat GetWidth() const = 0; + GLfloat GetWidth() const { return mpParent ? mpParent->GetWidth() : 1; } // get the height of the device - virtual GLfloat GetHeight() const = 0; + GLfloat GetHeight() const { return mpParent ? mpParent->GetHeight() : 1; } // check whether this instance is used for offscreen rendering - virtual bool IsOffscreen() const = 0; + bool IsOffscreen() const { return mpParent ? mpParent->IsOffScreen() : true; } // operations to do before painting virtual void PreDraw(); @@ -170,7 +173,7 @@ protected: virtual bool UseContext( OpenGLContext* pContext ) = 0; public: - OpenGLSalGraphicsImpl(); + OpenGLSalGraphicsImpl(SalGeometryProvider* pParent); virtual ~OpenGLSalGraphicsImpl (); OpenGLContext* GetOpenGLContext(); diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index edf47b1..29697a9 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -29,6 +29,7 @@ #include <vcl/metric.hxx> #include "salgdi.hxx" +#include "salgeom.hxx" #include "sallayout.hxx" #include "vclpluginapi.h" @@ -132,6 +133,7 @@ public: inline const SalDisplay* GetDisplay() const; inline Display* GetXDisplay() const; inline const SalVisual& GetVisual() const; + SalGeometryProvider *GetGeometryProvider() const; inline Drawable GetDrawable() const { return hDrawable_; } void SetDrawable( Drawable d, SalX11Screen nXScreen ); XRenderPictFormat* GetXRenderFormat() const; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 443c1c2..5a46cb1f 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -21,6 +21,7 @@ #define INCLUDED_VCL_INC_WIN_SALGDI_H #include "sallayout.hxx" +#include "salgeom.hxx" #include "salgdi.hxx" #include "outfont.hxx" #include "PhysicalFontFace.hxx" @@ -243,7 +244,8 @@ public: HFONT ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ); public: - explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd); + explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd, + SalGeometryProvider *pProvider); virtual ~WinSalGraphics(); SalGraphicsImpl* GetImpl() const SAL_OVERRIDE; diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 28f7959..03ac781 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -63,8 +63,9 @@ ((float) aColor.GetBlue()) * nFactor / 25500.0, \ 1.0f ) -OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl() +OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl(SalGeometryProvider* pParent) : mpContext(0) + , mpParent(pParent) , mpFramebuffer(NULL) , mbUseScissor(false) , mbUseStencil(false) diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index fb05005..caef995 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -13,7 +13,9 @@ #include <win/saldata.hxx> #include <win/salframe.h> -WinOpenGLSalGraphicsImpl::WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics): +WinOpenGLSalGraphicsImpl::WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics, + SalGeometryProvider *mpProvider): + OpenGLSalGraphicsImpl(mpProvider), mrParent(rGraphics) { } @@ -24,56 +26,6 @@ void WinOpenGLSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* OpenGLSalGraphicsImpl::DoCopyBits( rPosAry, pImpl ); } -GLfloat WinOpenGLSalGraphicsImpl::GetWidth() const -{ - if( mrParent.gethWnd() && IsWindow( mrParent.gethWnd() ) ) - { - WinSalFrame* pFrame = GetWindowPtr( mrParent.gethWnd() ); - if( pFrame ) - { - if( pFrame->maGeometry.nWidth ) - return pFrame->maGeometry.nWidth; - else - { - // TODO: perhaps not needed, maGeometry should always be up-to-date - RECT aRect; - GetClientRect( mrParent.gethWnd(), &aRect ); - return aRect.right; - } - } - } - - return 1; -} - -GLfloat WinOpenGLSalGraphicsImpl::GetHeight() const -{ - if( mrParent.gethWnd() && IsWindow( mrParent.gethWnd() ) ) - { - WinSalFrame* pFrame = GetWindowPtr( mrParent.gethWnd() ); - if( pFrame ) - { - if( pFrame->maGeometry.nHeight ) - return pFrame->maGeometry.nHeight; - else - { - // TODO: perhaps not needed, maGeometry should always be up-to-date - RECT aRect; - GetClientRect( mrParent.gethWnd(), &aRect ); - return aRect.bottom; - } - } - } - - return 1; -} - -bool WinOpenGLSalGraphicsImpl::IsOffscreen() const -{ - WinSalFrame* pFrame = GetWindowPtr( mrParent.gethWnd() ); - return ( pFrame == NULL ); -} - OpenGLContext* WinOpenGLSalGraphicsImpl::CreateWinContext() { OpenGLContext* pContext = new OpenGLContext(); diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index d4115fa..0b5fd75 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -26,7 +26,7 @@ #include <vcl/opengl/OpenGLHelper.hxx> X11OpenGLSalGraphicsImpl::X11OpenGLSalGraphicsImpl( X11SalGraphics& rParent ): - OpenGLSalGraphicsImpl(), + OpenGLSalGraphicsImpl(rParent.GetGeometryProvider()), mrParent(rParent) { } @@ -35,36 +35,11 @@ X11OpenGLSalGraphicsImpl::~X11OpenGLSalGraphicsImpl() { } -GLfloat X11OpenGLSalGraphicsImpl::GetWidth() const +void X11OpenGLSalGraphicsImpl::Init() { - if( mrParent.m_pFrame ) - return mrParent.m_pFrame->maGeometry.nWidth; - else if( mrParent.m_pVDev ) - return static_cast< X11OpenGLSalVirtualDevice* >(mrParent.m_pVDev)->GetWidth(); - return 1; -} - -GLfloat X11OpenGLSalGraphicsImpl::GetHeight() const -{ - if( mrParent.m_pFrame ) - return mrParent.m_pFrame->maGeometry.nHeight; - else if( mrParent.m_pVDev ) - return static_cast< X11OpenGLSalVirtualDevice* >(mrParent.m_pVDev)->GetHeight(); - return 1; -} - -bool X11OpenGLSalGraphicsImpl::IsOffscreen() const -{ - X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame); - if( pProvider ) - return false; - else if( mrParent.m_pVDev ) - return true; - else - { - SAL_WARN( "vcl.opengl", "what happened here?" ); - return true; - } + // The m_pFrame and m_pVDev pointers are updated late in X11 + mpParent = mrParent.GetGeometryProvider(); + OpenGLSalGraphicsImpl::Init(); } OpenGLContext* X11OpenGLSalGraphicsImpl::CreateWinContext() diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index d9eb7df..f3cb8a3 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -486,4 +486,12 @@ void X11SalGraphics::EndPaint() return mpImpl->endPaint(); } +SalGeometryProvider *X11SalGraphics::GetGeometryProvider() const +{ + if (m_pFrame) + return static_cast< SalGeometryProvider * >(m_pFrame); + else + return static_cast< SalGeometryProvider * >(m_pVDev); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 4c36bb3..c2d644d 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -613,7 +613,7 @@ OpenGLTexture* OpenGLCompatibleDC::getTexture() return new OpenGLTexture(maRects.mnSrcWidth, maRects.mnSrcHeight, GL_BGRA, GL_UNSIGNED_BYTE, reinterpret_cast<sal_uInt8*>(mpData)); } -WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd): +WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd, SalGeometryProvider *pProvider): mhLocalDC(0), mbPrinter(eType == WinSalGraphics::PRINTER), mbVirDev(eType == WinSalGraphics::VIRTUAL_DEVICE), @@ -634,7 +634,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW mnPenWidth(GSL_PEN_WIDTH) { if (OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter) - mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this)); + mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this, pProvider)); else mpImpl.reset(new WinSalGraphicsImpl(*this)); diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index ad22b4e..7822662 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1045,7 +1045,7 @@ static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetup static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC ) { - WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false, 0); + WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false, 0, /* CHECKME */ NULL); pGraphics->SetLayout( 0 ); pGraphics->setHDC(hDC); pGraphics->InitGraphics(); diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index cea8a76..6758b09 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -105,7 +105,7 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, { WinSalVirtualDevice* pVDev = new WinSalVirtualDevice; SalData* pSalData = GetSalData(); - WinSalGraphics* pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), 0); + WinSalGraphics* pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), 0, pVDev); pVirGraphics->SetLayout( 0 ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() pVirGraphics->setHDC(hDC); if ( pSalData->mhDitherPal && pVirGraphics->isScreen() ) @@ -115,8 +115,8 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, } pVirGraphics->InitGraphics(); - mnWidth = nDX; - mnHeight = nDY; + pVDev->mnWidth = nDX; + pVDev->mnHeight = nDY; pVDev->setHDC(hDC); pVDev->mhBmp = hBmp; if( hBmp ) @@ -207,6 +207,9 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) HBITMAP hNewBmp = ImplCreateVirDevBitmap(getHDC(), nDX, nDY, mnBitCount, &pDummy); if ( hNewBmp ) { + mnWidth = nDX; + mnHeight = nDY; + SelectBitmap( getHDC(), hNewBmp ); DeleteBitmap( mhBmp ); mhBmp = hNewBmp; @@ -215,6 +218,8 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) else { ImplWriteLastError( GetLastError(), "ImplCreateVirDevBitmap in SetSize" ); + mnWidth = 0; + mnHeight = 0; return FALSE; } } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index d2fef8f..e7cc293 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -983,7 +983,7 @@ SalGraphics* WinSalFrame::AcquireGraphics() if ( !mpGraphics2 ) { - mpGraphics2 = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd); + mpGraphics2 = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd, this); mpGraphics2->setHDC(0); } @@ -1014,7 +1014,7 @@ SalGraphics* WinSalFrame::AcquireGraphics() HDC hDC = GetDC( mhWnd ); if ( hDC ) { - mpGraphics = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd); + mpGraphics = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd, this); mpGraphics->setHDC(hDC); if ( pSalData->mhDitherPal ) { commit 6c55e8ffe290c537aeabac8c280cd1dcefa6067d Author: Michael Meeks <[email protected]> Date: Sat Nov 29 22:14:36 2014 +0000 vcl: create a GeometryProvider interface. Implemented by both SalFrame and SalVirtualDevice, to help us to un-tangle code that needs to operate on resources associated with both of these without special cases. Change-Id: If681a002647e20c57186577fe039d4ac85bba872 diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index 752e91c..27dba60 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -51,6 +51,10 @@ public: ) SAL_OVERRIDE; basebmp::BitmapDeviceSharedPtr getBitmapDevice() { return m_aDevice; } + + // SalGeometryProvider + virtual long GetWidth() const SAL_OVERRIDE { return m_aDevice.get() ? m_aDevice->getSize().getX() : 0; } + virtual long GetHeight() const SAL_OVERRIDE { return m_aDevice.get() ? m_aDevice->getSize().getY() : 0; } }; #endif // INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx index 7696e04..7f5f1f5 100644 --- a/vcl/inc/opengl/x11/salvd.hxx +++ b/vcl/inc/opengl/x11/salvd.hxx @@ -36,10 +36,12 @@ public: const SystemGraphicsData *pData ); virtual ~X11OpenGLSalVirtualDevice(); + // SalGeometryProvider + virtual long GetWidth() const SAL_OVERRIDE { return mnWidth; } + virtual long GetHeight() const SAL_OVERRIDE { return mnHeight; } + SalDisplay * GetDisplay() const { return mpDisplay; } sal_uInt16 GetDepth() const { return mnDepth; } - int GetWidth() const { return mnWidth; } - int GetHeight() const { return mnHeight; } SalX11Screen GetXScreenNumber() const { return mnXScreen; } virtual SalGraphics* AcquireGraphics() SAL_OVERRIDE; diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index f427c24..cfc41b7 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -96,7 +96,9 @@ typedef sal_uInt64 SalExtStyle; struct SystemParentData; -class VCL_PLUGIN_PUBLIC SalFrame : public vcl::DeletionNotifier +class VCL_PLUGIN_PUBLIC SalFrame + : public vcl::DeletionNotifier + , public SalGeometryProvider { // the VCL window corresponding to this frame vcl::Window* m_pWindow; @@ -108,6 +110,11 @@ public: SalFrameGeometry maGeometry; + // SalGeometryProvider + virtual long GetWidth() const SAL_OVERRIDE { return maGeometry.nWidth; } + virtual long GetHeight() const SAL_OVERRIDE { return maGeometry.nHeight; } + virtual bool IsOffScreen() const SAL_OVERRIDE { return false; } + // SalGraphics or NULL, but two Graphics for all SalFrames // must be returned virtual SalGraphics* AcquireGraphics() = 0; diff --git a/vcl/inc/salgeom.hxx b/vcl/inc/salgeom.hxx index 138a6d9..d54c58a 100644 --- a/vcl/inc/salgeom.hxx +++ b/vcl/inc/salgeom.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_VCL_INC_SALGEOM_HXX #define INCLUDED_VCL_INC_SALGEOM_HXX +#include <vcl/dllapi.h> + typedef struct _SalFrameGeometry { // screen position of upper left corner of drawable area in pixel long nX, nY; @@ -40,6 +42,16 @@ typedef struct _SalFrameGeometry { {} } SalFrameGeometry; +/// Interface used to share logic on sizing between +/// SalVirtualDevices and SalFrames +class VCL_PLUGIN_PUBLIC SalGeometryProvider { +public: + virtual ~SalGeometryProvider() {} + virtual long GetWidth() const = 0; + virtual long GetHeight() const = 0; + virtual bool IsOffScreen() const = 0; +}; + #endif // INCLUDED_VCL_INC_SALGEOM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index 1397935..c07722f 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -22,15 +22,20 @@ #include <basebmp/bitmapdevice.hxx> #include <vcl/dllapi.h> +#include <salgeom.hxx> class SalGraphics; class VCL_PLUGIN_PUBLIC SalVirtualDevice + : public SalGeometryProvider { public: SalVirtualDevice() {} virtual ~SalVirtualDevice(); + // SalGeometryProvider + virtual bool IsOffScreen() const SAL_OVERRIDE { return true; } + // SalGraphics or NULL, but two Graphics for all SalVirtualDevices // must be returned virtual SalGraphics* AcquireGraphics() = 0; diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h index 9b520a7..0b08521 100644 --- a/vcl/inc/unx/salvd.h +++ b/vcl/inc/unx/salvd.h @@ -64,8 +64,6 @@ public: } Pixmap GetDrawable() const { return hDrawable_; } sal_uInt16 GetDepth() const { return nDepth_; } - int GetWidth() const { return nDX_; } - int GetHeight() const { return nDY_; } SalX11Screen GetXScreenNumber() const { return m_nXScreen; } virtual SalGraphics* AcquireGraphics() SAL_OVERRIDE; @@ -73,6 +71,10 @@ public: /// Set new size, without saving the old contents virtual bool SetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; + + // SalGeometryProvider + virtual long GetWidth() const SAL_OVERRIDE { return nDX_; } + virtual long GetHeight() const SAL_OVERRIDE { return nDY_; } }; #endif // INCLUDED_VCL_INC_UNX_SALVD_H diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 9abb46b..6ecba54 100644 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h @@ -43,6 +43,8 @@ public: sal_uInt16 mnBitCount; // BitCount (0 or 1) bool mbGraphics; // is Graphics used bool mbForeignDC; // uses a foreign DC instead of a bitmap + long mnWidth; + long mnHeight; WinSalVirtualDevice(); virtual ~WinSalVirtualDevice(); @@ -52,6 +54,10 @@ public: virtual bool SetSize( long nNewDX, long nNewDY ); static HBITMAP ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppDummy); + + // SalGeometryProvider + virtual long GetWidth() const SAL_OVERRIDE { return mnWidth; } + virtual long GetHeight() const SAL_OVERRIDE { return mnHeight; } }; diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx index 4fde8f8..7996cff 100644 --- a/vcl/opengl/x11/salvd.cxx +++ b/vcl/opengl/x11/salvd.cxx @@ -80,6 +80,7 @@ void X11OpenGLSalVirtualDevice::ReleaseGraphics( SalGraphics* ) mbGraphics = false; } + bool X11OpenGLSalVirtualDevice::SetSize( long nDX, long nDY ) { if( !nDX ) nDX = 1; diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx index 2533107..0449b98 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.cxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx @@ -96,30 +96,26 @@ void X11CairoTextRender::clipRegion(cairo_t* cr) size_t X11CairoTextRender::GetWidth() const { - if( mrParent.m_pFrame ) - return mrParent.m_pFrame->maGeometry.nWidth; - else if( mrParent.m_pVDev ) - { - long nWidth = 0; - long nHeight = 0; - mrParent.m_pVDev->GetSize( nWidth, nHeight ); - return nWidth; - } - return 1; + SalGeometryProvider *pProvider = mrParent.m_pFrame; + if( !pProvider ) + pProvider = mrParent.m_pVDev; + + if( pProvider ) + return pProvider->GetWidth(); + else + return 1; } size_t X11CairoTextRender::GetHeight() const { - if( mrParent.m_pFrame ) - return mrParent.m_pFrame->maGeometry.nHeight; - else if( mrParent.m_pVDev ) - { - long nWidth = 0; - long nHeight = 0; - mrParent.m_pVDev->GetSize( nWidth, nHeight ); - return nHeight; - } - return 1; + SalGeometryProvider *pProvider = mrParent.m_pFrame; + if( !pProvider ) + pProvider = mrParent.m_pVDev; + + if( pProvider ) + return pProvider->GetHeight(); + else + return 1; } void X11CairoTextRender::drawSurface(cairo_t* /*cr*/) diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index b5986b1..cea8a76 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -115,6 +115,8 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, } pVirGraphics->InitGraphics(); + mnWidth = nDX; + mnHeight = nDY; pVDev->setHDC(hDC); pVDev->mhBmp = hBmp; if( hBmp ) @@ -152,6 +154,8 @@ WinSalVirtualDevice::WinSalVirtualDevice() mnBitCount = 0; // BitCount (0 or 1) mbGraphics = FALSE; // is Graphics used mbForeignDC = FALSE; // uses a foreign DC instead of a bitmap + mnWidth = 0; + mnHeight = 0; } WinSalVirtualDevice::~WinSalVirtualDevice() commit 38511b4027c4268051925a5e5658cff489844b71 Author: Michael Meeks <[email protected]> Date: Sat Nov 29 21:42:47 2014 +0000 vcl: remove SalVirtualDevice::GetWidth It is presumed that #i59315# is fixed already, and that this is no longer necessary. Change-Id: Ifb2f6550fac2481c4fec269b38d6e806753cb53e diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index dc280db..e2f9042 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -93,18 +93,6 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, return true; } -void SvpSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - if( m_aDevice.get() ) - { - B2IVector aDevSize( m_aDevice->getSize() ); - rWidth = aDevSize.getX(); - rHeight = aDevSize.getY(); - } - else - rWidth = rHeight = 0; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index f6a9cc5..752e91c 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -49,7 +49,6 @@ public: const basebmp::RawMemorySharedArray &pBuffer, const bool bTopDown ) SAL_OVERRIDE; - virtual void GetSize( long& rWidth, long& rHeight ) SAL_OVERRIDE; basebmp::BitmapDeviceSharedPtr getBitmapDevice() { return m_aDevice; } }; diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx index 0d7143b..7696e04 100644 --- a/vcl/inc/opengl/x11/salvd.hxx +++ b/vcl/inc/opengl/x11/salvd.hxx @@ -47,7 +47,6 @@ public: // Set new size, without saving the old contents virtual bool SetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; - virtual void GetSize( long& rWidth, long& rHeight ) SAL_OVERRIDE; }; #endif // INCLUDED_VCL_INC_OPENGL_X11_SALVD_H diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h index f48a19a..e1d1d51 100644 --- a/vcl/inc/quartz/salvd.h +++ b/vcl/inc/quartz/salvd.h @@ -61,7 +61,6 @@ public: virtual SalGraphics* AcquireGraphics() SAL_OVERRIDE; virtual void ReleaseGraphics( SalGraphics* pGraphics ) SAL_OVERRIDE; virtual bool SetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; - virtual void GetSize( long& rWidth, long& rHeight ) SAL_OVERRIDE; }; #endif // INCLUDED_VCL_INC_QUARTZ_SALVD_H diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index f5a63ee..1397935 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -49,9 +49,6 @@ public: // pBuffer (and bTopDown). return SetSize( nNewDX, nNewDY ); } - - /// Get actual VDev size in pixel - virtual void GetSize( long& rWidth, long& rHeight ) = 0; }; #endif // INCLUDED_VCL_INC_SALVD_HXX diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h index b1caa68..9b520a7 100644 --- a/vcl/inc/unx/salvd.h +++ b/vcl/inc/unx/salvd.h @@ -71,9 +71,8 @@ public: virtual SalGraphics* AcquireGraphics() SAL_OVERRIDE; virtual void ReleaseGraphics( SalGraphics* pGraphics ) SAL_OVERRIDE; - // Set new size, without saving the old contents + /// Set new size, without saving the old contents virtual bool SetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; - virtual void GetSize( long& rWidth, long& rHeight ) SAL_OVERRIDE; }; #endif // INCLUDED_VCL_INC_UNX_SALVD_H diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 2c59f47..9abb46b 100644 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h @@ -50,7 +50,6 @@ public: virtual SalGraphics* AcquireGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); virtual bool SetSize( long nNewDX, long nNewDY ); - virtual void GetSize( long& rWidth, long& rHeight ); static HBITMAP ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppDummy); }; diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx index b7c4eea..4fde8f8 100644 --- a/vcl/opengl/x11/salvd.cxx +++ b/vcl/opengl/x11/salvd.cxx @@ -93,10 +93,4 @@ bool X11OpenGLSalVirtualDevice::SetSize( long nDX, long nDY ) return true; } -void X11OpenGLSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - rWidth = mnWidth; - rHeight = mnHeight; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index f430908..a524c1e 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -277,20 +277,4 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) return (mxLayer != NULL); } -void AquaSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - if( mxLayer ) - { - const CGSize aSize = CGLayerGetSize( mxLayer ); - rWidth = static_cast<long>(aSize.width); - rHeight = static_cast<long>(aSize.height); - CG_TRACE( "CGLayerGetSize(" << mxLayer << ") = " << aSize << "(" << rWidth << "x" << rHeight << ")" ); - } - else - { - rWidth = 0; - rHeight = 0; - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 2036523..dc8fd82 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -164,12 +164,6 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, mbScreenComp = true; mnAlphaDepth = -1; - // #i59315# init vdev size from system object, when passed a - // SystemGraphicsData. Otherwise, output size will always - // incorrectly stay at (1,1) - if( pData && mpVirDev ) - mpVirDev->GetSize(mnOutWidth,mnOutHeight); - if( mnBitCount < 8 ) SetAntialiasing( ANTIALIASING_DISABLE_TEXT ); diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 7967a4d..b4bcfa1 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -214,10 +214,4 @@ bool X11SalVirtualDevice::SetSize( long nDX, long nDY ) return true; } -void X11SalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - rWidth = GetWidth(); - rHeight = GetHeight(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index c85133d..b5986b1 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -216,10 +216,4 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) } } -void WinSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - rWidth = GetDeviceCaps( getHDC(), HORZRES ); - rHeight= GetDeviceCaps( getHDC(), VERTRES ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
