summaryrefslogtreecommitdiff
path: root/vcl/quartz/salvd.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-02-28 12:22:29 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-02-28 14:23:31 +0000
commit45306431759ec5e1bda8caa1ed428fc77035b0f2 (patch)
tree59a870b35c6117196914da81f32c2919fe899be4 /vcl/quartz/salvd.cxx
parentc1b9402d49a7cd4bec383f28d397d9d89541f0e0 (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>
Diffstat (limited to 'vcl/quartz/salvd.cxx')
-rw-r--r--vcl/quartz/salvd.cxx17
1 files changed, 14 insertions, 3 deletions
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 );
}