diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-02-28 12:22:29 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-02-28 14:23:31 +0000 |
commit | 45306431759ec5e1bda8caa1ed428fc77035b0f2 (patch) | |
tree | 59a870b35c6117196914da81f32c2919fe899be4 | |
parent | c1b9402d49a7cd4bec383f28d397d9d89541f0e0 (diff) |
tdf#89482 - return size of system virtual device resource at construction.
Change-Id: I832a5626b52935180f24857e56297840667eec2a
Reviewed-on: https://gerrit.libreoffice.org/14678
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | vcl/headless/svpinst.cxx | 2 | ||||
-rw-r--r-- | vcl/inc/headless/svpinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/opengl/x11/salvd.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/osx/salinst.h | 5 | ||||
-rw-r--r-- | vcl/inc/quartz/salvd.h | 2 | ||||
-rw-r--r-- | vcl/inc/salinst.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/salinst.h | 2 | ||||
-rw-r--r-- | vcl/inc/unx/salvd.h | 2 | ||||
-rw-r--r-- | vcl/inc/win/salinst.h | 2 | ||||
-rw-r--r-- | vcl/opengl/x11/salvd.cxx | 2 | ||||
-rw-r--r-- | vcl/quartz/salvd.cxx | 17 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salvd.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkinst.cxx | 2 | ||||
-rw-r--r-- | vcl/win/source/gdi/salvd.cxx | 14 |
15 files changed, 47 insertions, 21 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index a1088834def4..7c94f66f0495 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -224,7 +224,7 @@ void SvpSalInstance::DestroyObject( SalObject* pObject ) #ifndef IOS SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* /* pGraphics */, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData* /* pData */ ) { diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx index c64d461bddfa..7adaa7aeb497 100644 --- a/vcl/inc/headless/svpinst.hxx +++ b/vcl/inc/headless/svpinst.hxx @@ -124,7 +124,7 @@ public: // nBitCount: 0 == Default(=as window) / 1 == Mono // pData allows for using a system dependent graphics or device context virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE; // Printer diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx index 7f5f1f5d1a7c..2d6089849031 100644 --- a/vcl/inc/opengl/x11/salvd.hxx +++ b/vcl/inc/opengl/x11/salvd.hxx @@ -31,7 +31,7 @@ class X11OpenGLSalVirtualDevice : public SalVirtualDevice public: X11OpenGLSalVirtualDevice( SalGraphics *pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ); virtual ~X11OpenGLSalVirtualDevice(); diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h index b37035cce7c9..b2d6133495fa 100644 --- a/vcl/inc/osx/salinst.h +++ b/vcl/inc/osx/salinst.h @@ -89,8 +89,9 @@ public: virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE; virtual void DestroyObject( SalObject* pObject ) SAL_OVERRIDE; virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, - sal_uInt16 nBitCount, const SystemGraphicsData *pData ) SAL_OVERRIDE; + long &nDX, long &nDY, + sal_uInt16 nBitCount, + const SystemGraphicsData *pData ) SAL_OVERRIDE; virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) SAL_OVERRIDE; virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) SAL_OVERRIDE; diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h index e3c68ab9ff10..4a4e0f666481 100644 --- a/vcl/inc/quartz/salvd.h +++ b/vcl/inc/quartz/salvd.h @@ -55,7 +55,7 @@ private: void Destroy(); public: - AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ); + AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ); virtual ~AquaSalVirtualDevice(); virtual SalGraphics* AcquireGraphics() SAL_OVERRIDE; diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 6a89e407fa03..eb5317746f96 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -83,10 +83,12 @@ public: // VirtualDevice // nDX and nDY in pixels // nBitCount: 0 == default(=as window) / 1 == mono - // pData allows for using a system dependent graphics or device context + // pData allows for using a system dependent graphics or device context, + // if a system context is passed in nDX and nDY are updated to reflect + // its size; otherwise these remain unchanged. virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &rDX, long &rDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0; // Printer diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 642038056630..fa61f07f3daf 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -75,7 +75,7 @@ public: virtual SalTimer* CreateSalTimer() SAL_OVERRIDE; virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) SAL_OVERRIDE; virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics*, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData* ) SAL_OVERRIDE; virtual SalBitmap* CreateSalBitmap() SAL_OVERRIDE; diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h index c2fe9b6f497f..b8feb71b33ae 100644 --- a/vcl/inc/unx/salinst.h +++ b/vcl/inc/unx/salinst.h @@ -54,7 +54,7 @@ public: virtual void DestroyObject( SalObject* pObject ) SAL_OVERRIDE; virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE; virtual void PostPrintersChanged() SAL_OVERRIDE; virtual GenPspGraphics *CreatePrintGraphics() SAL_OVERRIDE; diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h index 0b08521c3704..4f98c0c68ad7 100644 --- a/vcl/inc/unx/salvd.h +++ b/vcl/inc/unx/salvd.h @@ -45,7 +45,7 @@ class X11SalVirtualDevice : public SalVirtualDevice public: X11SalVirtualDevice( SalGraphics *pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ); virtual ~X11SalVirtualDevice(); diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index fa660497dc6d..450d07cfc139 100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -42,7 +42,7 @@ public: virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE; virtual void DestroyObject( SalObject* pObject ) SAL_OVERRIDE; virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) SAL_OVERRIDE; virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) SAL_OVERRIDE; diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx index 0ade87d066a4..e98329bfea2f 100644 --- a/vcl/opengl/x11/salvd.cxx +++ b/vcl/opengl/x11/salvd.cxx @@ -34,7 +34,7 @@ void X11SalGraphics::Init( X11OpenGLSalVirtualDevice *pDevice ) } X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) : mbGraphics( false ), diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index ceb7e9b0db5c..25688ebd60bf 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -35,7 +35,7 @@ #include "quartz/utils.h" SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { // #i92075# can be called first in a thread SalData::ensureThreadAutoreleasePool(); @@ -54,7 +54,7 @@ SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, #endif } -AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) +AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) : mbGraphicsUsed( false ) , mxBitmapContext( NULL ) , mnBitmapDepth( 0 ) @@ -65,7 +65,6 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX, { // Create virtual device based on existing SystemGraphicsData // We ignore nDx and nDY, as the desired size comes from the SystemGraphicsData. - // WTF does the above mean, SystemGraphicsData has no size field(s). mbForeignContext = true; // the mxContext is from pData (what "mxContext"? there is no such field anywhere in vcl;) mpGraphics = new AquaSalGraphics( /*pGraphic*/ ); if (nDX == 0) @@ -73,6 +72,18 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX, if (nDY == 0) nDY = 1; mxLayer = CGLayerCreateWithContext( pData->rCGContext, CGSizeMake( nDX, nDY), NULL ); + // Interogate the context as to its real size + if (mxLayer) + { + const CGSize aSize = CGLayerGetSize( mxLayer ); + nDX = static_cast<long>(aSize.width); + nDY = static_cast<long>(aSize.height); + } + else + { + nDX = 0; + nDY = 0; + } CG_TRACE( "CGLayerCreateWithContext(" << pData->rCGContext << "," << CGSizeMake( nDX, nDY) << ",NULL) = " << mxLayer ); mpGraphics->SetVirDevGraphics( mxLayer, pData->rCGContext ); } diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index f7d572f374be..1b9d992e6fe5 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -36,7 +36,7 @@ #include <opengl/x11/salvd.hxx> SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { if (OpenGLHelper::isVCLOpenGLEnabled()) @@ -82,7 +82,7 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap, } X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData ) : m_nXScreen( 0 ), @@ -115,6 +115,8 @@ X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics, } nDX_ = (long)w; nDY_ = (long)h; + nDX = nDX_; + nDY = nDY_; m_nXScreen = SalX11Screen( nScreen ); hDrawable_ = pData->hDrawable; bExternPixmap_ = true; diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index e26e16158a48..8bce06f6cce8 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -309,7 +309,7 @@ void GtkYieldMutex::ThreadsLeave() } SalVirtualDevice* GtkInstance::CreateVirtualDevice( SalGraphics *pG, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pGd ) { diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 2b0046419090..c76432d52da1 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -67,7 +67,7 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, } SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, - long nDX, long nDY, + long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData* pData ) { @@ -82,10 +82,20 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, hDC = pData->hDC; hBmp = NULL; bOk = (hDC != NULL); + if (bOk) + { + nDX = GetDeviceCaps( hDC, HORZRES ); + nDY = GetDeviceCaps( hDC, VERTRES ); + } + else + { + nDX = 0; + nDY = 0; + } } else { - hDC = CreateCompatibleDC( pGraphics->getHDC() ); + hDC = CreateCompatibleDC( pGraphics->getHDC() ); if( !hDC ) ImplWriteLastError( GetLastError(), "CreateCompatibleDC in CreateVirtualDevice" ); |