[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/opengl vcl/quartz vcl/unx vcl/win

Michael Meeks michael.meeks at collabora.com
Sat Feb 28 06:24:08 PST 2015


 vcl/headless/svpinst.cxx      |    2 +-
 vcl/inc/headless/svpinst.hxx  |    2 +-
 vcl/inc/opengl/x11/salvd.hxx  |    2 +-
 vcl/inc/osx/salinst.h         |    5 +++--
 vcl/inc/quartz/salvd.h        |    2 +-
 vcl/inc/salinst.hxx           |    6 ++++--
 vcl/inc/unx/gtk/gtkinst.hxx   |    2 +-
 vcl/inc/unx/salinst.h         |    2 +-
 vcl/inc/unx/salvd.h           |    2 +-
 vcl/inc/win/salinst.h         |    2 +-
 vcl/opengl/x11/salvd.cxx      |    2 +-
 vcl/quartz/salvd.cxx          |   17 ++++++++++++++---
 vcl/unx/generic/gdi/salvd.cxx |    6 ++++--
 vcl/unx/gtk/app/gtkinst.cxx   |    2 +-
 vcl/win/source/gdi/salvd.cxx  |   14 ++++++++++++--
 15 files changed, 47 insertions(+), 21 deletions(-)

New commits:
commit 45306431759ec5e1bda8caa1ed428fc77035b0f2
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Feb 28 12:22:29 2015 +0000

    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 at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index a108883..7c94f66 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 c64d461..7adaa7a 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 7f5f1f5..2d60898 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 b37035c..b2d6133 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 e3c68ab..4a4e0f6 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 6a89e40..eb53177 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 6420380..fa61f07 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 c2fe9b6..b8feb71 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 0b08521..4f98c0c 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 fa66049..450d07c 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 0ade87d..e98329b 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 ceb7e9b..25688eb 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 f7d572f..1b9d992 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 e26e161..8bce06f 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 2b00464..c76432d 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" );
 


More information about the Libreoffice-commits mailing list