[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 4 commits - vcl/inc vcl/source vcl/win

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Nov 1 18:40:15 PDT 2014


 vcl/inc/win/salgdi.h                |   29 +++++++++++++++++++++--------
 vcl/source/opengl/OpenGLContext.cxx |    6 +++---
 vcl/win/source/gdi/gdiimpl.cxx      |   34 +++++++++++++++++-----------------
 vcl/win/source/gdi/salgdi.cxx       |   34 ++++++++++++++++++++++++++++++++--
 vcl/win/source/gdi/salprn.cxx       |    7 +------
 vcl/win/source/gdi/salvd.cxx        |    9 ++-------
 vcl/win/source/window/salframe.cxx  |   18 ++++--------------
 7 files changed, 80 insertions(+), 57 deletions(-)

New commits:
commit fbc8db04ad4515e609ca497a47bddae1387885f7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 2 02:39:36 2014 +0100

    a little bit more sanity
    
    Change-Id: I080984c5faaa8cf349ba37ffdb116b6d8d016552

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 57b1381..363ab0f 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -152,6 +152,7 @@ private:
     bool                    mbVirDev : 1;           // is VirDev
     bool                    mbWindow : 1;           // is Window
     bool                    mbScreen : 1;           // is Screen compatible
+    HWND                    mhWnd;              // Window-Handle, when Window-Graphics
 
 public:
     HDC getHDC() const { return mhLocalDC; }
@@ -166,7 +167,6 @@ public:
     };
 
 public:
-    HWND                    mhWnd;              // Window-Handle, when Window-Graphics
 
     HWND gethWnd();
     HFONT                   mhFonts[ MAX_FALLBACK ];        // Font + Fallbacks
@@ -194,7 +194,7 @@ public:
     HFONT                   ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontScale, HFONT& o_rOldFont );
 
 public:
-    explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen);
+    explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd);
     virtual ~WinSalGraphics();
 
     bool isPrinter() const;
@@ -202,6 +202,8 @@ public:
     bool isWindow() const;
     bool isScreen() const;
 
+    void setHWND(HWND hWnd);
+
 protected:
     virtual bool        setClipRegion( const vcl::Region& );
     // draw --> LineColor and FillColor and RasterOp and ClipRegion
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index c9f9cf4..af16d90 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -554,12 +554,13 @@ void ImplClearHDCCache( SalData* pData )
     }
 }
 
-WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen):
+WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd):
     mpImpl(new WinSalGraphicsImpl(*this)),
     mhLocalDC(0),
     mbPrinter(eType == WinSalGraphics::PRINTER),
     mbVirDev(eType == WinSalGraphics::VIRTUAL_DEVICE),
     mbWindow(eType == WinSalGraphics::WINDOW),
+    mhWnd(hWnd),
     mbScreen(bScreen),
     mfCurrentFontScale(1.0),
     mhRegion(0),
@@ -638,6 +639,11 @@ HWND WinSalGraphics::gethWnd()
     return mhWnd;
 }
 
+void WinSalGraphics::setHWND(HWND hWnd)
+{
+    mhWnd = hWnd;
+}
+
 void WinSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY )
 {
     rDPIX = GetDeviceCaps( getHDC(), LOGPIXELSX );
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index ffcc7d0..b992554 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -1045,10 +1045,9 @@ static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetup
 
 static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC )
 {
-    WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false);
+    WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false, 0);
     pGraphics->SetLayout( 0 );
     pGraphics->setHDC(hDC);
-    pGraphics->mhWnd    = 0;
     ImplSalInitGraphics( pGraphics );
     return pGraphics;
 }
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index a05de8d..820f12f 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -104,10 +104,9 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
     {
         WinSalVirtualDevice*    pVDev = new WinSalVirtualDevice;
         SalData*                pSalData = GetSalData();
-        WinSalGraphics*         pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen());
+        WinSalGraphics*         pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), 0);
         pVirGraphics->SetLayout( 0 );   // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL()
         pVirGraphics->setHDC(hDC);
