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

Michael Meeks michael.meeks at collabora.com
Thu Mar 5 01:55:52 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         |    4 ++--
 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, 48 insertions(+), 22 deletions(-)

New commits:
commit fe00fba292a9ad1c416acc199e7aba6657ab40b3
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.
    
    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>
    
    Conflicts:
    	vcl/inc/win/salinst.h
    
    Change-Id: I832a5626b52935180f24857e56297840667eec2a
    Reviewed-on: https://gerrit.libreoffice.org/14679
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 3bb44e0..b3097cf 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 0bf542f..370a749 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 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 8a88a26..2955308 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 fb2adda..ebaf413 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 3cabea3..bda2a1a 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 cea08dd..a4649be 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 a6ccbb5..12ecb40 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 7996cff..102abeb 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..4a8878d 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 b4bcfa1..148c06c 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 7854adf..d47098e 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 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