summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-02-28 12:22:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-03-05 09:55:29 +0000
commitfe00fba292a9ad1c416acc199e7aba6657ab40b3 (patch)
tree60516891efcfc98fb57981ad8c4a5f9f0ebe6c0c
parent4f5f5b5d0e141e1d719eae3ba243ccf6e4e50e41 (diff)
tdf#89482 - return size of system virtual device resource at construction.
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> Conflicts: vcl/inc/win/salinst.h Change-Id: I832a5626b52935180f24857e56297840667eec2a Reviewed-on: https://gerrit.libreoffice.org/14679 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/headless/svpinst.cxx2
-rw-r--r--vcl/inc/headless/svpinst.hxx2
-rw-r--r--vcl/inc/opengl/x11/salvd.hxx2
-rw-r--r--vcl/inc/osx/salinst.h5
-rw-r--r--vcl/inc/quartz/salvd.h2
-rw-r--r--vcl/inc/salinst.hxx6
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx2
-rw-r--r--vcl/inc/unx/salinst.h2
-rw-r--r--vcl/inc/unx/salvd.h2
-rw-r--r--vcl/inc/win/salinst.h4
-rw-r--r--vcl/opengl/x11/salvd.cxx2
-rw-r--r--vcl/quartz/salvd.cxx17
-rw-r--r--vcl/unx/generic/gdi/salvd.cxx6
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx2
-rw-r--r--vcl/win/source/gdi/salvd.cxx14
15 files changed, 48 insertions, 22 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 3bb44e0c161a..b3097cf0c6c6 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -221,7 +221,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 0bf542fccd2b..370a749fea5b 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -123,7 +123,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 8a88a2616f73..295530841f26 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 fb2addaf7684..ebaf4134efcc 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -82,10 +82,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 3cabea3d0d26..bda2a1aea170 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -77,7 +77,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 cea08dd6da96..a4649beed5e7 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 a6ccbb57f216..12ecb407acae 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -42,8 +42,8 @@ public:
virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true );
virtual void DestroyObject( SalObject* pObject );
virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
- long nDX, long nDY,
- sal_uInt16 nBitCount, const SystemGraphicsData *pData );
+ long &nDX, long &nDY,
+ sal_uInt16 nBitCount, const SystemGraphicsData *pData ) SAL_OVERRIDE;
virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
ImplJobSetup* pSetupData );
virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter );
diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx
index 7996cffcee04..102abeb4811c 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..4a8878d3a95e 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 );
+ // Interrogate 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 b4bcfa16edb5..148c06c68def 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 7854adfbe1ad..d47098e33146 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -321,7 +321,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" );