-        pVirGraphics->mhWnd    = 0;
         if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
         {
             pVirGraphics->mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 309dd5a..dde2845 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -983,9 +983,8 @@ SalGraphics* WinSalFrame::AcquireGraphics()
 
         if ( !mpGraphics2 )
         {
-            mpGraphics2 = new WinSalGraphics(WinSalGraphics::WINDOW, true);
+            mpGraphics2 = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd);
             mpGraphics2->setHDC(0);
-            mpGraphics2->mhWnd       = mhWnd;
         }
 
         HDC hDC = (HDC)(sal_IntPtr)SendMessageW( pSalData->mpFirstInstance->mhComWnd,
@@ -1015,9 +1014,8 @@ SalGraphics* WinSalFrame::AcquireGraphics()
             HDC hDC = GetDC( mhWnd );
             if ( hDC )
             {
-                mpGraphics = new WinSalGraphics(WinSalGraphics::WINDOW, true);
+                mpGraphics = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd);
                 mpGraphics->setHDC(hDC);
-                mpGraphics->mhWnd     = mhWnd;
                 if ( pSalData->mhDitherPal )
                 {
                     mpGraphics->mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
@@ -1512,7 +1510,7 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
     {
         if( pThis->mpGraphics2 )
         {
-            pThis->mpGraphics2->mhWnd = hWnd;
+            pThis->mpGraphics2->setHWND(hWnd);
 
             if( bNeedCacheDC )
             {
@@ -1550,7 +1548,7 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
         if( pThis->mpGraphics )
         {
             // re-create DC
-            pThis->mpGraphics->mhWnd = hWnd;
+            pThis->mpGraphics->setHWND(hWnd);
             pThis->mpGraphics->setHDC( GetDC( hWnd ) );
             if ( GetSalData()->mhDitherPal )
             {
commit c806b4f430554c2f5b06680527d9d80f97db3116
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 2 02:24:31 2014 +0100

    remove unused code and const-ify some methods
    
    Change-Id: I4c8da0cdf39f31ec757e87687dcec79a4ac83681

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 798a99b..57b1381 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -194,14 +194,13 @@ public:
     HFONT                   ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontScale, HFONT& o_rOldFont );
 
 public:
-    explicit WinSalGraphics();
     explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen);
     virtual ~WinSalGraphics();
 
-    bool isPrinter();
-    bool isVirtualDevice();
-    bool isWindow();
-    bool isScreen();
+    bool isPrinter() const;
+    bool isVirtualDevice() const;
+    bool isWindow() const;
+    bool isScreen() const;
 
 protected:
     virtual bool        setClipRegion( const vcl::Region& );
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 7eb758f..c9f9cf4 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -554,44 +554,6 @@ void ImplClearHDCCache( SalData* pData )
     }
 }
 
-WinSalGraphics::WinSalGraphics():
-    mpImpl(new WinSalGraphicsImpl(*this)),
-    mhLocalDC(0),
-    mbPrinter(false),
-    mbVirDev(false),
-    mbWindow(false),
-    mbScreen(false),
-    mfCurrentFontScale(1.0),
-    mhRegion(0),
-    mhDefPen(0),
-    mhDefBrush(0),
-    mhDefFont(0),
-    mhDefPal(0),
-    mpStdClipRgnData(NULL),
-    mpLogFont(NULL),
-    mpFontCharSets(NULL),
-    mpFontAttrCache(NULL),
-    mnFontCharSetCount(0),
-    mpFontKernPairs(NULL),
-    mnFontKernPairCount(0),
-    mbFontKernInit(false),
-    mnPenWidth(GSL_PEN_WIDTH)
-{
-    for( int i = 0; i < MAX_FALLBACK; ++i )
-    {
-        mhFonts[ i ] = 0;
-        mpWinFontData[ i ]  = NULL;
-        mpWinFontEntry[ i ] = NULL;
-        mfFontScale[ i ] = 1.0;
-    }
-
-    static const char* pEnv = getenv("USE_OPENGL");
-    if (pEnv)
-    {
-        mpImpl.reset(new OpenGLSalGraphicsImpl());
-    }
-}
-
 WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen):
     mpImpl(new WinSalGraphicsImpl(*this)),
     mhLocalDC(0),
@@ -651,22 +613,22 @@ WinSalGraphics::~WinSalGraphics()
     delete mpFontKernPairs;
 }
 
-bool WinSalGraphics::isPrinter()
+bool WinSalGraphics::isPrinter() const
 {
     return mbPrinter;
 }
 
-bool WinSalGraphics::isVirtualDevice()
+bool WinSalGraphics::isVirtualDevice() const
 {
     return mbVirDev;
 }
 
-bool WinSalGraphics::isWindow()
+bool WinSalGraphics::isWindow() const
 {
     return mbWindow;
 }
 
-bool WinSalGraphics::isScreen()
+bool WinSalGraphics::isScreen() const
 {
     return mbScreen;
 }
commit 8b6c70268883b0cf9ed20882f3d17c35fcc0007c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 2 02:13:29 2014 +0100

    start to bring some sanity to windows backend
    
    Just moving some of our variables from public to private to understand which ones are actively set from outside objects.
    
    Change-Id: I33998bb95c93195c6c39778e37ac1071b917c8fa

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 09df7ca..798a99b 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -148,11 +148,23 @@ private:
     boost::scoped_ptr<SalGraphicsImpl> mpImpl;
 
     HDC                     mhLocalDC;              // HDC
+    bool                    mbPrinter : 1;          // is Printer
+    bool                    mbVirDev : 1;           // is VirDev
+    bool                    mbWindow : 1;           // is Window
+    bool                    mbScreen : 1;           // is Screen compatible
 
 public:
     HDC getHDC() const { return mhLocalDC; }
     void setHDC(HDC aNew) { mhLocalDC = aNew; }
 
+    enum Type
+    {
+        PRINTER,
+        VIRTUAL_DEVICE,
+        WINDOW,
+        SCREEN
+    };
+
 public:
     HWND                    mhWnd;              // Window-Handle, when Window-Graphics
 
@@ -179,18 +191,18 @@ public:
     sal_uIntPtr                 mnFontKernPairCount;// Number of Kerning Pairs of the current Font
     int                     mnPenWidth;         // Linienbreite
 
-    /// bitfield
-    bool                    mbPrinter : 1;          // is Printer
-    bool                    mbVirDev : 1;           // is VirDev
-    bool                    mbWindow : 1;           // is Window
-    bool                    mbScreen : 1;           // is Screen compatible
-
     HFONT                   ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontScale, HFONT& o_rOldFont );
 
 public:
     explicit WinSalGraphics();
+    explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen);
     virtual ~WinSalGraphics();
 
+    bool isPrinter();
+    bool isVirtualDevice();
+    bool isWindow();
+    bool isScreen();
+
 protected:
     virtual bool        setClipRegion( const vcl::Region& );
     // draw --> LineColor and FillColor and RasterOp and ClipRegion
diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index 7e99a8d..453033f 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -394,7 +394,7 @@ void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY,
     HRGN    hInvalidateRgn = 0;
 
     // do we have to invalidate also the overlapping regions?
-    if ( (nFlags & SAL_COPYAREA_WINDOWINVALIDATE) && mrParent.mbWindow )
+    if ( (nFlags & SAL_COPYAREA_WINDOWINVALIDATE) && mrParent.isWindow() )
     {
         // compute and invalidate those parts that were either off-screen or covered by other windows
         //  while performing the above BitBlt
@@ -688,7 +688,7 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa
 
 void WinSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap)
 {
-    bool bTryDirectPaint(!mrParent.mbPrinter && !mbXORMode);
+    bool bTryDirectPaint(!mrParent.isPrinter() && !mbXORMode);
 
     if(bTryDirectPaint)
     {
@@ -709,7 +709,7 @@ void WinSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap&
 
     // fall back old stuff
     ImplDrawBitmap(mrParent.getHDC(), rPosAry, static_cast<const WinSalBitmap&>(rSalBitmap),
-        mrParent.mbPrinter,
+        mrParent.isPrinter(),
         mbXORMode ? SRCINVERT : SRCCOPY );
 }
 
@@ -717,7 +717,7 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
                               const SalBitmap& rSSalBitmap,
                               SalColor nTransparentColor )
 {
-    DBG_ASSERT( !mrParent.mbPrinter, "No transparency print possible!" );
+    DBG_ASSERT( !mrParent.isPrinter(), "No transparency print possible!" );
 
     const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap);
 
@@ -771,8 +771,8 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
                               const SalBitmap& rSSalBitmap,
                               const SalBitmap& rSTransparentBitmap )
 {
-    DBG_ASSERT( !mrParent.mbPrinter, "No transparency print possible!" );
-    bool bTryDirectPaint(!mrParent.mbPrinter && !mbXORMode);
+    DBG_ASSERT( !mrParent.isPrinter(), "No transparency print possible!" );
+    bool bTryDirectPaint(!mrParent.isPrinter() && !mbXORMode);
 
     if(bTryDirectPaint)
     {
@@ -891,7 +891,7 @@ void WinSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry,
                             const SalBitmap& rSSalBitmap,
                             SalColor nMaskColor )
 {
-    DBG_ASSERT( !mrParent.mbPrinter, "No transparency print possible!" );
+    DBG_ASSERT( !mrParent.isPrinter(), "No transparency print possible!" );
 
     const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap);
 
@@ -921,7 +921,7 @@ void WinSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry,
 
 SalBitmap* WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY )
 {
-    DBG_ASSERT( !mrParent.mbPrinter, "No ::GetBitmap() from printer possible!" );
+    DBG_ASSERT( !mrParent.isPrinter(), "No ::GetBitmap() from printer possible!" );
 
     WinSalBitmap* pSalBitmap = NULL;
 
@@ -1374,7 +1374,7 @@ void WinSalGraphicsImpl::SetLineColor( SalColor nSalColor )
 
     // search for stock pen (only screen, because printer have problems,
     // when we use stock objects)
-    if ( !mrParent.mbPrinter )
+    if ( !mrParent.isPrinter() )
     {
         SalData* pSalData = GetSalData();
         for ( sal_uInt16 i = 0; i < pSalData->mnStockPenCount; i++ )
@@ -1391,7 +1391,7 @@ void WinSalGraphicsImpl::SetLineColor( SalColor nSalColor )
     // create new pen
     if ( !hNewPen )
     {
-        if ( !mrParent.mbPrinter )
+        if ( !mrParent.isPrinter() )
         {
             if ( GetSalData()->mhDitherPal && ImplIsSysColorEntry( nSalColor ) )
                 nPenColor = PALRGB_TO_RGB( nPenColor );
@@ -1454,7 +1454,7 @@ void WinSalGraphicsImpl::SetFillColor( SalColor nSalColor )
 
     // search for stock brush (only screen, because printer have problems,
     // when we use stock objects)
-    if ( !mrParent.mbPrinter )
+    if ( !mrParent.isPrinter() )
     {
         for ( sal_uInt16 i = 0; i < pSalData->mnStockBrushCount; i++ )
         {
@@ -1470,7 +1470,7 @@ void WinSalGraphicsImpl::SetFillColor( SalColor nSalColor )
     // create new brush
     if ( !hNewBrush )
     {
-        if ( mrParent.mbPrinter || !pSalData->mhDitherDIB )
+        if ( mrParent.isPrinter() || !pSalData->mhDitherDIB )
             hNewBrush = CreateSolidBrush( nBrushColor );
         else
         {
@@ -1580,7 +1580,7 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor )
                                 SALCOLOR_GREEN( nSalColor ),
                                 SALCOLOR_BLUE( nSalColor ) );
 
-    if ( !mrParent.mbPrinter &&
+    if ( !mrParent.isPrinter() &&
          GetSalData()->mhDitherPal &&
          ImplIsSysColorEntry( nSalColor ) )
         nCol = PALRGB_TO_RGB( nCol );
@@ -1622,7 +1622,7 @@ void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
 
     LineTo( mrParent.getHDC(), (int)nX2, (int)nY2 );
 
-    if ( bPaintEnd && !mrParent.mbPrinter )
+    if ( bPaintEnd && !mrParent.isPrinter() )
     {
         if ( mbXORMode )
         {
@@ -1641,7 +1641,7 @@ void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight )
 {
     if ( !mbPen )
     {
-        if ( !mrParent.mbPrinter )
+        if ( !mrParent.isPrinter() )
         {
             PatBlt( mrParent.getHDC(), (int)nX, (int)nY, (int)nWidth, (int)nHeight,
                     mbXORMode ? PATINVERT : PATCOPY );
@@ -1692,7 +1692,7 @@ void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAr
     if ( !Polyline( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
         Polyline( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS );
 
-    if ( bPaintEnd && !mrParent.mbPrinter )
+    if ( bPaintEnd && !mrParent.isPrinter() )
     {
         if ( mbXORMode )
         {
@@ -2030,7 +2030,7 @@ bool WinSalGraphicsImpl::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly
             Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone);
         }
 
-        if(mrParent.mbPrinter)
+        if(mrParent.isPrinter())
         {
             // #i121591#
             // Normally GdiPlus should not be used for printing at all since printers cannot
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 8ccc7d0..7eb758f 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -467,7 +467,7 @@ void ImplUpdateSysColorEntries()
 void ImplSalInitGraphics( WinSalGraphics* pData )
 {
     // calculate the minimal line width for the printer
-    if ( pData->mbPrinter )
+    if ( pData->isPrinter() )
     {
         int nDPIX = GetDeviceCaps( pData->getHDC(), LOGPIXELSX );
         if ( nDPIX <= 300 )
@@ -557,6 +557,48 @@ void ImplClearHDCCache( SalData* pData )
 WinSalGraphics::WinSalGraphics():
     mpImpl(new WinSalGraphicsImpl(*this)),
     mhLocalDC(0),
+    mbPrinter(false),
+    mbVirDev(false),
+    mbWindow(false),
+    mbScreen(false),
+    mfCurrentFontScale(1.0),
+    mhRegion(0),
+    mhDefPen(0),
+    mhDefBrush(0),
+    mhDefFont(0),
+    mhDefPal(0),
+    mpStdClipRgnData(NULL),
+    mpLogFont(NULL),
+    mpFontCharSets(NULL),
+    mpFontAttrCache(NULL),
+    mnFontCharSetCount(0),
+    mpFontKernPairs(NULL),
+    mnFontKernPairCount(0),
+    mbFontKernInit(false),
+    mnPenWidth(GSL_PEN_WIDTH)
+{
+    for( int i = 0; i < MAX_FALLBACK; ++i )
+    {
+        mhFonts[ i ] = 0;
+        mpWinFontData[ i ]  = NULL;
+        mpWinFontEntry[ i ] = NULL;
+        mfFontScale[ i ] = 1.0;
+    }
+
+    static const char* pEnv = getenv("USE_OPENGL");
+    if (pEnv)
+    {
+        mpImpl.reset(new OpenGLSalGraphicsImpl());
+    }
+}
+
+WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen):
+    mpImpl(new WinSalGraphicsImpl(*this)),
+    mhLocalDC(0),
+    mbPrinter(eType == WinSalGraphics::PRINTER),
+    mbVirDev(eType == WinSalGraphics::VIRTUAL_DEVICE),
+    mbWindow(eType == WinSalGraphics::WINDOW),
+    mbScreen(bScreen),
     mfCurrentFontScale(1.0),
     mhRegion(0),
     mhDefPen(0),
@@ -609,6 +651,26 @@ WinSalGraphics::~WinSalGraphics()
     delete mpFontKernPairs;
 }
 
+bool WinSalGraphics::isPrinter()
+{
+    return mbPrinter;
+}
+
+bool WinSalGraphics::isVirtualDevice()
+{
+    return mbVirDev;
+}
+
+bool WinSalGraphics::isWindow()
+{
+    return mbWindow;
+}
+
+bool WinSalGraphics::isScreen()
+{
+    return mbScreen;
+}
+
 HWND WinSalGraphics::gethWnd()
 {
     return mhWnd;
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index 6d6b8ea..ffcc7d0 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -1045,14 +1045,10 @@ static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetup
 
 static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC )
 {
-    WinSalGraphics* pGraphics = new WinSalGraphics;
+    WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false);
     pGraphics->SetLayout( 0 );
     pGraphics->setHDC(hDC);
     pGraphics->mhWnd    = 0;
-    pGraphics->mbPrinter = TRUE;
-    pGraphics->mbVirDev = FALSE;
-    pGraphics->mbWindow = FALSE;
-    pGraphics->mbScreen = FALSE;
     ImplSalInitGraphics( pGraphics );
     return pGraphics;
 }
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index fec719b..a05de8d 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -104,15 +104,11 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
     {
         WinSalVirtualDevice*    pVDev = new WinSalVirtualDevice;
         SalData*                pSalData = GetSalData();
-        WinSalGraphics*         pVirGraphics = new WinSalGraphics;
+        WinSalGraphics*         pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen());
         pVirGraphics->SetLayout( 0 );   // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL()
         pVirGraphics->setHDC(hDC);
         pVirGraphics->mhWnd    = 0;
-        pVirGraphics->mbPrinter = FALSE;
-        pVirGraphics->mbVirDev  = TRUE;
-        pVirGraphics->mbWindow  = FALSE;
-        pVirGraphics->mbScreen  = pGraphics->mbScreen;
-        if ( pSalData->mhDitherPal && pVirGraphics->mbScreen )
+        if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
         {
             pVirGraphics->mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
             RealizePalette( hDC );
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 2de8d58..309dd5a 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -983,13 +983,9 @@ SalGraphics* WinSalFrame::AcquireGraphics()
 
         if ( !mpGraphics2 )
         {
-            mpGraphics2 = new WinSalGraphics;
+            mpGraphics2 = new WinSalGraphics(WinSalGraphics::WINDOW, true);
             mpGraphics2->setHDC(0);
             mpGraphics2->mhWnd       = mhWnd;
-            mpGraphics2->mbPrinter   = FALSE;
-            mpGraphics2->mbVirDev    = FALSE;
-            mpGraphics2->mbWindow    = TRUE;
-            mpGraphics2->mbScreen    = TRUE;
         }
 
         HDC hDC = (HDC)(sal_IntPtr)SendMessageW( pSalData->mpFirstInstance->mhComWnd,
@@ -1019,13 +1015,9 @@ SalGraphics* WinSalFrame::AcquireGraphics()
             HDC hDC = GetDC( mhWnd );
             if ( hDC )
             {
-                mpGraphics = new WinSalGraphics;
+                mpGraphics = new WinSalGraphics(WinSalGraphics::WINDOW, true);
                 mpGraphics->setHDC(hDC);
                 mpGraphics->mhWnd     = mhWnd;
-                mpGraphics->mbPrinter = FALSE;
-                mpGraphics->mbVirDev  = FALSE;
-                mpGraphics->mbWindow  = TRUE;
-                mpGraphics->mbScreen  = TRUE;
                 if ( pSalData->mhDitherPal )
                 {
                     mpGraphics->mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
commit a754cb6eafdb94ebc6978e75133bd846b259d063
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 2 02:13:16 2014 +0100

    fix windows compile error
    
    Change-Id: I9154cd0c0352b8807b5a5eae2444629c9cfe3d48

diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 5943532..0242bf5 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -182,7 +182,7 @@ bool WGLisExtensionSupported(const char *extension)
     }
 }
 
-bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat)
+bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat, bool bUseDoubleBufferedRendering)
 {
     HWND hWnd = NULL;
     GLWindow glWin;
@@ -232,7 +232,7 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat)
         0,0
     };
 
-    if (!mbUseDoubleBufferedRendering)
+    if (!bUseDoubleBufferedRendering)
         iAttributes[1] = GL_FALSE;
 
     bool bArbMultisampleSupported = true;
@@ -600,7 +600,7 @@ bool OpenGLContext::ImplInit()
 
     //  we must check whether can set the MSAA
     int WindowPix = 0;
-    bool bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix);
+    bool bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix, mbUseDoubleBufferedRendering);
     if (bMultiSampleSupport && WindowPix != 0)
     {
         m_aGLWin.bMultiSampleSupported = true;


More information about the Libreoffice-commits mailing list