[Libreoffice-commits] core.git: 5 commits - vcl/inc vcl/Library_vcl.mk vcl/win

Jan Holesovsky kendy at collabora.com
Thu Nov 13 15:17:22 PST 2014


 vcl/Library_vcl.mk                   |    1 
 vcl/inc/cairotextrender.hxx          |    2 
 vcl/inc/opengl/win/gdiimpl.hxx       |    1 
 vcl/inc/textrender.hxx               |    7 
 vcl/inc/win/salgdi.h                 |   24 ++
 vcl/inc/win/salvd.h                  |    3 
 vcl/inc/wintextrender.hxx            |  139 -------------
 vcl/win/source/gdi/salgdi.cxx        |   30 ++
 vcl/win/source/gdi/salgdi3.cxx       |  131 ++-----------
 vcl/win/source/gdi/salvd.cxx         |   15 -
 vcl/win/source/gdi/winlayout.cxx     |  352 +++++++++++------------------------
 vcl/win/source/gdi/winlayout.hxx     |  229 ++++++++++++++++++++++
 vcl/win/source/gdi/wintextrender.cxx |   64 ------
 13 files changed, 432 insertions(+), 566 deletions(-)

New commits:
commit 19ad91f7bc7ca96c55e0ca3450608f616f87c4ed
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Nov 13 23:53:34 2014 +0100

    windows opengl: Proof-of-concept text rendering.
    
    We don't have a method that would paint a texture with transparency yet.  We
    also need to limit the size of the DIBSection exactly to what we are going to
    paint, no point in creating a huge bitmap that is mostly empty (but the part
    where is the text being drawn).
    
    Change-Id: Ice0bf325743d08e19e636be73cef6aff3cde5704

diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx
index aa29dd9..085be79 100644
--- a/vcl/inc/opengl/win/gdiimpl.hxx
+++ b/vcl/inc/opengl/win/gdiimpl.hxx
@@ -17,6 +17,7 @@
 
 class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl
 {
+    friend class WinLayout;
 private:
     WinSalGraphics& mrParent;
 
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 69ea4cf..5e4d32f 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -146,6 +146,7 @@ class WinSalGraphics : public SalGraphics
 {
     friend class WinSalGraphicsImpl;
     friend class ScopedFont;
+    friend class WinLayout;
 private:
     boost::scoped_ptr<SalGraphicsImpl> mpImpl;
 
diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h
index 546a1f0..2c59f47 100644
--- a/vcl/inc/win/salvd.h
+++ b/vcl/inc/win/salvd.h
@@ -51,8 +51,11 @@ public:
     virtual void                    ReleaseGraphics( SalGraphics* pGraphics );
     virtual bool                    SetSize( long nNewDX, long nNewDY );
     virtual void                    GetSize( long& rWidth, long& rHeight );
+
+    static HBITMAP ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppDummy);
 };
 
+
 #endif // INCLUDED_VCL_INC_WIN_SALVD_H
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index 2269deb..2b00c03 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -27,14 +27,14 @@
 #include <win/salgdi.h>
 #include <win/salvd.h>
 
-static HBITMAP ImplCreateVirDevBitmap( HDC hDC, long nDX, long nDY,
-                                       sal_uInt16 nBitCount )
+HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppData)
 {
     HBITMAP hBitmap;
 
      if ( nBitCount == 1 )
      {
          hBitmap = CreateBitmap( (int)nDX, (int)nDY, 1, 1, NULL );
+         ppData = NULL;
      }
      else
      {
@@ -55,9 +55,8 @@ static HBITMAP ImplCreateVirDevBitmap( HDC hDC, long nDX, long nDY,
          aBitmapInfo.bmiHeader.biClrUsed = 0;
          aBitmapInfo.bmiHeader.biClrImportant = 0;
 
-         void* pDummy;
          hBitmap = CreateDIBSection( hDC, &aBitmapInfo,
-                                     DIB_RGB_COLORS, &pDummy, NULL,
+                                     DIB_RGB_COLORS, ppData, NULL,
                                      0 );
      }
 
@@ -87,8 +86,8 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
         if( !hDC )
             ImplWriteLastError( GetLastError(), "CreateCompatibleDC in CreateVirtualDevice" );
 
-        hBmp    = ImplCreateVirDevBitmap( pGraphics->getHDC(),
-                                        nDX, nDY, nBitCount );
+        void *pDummy;
+        hBmp = WinSalVirtualDevice::ImplCreateVirDevBitmap(pGraphics->getHDC(), nDX, nDY, nBitCount, &pDummy);
         if( !hBmp )
             ImplWriteLastError( GetLastError(), "ImplCreateVirDevBitmap in CreateVirtualDevice" );
         // #124826# continue even if hBmp could not be created
@@ -198,8 +197,8 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY )
         return TRUE;    // ???
     else
     {
-        HBITMAP hNewBmp = ImplCreateVirDevBitmap( getHDC(), nDX, nDY,
-                                              mnBitCount );
+        void *pDummy;
+        HBITMAP hNewBmp = ImplCreateVirDevBitmap(getHDC(), nDX, nDY, mnBitCount, &pDummy);
         if ( hNewBmp )
         {
             SelectBitmap( getHDC(), hNewBmp );
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 4351883c..a5945da 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -22,10 +22,12 @@
 #include "osl/module.h"
 #include "osl/file.h"
 
+#include <opengl/texture.hxx>
+#include <opengl/win/gdiimpl.hxx>
 #include <vcl/opengl/OpenGLHelper.hxx>
-
-#include "win/salgdi.h"
-#include "win/saldata.hxx"
+#include <win/salgdi.h>
+#include <win/saldata.hxx>
+#include <win/salvd.h>
 
 #include "sft.hxx"
 #include "sallayout.hxx"
@@ -151,14 +153,62 @@ SCRIPT_CACHE& WinLayout::GetScriptCache() const
 
 void WinLayout::DrawText(SalGraphics& rGraphics) const
 {
-    if (mbUseOpenGL)
+    WinSalGraphics& rWinGraphics = static_cast<WinSalGraphics&>(rGraphics);
+    HDC hDC = rWinGraphics.getHDC();
+
+    if (!mbUseOpenGL)
     {
-        // TODO draw to a texture instead
-        DrawTextImpl(static_cast<WinSalGraphics&>(rGraphics).getHDC());
+        // no OpenGL, just classic rendering
+        DrawTextImpl(hDC);
     }
     else
     {
-        DrawTextImpl(static_cast<WinSalGraphics&>(rGraphics).getHDC());
+        // we have to render the text to a hidden texture, and draw it
+
+        // FIXME so that we don't have to use enormous bitmap, move the text
+        // to 0,0, size the width / height accordingly, and move it back via
+        // SalTwoRects later
+        const int width = 1024;
+        const int height = 1024;
+        const int bpp = 32;
+
+        HDC compatibleDC = CreateCompatibleDC(hDC);
+
+        sal_uInt8 *data;
+        HBITMAP hBitmap = WinSalVirtualDevice::ImplCreateVirDevBitmap(compatibleDC, width, height, bpp, reinterpret_cast<void **>(&data));
+        // FIXME fill transparent instead of 128
+        memset(data, 128, width*height*4);
+
+        // draw the text to the hidden DC
+        HGDIOBJ hBitmapOld = SelectObject(compatibleDC, hBitmap);
+        SelectFont(compatibleDC, mhFont);
+        DrawTextImpl(compatibleDC);
+        SelectObject(compatibleDC, hBitmapOld);
+
+        // and turn it into a texture
+        OpenGLTexture aTexture(width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
+        CHECK_GL_ERROR();
+
+        WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(rWinGraphics.mpImpl.get());
+        if (pImpl)
+        {
+            SalTwoRect aRects;
+            aRects.mnSrcX = 0;
+            aRects.mnSrcY = 0;
+            aRects.mnSrcWidth = width;
+            aRects.mnSrcHeight = height;
+            aRects.mnDestX = 0;
+            aRects.mnDestY = 0;
+            aRects.mnDestWidth = width;
+            aRects.mnDestHeight = height;
+
+            // FIXME We don't have a method that could paint a texture with
+            // transparency yet, use it when we have it
+            pImpl->DrawTexture(aTexture.Id(), Size(width, height), aRects);
+        }
+
+        DeleteObject(hBitmap);
+        DeleteDC(compatibleDC);
     }
 }
 
commit 966fc1f2ab7c8c59ceac8b77c6feaa33f6e8ee02
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Nov 13 20:14:22 2014 +0100

    windows opengl: Prepare WinLayout (and derived classes) for OpenGL.
    
    Change-Id: Ifd18f51ac417cb3778e61f33df30daa7be6c0bf8

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d99f15b..4351883c 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -22,7 +22,7 @@
 #include "osl/module.h"
 #include "osl/file.h"
 
-#include "vcl/svapp.hxx"
+#include <vcl/opengl/OpenGLHelper.hxx>
 
 #include "win/salgdi.h"
 #include "win/saldata.hxx"
@@ -107,13 +107,14 @@ inline int ImplWinFontEntry::GetCachedGlyphWidth( int nCharCode ) const
     return it->second;
 }
 
-WinLayout::WinLayout( HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE )
+WinLayout::WinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE, bool bUseOpenGL)
 :   mhDC( hDC ),
     mhFont( (HFONT)::GetCurrentObject(hDC,OBJ_FONT) ),
     mnBaseAdv( 0 ),
     mfFontScale( 1.0 ),
     mrWinFontData( rWFD ),
-    mrWinFontEntry( rWFE )
+    mrWinFontEntry(rWFE),
+    mbUseOpenGL(bUseOpenGL)
 {}
 
 void WinLayout::InitFont() const
@@ -148,9 +149,22 @@ SCRIPT_CACHE& WinLayout::GetScriptCache() const
     return mrWinFontEntry.GetScriptCache();
 }
 
-SimpleWinLayout::SimpleWinLayout( HDC hDC, BYTE nCharSet,
-    const ImplWinFontData& rWinFontData, ImplWinFontEntry& rWinFontEntry )
-:   WinLayout( hDC, rWinFontData, rWinFontEntry ),
+void WinLayout::DrawText(SalGraphics& rGraphics) const
+{
+    if (mbUseOpenGL)
+    {
+        // TODO draw to a texture instead
+        DrawTextImpl(static_cast<WinSalGraphics&>(rGraphics).getHDC());
+    }
+    else
+    {
+        DrawTextImpl(static_cast<WinSalGraphics&>(rGraphics).getHDC());
+    }
+}
+
+SimpleWinLayout::SimpleWinLayout(HDC hDC, BYTE nCharSet, const ImplWinFontData& rWinFontData,
+        ImplWinFontEntry& rWinFontEntry, bool bUseOpenGL)
+:   WinLayout(hDC, rWinFontData, rWinFontEntry, bUseOpenGL),
     mnGlyphCount( 0 ),
     mnCharCount( 0 ),
     mpOutGlyphs( NULL ),
@@ -517,14 +531,11 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPo
     return nCount;
 }
 
-void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const
+void SimpleWinLayout::DrawTextImpl(HDC hDC) const
 {
     if( mnGlyphCount <= 0 )
         return;
 
-    WinSalGraphics& rWinGraphics = static_cast<WinSalGraphics&>(rGraphics);
-    HDC aHDC = rWinGraphics.getHDC();
-
     HFONT hOrigFont = DisableFontScaling();
 
     UINT mnDrawOptions = ETO_GLYPH_INDEX;
@@ -543,24 +554,23 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const
         // #108267#,#109387# break up string into smaller chunks
         // the output positions will be updated by windows (SetTextAlign)
         POINT oldPos;
-        UINT oldTa = ::GetTextAlign( aHDC );
-        ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP );
-        ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos );
+        UINT oldTa = ::GetTextAlign(hDC);
+        ::SetTextAlign(hDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP);
+        ::MoveToEx(hDC, aPos.X(), aPos.Y(), &oldPos);
         unsigned int i = 0;
         for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount )
-            ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL,
-                mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i );
-        ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL,
-            mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i );
-        ::MoveToEx( aHDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
-        ::SetTextAlign( aHDC, oldTa );
+        {
+            ::ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
+        }
+        ::ExtTextOutW(hDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
+        ::MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
+        ::SetTextAlign(hDC, oldTa);
     }
     else
-        ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL,
-            mpOutGlyphs, mnGlyphCount, mpGlyphAdvances );
+        ::ExtTextOutW(hDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
 
     if( hOrigFont )
-        DeleteFont( SelectFont( aHDC, hOrigFont ) );
+        DeleteFont(SelectFont(hDC, hOrigFont));
 }
 
 DeviceCoordinate SimpleWinLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
@@ -933,9 +943,9 @@ static bool InitUSP()
     return true;
 }
 
-UniscribeLayout::UniscribeLayout( HDC hDC,
-    const ImplWinFontData& rWinFontData, ImplWinFontEntry& rWinFontEntry )
-:   WinLayout( hDC, rWinFontData, rWinFontEntry ),
+UniscribeLayout::UniscribeLayout(HDC hDC, const ImplWinFontData& rWinFontData,
+        ImplWinFontEntry& rWinFontEntry, bool bUseOpenGL)
+:   WinLayout(hDC, rWinFontData, rWinFontEntry, bUseOpenGL),
     mpScriptItems( NULL ),
     mpVisualItems( NULL ),
     mnItemCount( 0 ),
@@ -1907,7 +1917,7 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
     }
 }
 
-void UniscribeLayout::DrawText( SalGraphics& ) const
+void UniscribeLayout::DrawTextImpl(HDC hDC) const
 {
     HFONT hOrigFont = DisableFontScaling();
 
@@ -1943,18 +1953,18 @@ void UniscribeLayout::DrawText( SalGraphics& ) const
         Point aRelPos( rVisualItem.mnXOffset + nBaseClusterOffset, 0 );
         Point aPos = GetDrawPosition( aRelPos );
         SCRIPT_CACHE& rScriptCache = GetScriptCache();
-        ScriptTextOut( mhDC, &rScriptCache,
+        ScriptTextOut(hDC, &rScriptCache,
             aPos.X(), aPos.Y(), 0, NULL,
             &rVisualItem.mpScriptItem->a, NULL, 0,
             mpOutGlyphs + nMinGlyphPos,
             nEndGlyphPos - nMinGlyphPos,
             mpGlyphAdvances + nMinGlyphPos,
             mpJustifications ? mpJustifications + nMinGlyphPos : NULL,
-            mpGlyphOffsets + nMinGlyphPos );
+            mpGlyphOffsets + nMinGlyphPos);
     }
 
     if( hOrigFont )
-        DeleteFont( SelectFont( mhDC, hOrigFont ) );
+        DeleteFont(SelectFont(hDC, hOrigFont));
 }
 
 DeviceCoordinate UniscribeLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
@@ -2494,8 +2504,8 @@ float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId)
     return gm.gmCellIncX;
 }
 
-GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw()
-  : WinLayout(hDC, rWFD, rWFE), mpFont(NULL),
+GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE, bool bUseOpenGL) throw()
+  : WinLayout(hDC, rWFD, rWFE, bUseOpenGL), mpFont(NULL),
     maImpl(rWFD.GraphiteFace(), rWFE)
 {
     // the log font size may differ from the font entry size if scaling is used for large fonts
@@ -2577,10 +2587,9 @@ void  GraphiteWinLayout::AdjustLayout(ImplLayoutArgs& rArgs)
     maImpl.AdjustLayout(rArgs);
 }
 
-void GraphiteWinLayout::DrawText(SalGraphics &sal_graphics) const
+void GraphiteWinLayout::DrawTextImpl(HDC hDC) const
 {
     HFONT hOrigFont = DisableFontScaling();
-    const HDC aHDC = static_cast<WinSalGraphics&>(sal_graphics).getHDC();
     maImpl.DrawBase() = WinLayout::maDrawBase;
     maImpl.DrawOffset() = WinLayout::maDrawOffset;
     const int MAX_GLYPHS = 2;
@@ -2595,11 +2604,10 @@ void GraphiteWinLayout::DrawText(SalGraphics &sal_graphics) const
         if (nGlyphs < 1)
           break;
         std::copy(glyphIntStr, glyphIntStr + nGlyphs, glyphWStr);
-        ::ExtTextOutW(aHDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX,
-                      NULL, (LPCWSTR)&(glyphWStr), nGlyphs, NULL);
+        ::ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, NULL, (LPCWSTR)&(glyphWStr), nGlyphs, NULL);
     } while (nGlyphs);
     if( hOrigFont )
-          DeleteFont( SelectFont( aHDC, hOrigFont ) );
+          DeleteFont(SelectFont(hDC, hOrigFont));
 }
 
 sal_Int32 GraphiteWinLayout::GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const
@@ -2652,18 +2660,20 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
     const ImplWinFontData& rFontFace = *mpWinFontData[ nFallbackLevel ];
     ImplWinFontEntry& rFontInstance = *mpWinFontEntry[ nFallbackLevel ];
 
+    bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled();
+
     if( !(rArgs.mnFlags & SAL_LAYOUT_COMPLEX_DISABLED)
     &&   (bUspInited || InitUSP()) )   // CTL layout engine
     {
 #if ENABLE_GRAPHITE
         if (rFontFace.SupportsGraphite())
         {
-            pWinLayout = new GraphiteWinLayout(getHDC(), rFontFace, rFontInstance);
+            pWinLayout = new GraphiteWinLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
         }
         else
 #endif // ENABLE_GRAPHITE
         // script complexity is determined in upper layers
-        pWinLayout = new UniscribeLayout( getHDC(), rFontFace, rFontInstance );
+        pWinLayout = new UniscribeLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
         // NOTE: it must be guaranteed that the WinSalGraphics lives longer than
         // the created UniscribeLayout, otherwise the data passed into the
         // constructor might become invalid too early
@@ -2683,10 +2693,10 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
             eCharSet = mpLogFont->lfCharSet;
 #if ENABLE_GRAPHITE
         if (rFontFace.SupportsGraphite())
-            pWinLayout = new GraphiteWinLayout( getHDC(), rFontFace, rFontInstance);
+            pWinLayout = new GraphiteWinLayout(getHDC(), rFontFace, rFontInstance, bUseOpenGL);
         else
 #endif // ENABLE_GRAPHITE
-            pWinLayout = new SimpleWinLayout( getHDC(), eCharSet, rFontFace, rFontInstance );
+            pWinLayout = new SimpleWinLayout(getHDC(), eCharSet, rFontFace, rFontInstance, bUseOpenGL);
     }
 
     if( mfFontScale[nFallbackLevel] != 1.0 )
diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
index b96e9ea..7847665 100644
--- a/vcl/win/source/gdi/winlayout.hxx
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -40,18 +40,26 @@ struct VisualItem;
 class WinLayout : public SalLayout
 {
 public:
-                        WinLayout( HDC, const ImplWinFontData&, ImplWinFontEntry& );
+                        WinLayout(HDC, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
     virtual void        InitFont() const;
     void                SetFontScale( float f ) { mfFontScale = f; }
     HFONT               DisableFontScaling( void) const;
 
     SCRIPT_CACHE&       GetScriptCache() const;
 
+    /// In the non-OpenGL case, call the DrawTextImpl directly, otherwise make
+    /// sure we draw to an interim texture.
+    virtual void        DrawText(SalGraphics&) const SAL_OVERRIDE;
+
+    /// Draw to the provided HDC.
+    virtual void        DrawTextImpl(HDC hDC) const = 0;
+
 protected:
     HDC                 mhDC;               // WIN32 device handle
     HFONT               mhFont;             // WIN32 font handle
     int                 mnBaseAdv;          // x-offset relative to Layout origin
     float               mfFontScale;        // allows metrics emulation of huge font sizes
+    bool                mbUseOpenGL;        ///< We need to render via OpenGL
 
     const ImplWinFontData& mrWinFontData;
     ImplWinFontEntry&   mrWinFontEntry;
@@ -60,12 +68,12 @@ protected:
 class SimpleWinLayout : public WinLayout
 {
 public:
-                    SimpleWinLayout( HDC, BYTE nCharSet, const ImplWinFontData&, ImplWinFontEntry& );
+                    SimpleWinLayout(HDC, BYTE nCharSet, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
     virtual         ~SimpleWinLayout();
 
     virtual bool    LayoutText( ImplLayoutArgs& );
     virtual void    AdjustLayout( ImplLayoutArgs& );
-    virtual void    DrawText( SalGraphics& ) const;
+    virtual void    DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
 
     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
                                    DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
@@ -104,11 +112,11 @@ private:
 class UniscribeLayout : public WinLayout
 {
 public:
-                    UniscribeLayout( HDC, const ImplWinFontData&, ImplWinFontEntry& );
+                    UniscribeLayout(HDC, const ImplWinFontData&, ImplWinFontEntry&, bool bUseOpenGL);
 
     virtual bool    LayoutText( ImplLayoutArgs& );
     virtual void    AdjustLayout( ImplLayoutArgs& );
-    virtual void    DrawText( SalGraphics& ) const;
+    virtual void    DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
                                    DeviceCoordinate* pGlyphAdvances, int* pCharPosAry,
                                    const PhysicalFontFace** pFallbackFonts = NULL ) const;
@@ -189,13 +197,13 @@ private:
     grutils::GrFeatureParser * mpFeatures;
     mutable GraphiteLayoutWinImpl maImpl;
 public:
-    GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw();
+    GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE, bool bUseOpenGL) throw();
     virtual ~GraphiteWinLayout();
 
     // used by upper layers
     virtual bool  LayoutText( ImplLayoutArgs& );    // first step of layout
     virtual void  AdjustLayout( ImplLayoutArgs& );  // adjusting after fallback etc.
-    virtual void  DrawText( SalGraphics& ) const;
+    virtual void  DrawTextImpl(HDC hDC) const SAL_OVERRIDE;
 
     // methods using string indexing
     virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra=0, int nFactor=1) const SAL_OVERRIDE;
commit 921f07d0be79d2614bb191b9d7042c30f74ec8f0
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Nov 13 18:58:54 2014 +0100

    vcl: Split winlayout.cxx to .cxx and .hxx.
    
    Change-Id: I4a26842777536ce63b482a2d69524918a18b602c

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 2202897..d99f15b 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <svsys.h>
-#include "rtl/ustring.hxx"
+#include "winlayout.hxx"
 
 #include "osl/module.h"
 #include "osl/file.h"
@@ -39,7 +38,6 @@
 
 #include <algorithm>
 
-#include <usp10.h>
 #include <shlwapi.h>
 #include <winver.h>
 
@@ -51,7 +49,6 @@ typedef boost::unordered_map<int,int> IntMap;
 #include <config_graphite.h>
 #if ENABLE_GRAPHITE
 #include <i18nlangtag/languagetag.hxx>
-#include <graphite_layout.hxx>
 #include <graphite_features.hxx>
 #endif
 
@@ -110,71 +107,6 @@ inline int ImplWinFontEntry::GetCachedGlyphWidth( int nCharCode ) const
     return it->second;
 }
 
-class WinLayout : public SalLayout
-{
-public:
-                        WinLayout( HDC, const ImplWinFontData&, ImplWinFontEntry& );
-    virtual void        InitFont() const;
-    void                SetFontScale( float f ) { mfFontScale = f; }
-    HFONT               DisableFontScaling( void) const;
-
-    SCRIPT_CACHE&       GetScriptCache() const
-                            { return mrWinFontEntry.GetScriptCache(); }
-
-protected:
-    HDC                 mhDC;               // WIN32 device handle
-    HFONT               mhFont;             // WIN32 font handle
-    int                 mnBaseAdv;          // x-offset relative to Layout origin
-    float               mfFontScale;        // allows metrics emulation of huge font sizes
-
-    const ImplWinFontData& mrWinFontData;
-    ImplWinFontEntry&   mrWinFontEntry;
-};
-
-class SimpleWinLayout : public WinLayout
-{
-public:
-                    SimpleWinLayout( HDC, BYTE nCharSet, const ImplWinFontData&, ImplWinFontEntry& );
-    virtual         ~SimpleWinLayout();
-
-    virtual bool    LayoutText( ImplLayoutArgs& );
-    virtual void    AdjustLayout( ImplLayoutArgs& );
-    virtual void    DrawText( SalGraphics& ) const;
-
-    virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
-                                   DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
-                                   const PhysicalFontFace** pFallbackFonts = NULL ) const;
-
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
-    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
-
-    // for glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
-
-protected:
-    void            Justify( DeviceCoordinate nNewWidth );
-    void            ApplyDXArray( const ImplLayoutArgs& );
-
-private:
-    int             mnGlyphCount;
-    int             mnCharCount;
-    WCHAR*          mpOutGlyphs;
-    int*            mpGlyphAdvances;    // if possible this is shared with mpGlyphAdvances[]
-    int*            mpGlyphOrigAdvs;
-    int*            mpCharWidths;       // map rel char pos to char width
-    int*            mpChars2Glyphs;     // map rel char pos to abs glyph pos
-    int*            mpGlyphs2Chars;     // map abs glyph pos to abs char pos
-    bool*           mpGlyphRTLFlags;    // BiDi status for glyphs: true=>RTL
-    mutable long    mnWidth;
-    bool            mbDisableGlyphs;
-
-    int             mnNotdefWidth;
-    BYTE            mnCharSet;
-};
-
 WinLayout::WinLayout( HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE )
 :   mhDC( hDC ),
     mhFont( (HFONT)::GetCurrentObject(hDC,OBJ_FONT) ),
@@ -211,6 +143,11 @@ HFONT WinLayout::DisableFontScaling() const
     return SelectFont( mhDC, hHugeFont );
 }
 
+SCRIPT_CACHE& WinLayout::GetScriptCache() const
+{
+    return mrWinFontEntry.GetScriptCache();
+}
+
 SimpleWinLayout::SimpleWinLayout( HDC hDC, BYTE nCharSet,
     const ImplWinFontData& rWinFontData, ImplWinFontEntry& rWinFontEntry )
 :   WinLayout( hDC, rWinFontData, rWinFontEntry ),
@@ -954,72 +891,6 @@ public:
     bool            HasKashidas() const { return mbHasKashidas; }
 };
 
-class UniscribeLayout : public WinLayout
-{
-public:
-                    UniscribeLayout( HDC, const ImplWinFontData&, ImplWinFontEntry& );
-
-    virtual bool    LayoutText( ImplLayoutArgs& );
-    virtual void    AdjustLayout( ImplLayoutArgs& );
-    virtual void    DrawText( SalGraphics& ) const;
-    virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
-                                   DeviceCoordinate* pGlyphAdvances, int* pCharPosAry,
-                                   const PhysicalFontFace** pFallbackFonts = NULL ) const;
-
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
-    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
-    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
-    virtual bool    IsKashidaPosValid ( int nCharPos ) const;
-
-    // for glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
-    virtual void    DisableGlyphInjection( bool bDisable ) { mbDisableGlyphInjection = bDisable; }
-
-protected:
-    virtual         ~UniscribeLayout();
-
-    void            Justify( DeviceCoordinate nNewWidth );
-    void            ApplyDXArray( const ImplLayoutArgs& );
-
-    bool            GetItemSubrange( const VisualItem&,
-                        int& rMinIndex, int& rEndIndex ) const;
-
-private:
-    // item specific info
-    SCRIPT_ITEM*    mpScriptItems;      // in logical order
-    VisualItem*     mpVisualItems;      // in visual order
-    int             mnItemCount;        // number of visual items
-
-    // string specific info
-    // everything is in logical order
-    int             mnCharCapacity;
-    WORD*           mpLogClusters;      // map from absolute_char_pos to relative_glyph_pos
-    int*            mpCharWidths;       // map from absolute_char_pos to char_width
-    int             mnSubStringMin;     // char_pos of first char in context
-
-    // glyph specific info
-    // everything is in visual order
-    int             mnGlyphCount;
-    int             mnGlyphCapacity;
-    int*            mpGlyphAdvances;    // glyph advance width before justification
-    int*            mpJustifications;   // glyph advance width after justification
-    WORD*           mpOutGlyphs;        // glyphids in visual order
-    GOFFSET*        mpGlyphOffsets;     // glyph offsets to the "naive" layout
-    SCRIPT_VISATTR* mpVisualAttrs;      // glyph visual attributes
-    mutable int*    mpGlyphs2Chars;     // map from absolute_glyph_pos to absolute_char_pos
-
-    // kashida stuff
-    void InitKashidaHandling();
-    void KashidaItemFix( int nMinGlyphPos, int nEndGlyphPos );
-    bool KashidaWordFix( int nMinGlyphPos, int nEndGlyphPos, int* pnCurrentPos );
-
-    int            mnMinKashidaWidth;
-    int            mnMinKashidaGlyph;
-    bool           mbDisableGlyphInjection;
-};
-
 static bool bUspInited = false;
 
 static bool bManualCellAlign = true;
@@ -2604,63 +2475,12 @@ bool UniscribeLayout::IsKashidaPosValid ( int nCharPos ) const
 
 #if ENABLE_GRAPHITE
 
-class GraphiteLayoutWinImpl : public GraphiteLayout
-{
-public:
-    GraphiteLayoutWinImpl(const gr_face * pFace, ImplWinFontEntry & rFont)
-        throw()
-    : GraphiteLayout(pFace), mrFont(rFont) {};
-    virtual ~GraphiteLayoutWinImpl() throw() {};
-    virtual sal_GlyphId getKashidaGlyph(int & rWidth);
-private:
-    ImplWinFontEntry & mrFont;
-};
-
 sal_GlyphId GraphiteLayoutWinImpl::getKashidaGlyph(int & rWidth)
 {
     rWidth = mrFont.GetMinKashidaWidth();
     return mrFont.GetMinKashidaGlyph();
 }
 
-// This class uses the SIL Graphite engine to provide complex text layout services to the VCL
-// @author tse
-
-class GraphiteWinLayout : public WinLayout
-{
-private:
-    gr_font * mpFont;
-    grutils::GrFeatureParser * mpFeatures;
-    mutable GraphiteLayoutWinImpl maImpl;
-public:
-    GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw();
-
-    // used by upper layers
-    virtual bool  LayoutText( ImplLayoutArgs& );    // first step of layout
-    virtual void  AdjustLayout( ImplLayoutArgs& );  // adjusting after fallback etc.
-    virtual void  DrawText( SalGraphics& ) const;
-
-    // methods using string indexing
-    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra=0, int nFactor=1) const SAL_OVERRIDE;
-    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
-
-    virtual void  GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
-
-    // methods using glyph indexing
-    virtual int   GetNextGlyphs(int nLen, sal_GlyphId* pGlyphIdxAry, ::Point & rPos, int&,
-                                DeviceCoordinate* pGlyphAdvAry = NULL, int* pCharPosAry = NULL,
-                                const PhysicalFontFace** pFallbackFonts = NULL ) const;
-
-    // used by glyph+font+script fallback
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
-    ~GraphiteWinLayout()
-    {
-        delete mpFeatures;
-        gr_font_destroy(maImpl.GetFont());
-    }
-};
-
 float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId)
 {
     HDC hDC = reinterpret_cast<HDC>(const_cast<void*>(appFontHandle));
@@ -2701,6 +2521,12 @@ GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplW
     maImpl.SetFeatures(mpFeatures);
 }
 
+GraphiteWinLayout::~GraphiteWinLayout()
+{
+    delete mpFeatures;
+    gr_font_destroy(maImpl.GetFont());
+}
+
 bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args)
 {
     if (args.mnMinCharPos >= args.mnEndCharPos)
diff --git a/vcl/win/source/gdi/winlayout.hxx b/vcl/win/source/gdi/winlayout.hxx
new file mode 100644
index 0000000..b96e9ea
--- /dev/null
+++ b/vcl/win/source/gdi/winlayout.hxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_WIN_SOURCE_GDI_WINLAYOUT_HXX
+#define INCLUDED_VCL_WIN_SOURCE_GDI_WINLAYOUT_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <sallayout.hxx>
+#include <svsys.h>
+#include <win/salgdi.h>
+
+#include <usp10.h>
+
+// Graphite headers
+#include <config_graphite.h>
+#if ENABLE_GRAPHITE
+#include <graphite_layout.hxx>
+#endif
+
+class ImplWinFontEntry;
+struct VisualItem;
+
+class WinLayout : public SalLayout
+{
+public:
+                        WinLayout( HDC, const ImplWinFontData&, ImplWinFontEntry& );
+    virtual void        InitFont() const;
+    void                SetFontScale( float f ) { mfFontScale = f; }
+    HFONT               DisableFontScaling( void) const;
+
+    SCRIPT_CACHE&       GetScriptCache() const;
+
+protected:
+    HDC                 mhDC;               // WIN32 device handle
+    HFONT               mhFont;             // WIN32 font handle
+    int                 mnBaseAdv;          // x-offset relative to Layout origin
+    float               mfFontScale;        // allows metrics emulation of huge font sizes
+
+    const ImplWinFontData& mrWinFontData;
+    ImplWinFontEntry&   mrWinFontEntry;
+};
+
+class SimpleWinLayout : public WinLayout
+{
+public:
+                    SimpleWinLayout( HDC, BYTE nCharSet, const ImplWinFontData&, ImplWinFontEntry& );
+    virtual         ~SimpleWinLayout();
+
+    virtual bool    LayoutText( ImplLayoutArgs& );
+    virtual void    AdjustLayout( ImplLayoutArgs& );
+    virtual void    DrawText( SalGraphics& ) const;
+
+    virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
+                                   DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
+                                   const PhysicalFontFace** pFallbackFonts = NULL ) const;
+
+    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
+    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
+
+    // for glyph+font+script fallback
+    virtual void    MoveGlyph( int nStart, long nNewXPos );
+    virtual void    DropGlyph( int nStart );
+    virtual void    Simplify( bool bIsBase );
+
+protected:
+    void            Justify( DeviceCoordinate nNewWidth );
+    void            ApplyDXArray( const ImplLayoutArgs& );
+
+private:
+    int             mnGlyphCount;
+    int             mnCharCount;
+    WCHAR*          mpOutGlyphs;
+    int*            mpGlyphAdvances;    // if possible this is shared with mpGlyphAdvances[]
+    int*            mpGlyphOrigAdvs;
+    int*            mpCharWidths;       // map rel char pos to char width
+    int*            mpChars2Glyphs;     // map rel char pos to abs glyph pos
+    int*            mpGlyphs2Chars;     // map abs glyph pos to abs char pos
+    bool*           mpGlyphRTLFlags;    // BiDi status for glyphs: true=>RTL
+    mutable long    mnWidth;
+    bool            mbDisableGlyphs;
+
+    int             mnNotdefWidth;
+    BYTE            mnCharSet;
+};
+
+class UniscribeLayout : public WinLayout
+{
+public:
+                    UniscribeLayout( HDC, const ImplWinFontData&, ImplWinFontEntry& );
+
+    virtual bool    LayoutText( ImplLayoutArgs& );
+    virtual void    AdjustLayout( ImplLayoutArgs& );
+    virtual void    DrawText( SalGraphics& ) const;
+    virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
+                                   DeviceCoordinate* pGlyphAdvances, int* pCharPosAry,
+                                   const PhysicalFontFace** pFallbackFonts = NULL ) const;
+
+    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE;
+    virtual void    GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
+    virtual bool    IsKashidaPosValid ( int nCharPos ) const;
+
+    // for glyph+font+script fallback
+    virtual void    MoveGlyph( int nStart, long nNewXPos );
+    virtual void    DropGlyph( int nStart );
+    virtual void    Simplify( bool bIsBase );
+    virtual void    DisableGlyphInjection( bool bDisable ) { mbDisableGlyphInjection = bDisable; }
+
+protected:
+    virtual         ~UniscribeLayout();
+
+    void            Justify( DeviceCoordinate nNewWidth );
+    void            ApplyDXArray( const ImplLayoutArgs& );
+
+    bool            GetItemSubrange( const VisualItem&,
+                        int& rMinIndex, int& rEndIndex ) const;
+
+private:
+    // item specific info
+    SCRIPT_ITEM*    mpScriptItems;      // in logical order
+    VisualItem*     mpVisualItems;      // in visual order
+    int             mnItemCount;        // number of visual items
+
+    // string specific info
+    // everything is in logical order
+    int             mnCharCapacity;
+    WORD*           mpLogClusters;      // map from absolute_char_pos to relative_glyph_pos
+    int*            mpCharWidths;       // map from absolute_char_pos to char_width
+    int             mnSubStringMin;     // char_pos of first char in context
+
+    // glyph specific info
+    // everything is in visual order
+    int             mnGlyphCount;
+    int             mnGlyphCapacity;
+    int*            mpGlyphAdvances;    // glyph advance width before justification
+    int*            mpJustifications;   // glyph advance width after justification
+    WORD*           mpOutGlyphs;        // glyphids in visual order
+    GOFFSET*        mpGlyphOffsets;     // glyph offsets to the "naive" layout
+    SCRIPT_VISATTR* mpVisualAttrs;      // glyph visual attributes
+    mutable int*    mpGlyphs2Chars;     // map from absolute_glyph_pos to absolute_char_pos
+
+    // kashida stuff
+    void InitKashidaHandling();
+    void KashidaItemFix( int nMinGlyphPos, int nEndGlyphPos );
+    bool KashidaWordFix( int nMinGlyphPos, int nEndGlyphPos, int* pnCurrentPos );
+
+    int            mnMinKashidaWidth;
+    int            mnMinKashidaGlyph;
+    bool           mbDisableGlyphInjection;
+};
+
+#if ENABLE_GRAPHITE
+
+class GraphiteLayoutWinImpl : public GraphiteLayout
+{
+public:
+    GraphiteLayoutWinImpl(const gr_face * pFace, ImplWinFontEntry & rFont)
+        throw()
+    : GraphiteLayout(pFace), mrFont(rFont) {};
+    virtual ~GraphiteLayoutWinImpl() throw() {};
+    virtual sal_GlyphId getKashidaGlyph(int & rWidth);
+private:
+    ImplWinFontEntry & mrFont;
+};
+
+/// This class uses the SIL Graphite engine to provide complex text layout services to the VCL
+class GraphiteWinLayout : public WinLayout
+{
+private:
+    gr_font * mpFont;
+    grutils::GrFeatureParser * mpFeatures;
+    mutable GraphiteLayoutWinImpl maImpl;
+public:
+    GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw();
+    virtual ~GraphiteWinLayout();
+
+    // used by upper layers
+    virtual bool  LayoutText( ImplLayoutArgs& );    // first step of layout
+    virtual void  AdjustLayout( ImplLayoutArgs& );  // adjusting after fallback etc.
+    virtual void  DrawText( SalGraphics& ) const;
+
+    // methods using string indexing
+    virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra=0, int nFactor=1) const SAL_OVERRIDE;
+    virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const;
+
+    virtual void  GetCaretPositions( int nArraySize, long* pCaretXArray ) const;
+
+    // methods using glyph indexing
+    virtual int   GetNextGlyphs(int nLen, sal_GlyphId* pGlyphIdxAry, ::Point & rPos, int&,
+                                DeviceCoordinate* pGlyphAdvAry = NULL, int* pCharPosAry = NULL,
+                                const PhysicalFontFace** pFallbackFonts = NULL ) const;
+
+    // used by glyph+font+script fallback
+    virtual void    MoveGlyph( int nStart, long nNewXPos );
+    virtual void    DropGlyph( int nStart );
+    virtual void    Simplify( bool bIsBase );
+};
+
+#endif // ENABLE_GRAPHITE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 48fa9f1e191ffec9be2dfd41061173c488276705
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Nov 13 17:59:39 2014 +0100

    Revert "vcl: Abstract the Windows text rendering into a TextRenderImpl descendant."
    
    Turns out it might be easier to actually subclass only the various SalLayout's
    - let's try it first, and re-introduce this code again if not.
    
    This reverts commit 309257ddadfdc3e46506036ed81f6e0695211ebe.

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index f15e5b6..81f774a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -660,7 +660,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/win/source/gdi/salprn \
     vcl/win/source/gdi/salvd \
     vcl/win/source/gdi/winlayout \
-    vcl/win/source/gdi/wintextrender \
     vcl/win/source/gdi/wntgdi \
     vcl/win/source/window/salframe \
     vcl/win/source/window/keynames \
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index ea995bb..e5db2ab 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -79,7 +79,7 @@ protected:
     virtual cairo_surface_t* getCairoSurface() = 0;
     virtual void drawSurface(cairo_t* cr) = 0;
 
-    bool setFont(const FontSelectPattern *pEntry, int nFallbackLevel);
+bool setFont( const FontSelectPattern *pEntry, int nFallbackLevel );
 
     virtual void clipRegion(cairo_t* cr) = 0;
 
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index 2d9031a..f4dcc83 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_TEXTRENDER_HXX
-#define INCLUDED_VCL_INC_TEXTRENDER_HXX
+#ifndef INCLUDED_VCL_INC_UNX_CAIROFONTIMPL_HXX
+#define INCLUDED_VCL_INC_UNX_CAIROFONTIMPL_HXX
 
 #include <sal/types.h>
 #include <vcl/salgtype.hxx>
@@ -29,6 +29,9 @@
 #include "salglyphid.hxx"
 #include "fontsubset.hxx"
 
+class PspSalPrinter;
+class PspSalInfoPrinter;
+class ServerFont;
 class ImplLayoutArgs;
 class ServerFontLayout;
 class PhysicalFontCollection;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 18709e1..69ea4cf 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -25,9 +25,7 @@
 #include "outfont.hxx"
 #include "PhysicalFontFace.hxx"
 #include "impfont.hxx"
-#include <textrender.hxx>
 #include <vcl/fontcapabilities.hxx>
-#include <win/svsys.h>
 
 #include <boost/scoped_ptr.hpp>
 #include <boost/unordered_set.hpp>
@@ -150,7 +148,6 @@ class WinSalGraphics : public SalGraphics
     friend class ScopedFont;
 private:
     boost::scoped_ptr<SalGraphicsImpl> mpImpl;
-    boost::scoped_ptr<TextRenderImpl> mpTextRenderImpl;
 
     HDC                     mhLocalDC;              // HDC
     bool                    mbPrinter : 1;          // is Printer
@@ -159,13 +156,26 @@ private:
     bool                    mbScreen : 1;           // is Screen compatible
     HWND                    mhWnd;              // Window-Handle, when Window-Graphics
 
+    HFONT                   mhFonts[ MAX_FALLBACK ];        // Font + Fallbacks
+    const ImplWinFontData*  mpWinFontData[ MAX_FALLBACK ];  // pointer to the most recent font face
+    ImplWinFontEntry*       mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance
+    float                   mfFontScale[ MAX_FALLBACK ];        // allows metrics emulation of huge font sizes
+    float                   mfCurrentFontScale;
     HRGN                    mhRegion;           // vcl::Region Handle
     HPEN                    mhDefPen;           // DefaultPen
     HBRUSH                  mhDefBrush;         // DefaultBrush
+    HFONT                   mhDefFont;          // DefaultFont
     HPALETTE                mhDefPal;           // DefaultPalette
     COLORREF                mnTextColor;        // TextColor
     RGNDATA*                mpClipRgnData;      // ClipRegion-Data
     RGNDATA*                mpStdClipRgnData;   // Cache Standard-ClipRegion-Data
+    LOGFONTA*               mpLogFont;          // LOG-Font which is currently selected (only W9x)
+    ImplFontAttrCache*      mpFontAttrCache;    // Cache font attributes from files in so/share/fonts
+    BYTE*                   mpFontCharSets;     // All Charsets for the current font
+    BYTE                    mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
+    bool                    mbFontKernInit;     // FALSE: FontKerns must be queried
+    KERNINGPAIR*            mpFontKernPairs;    // Kerning Pairs of the current Font
+    sal_uIntPtr                 mnFontKernPairCount;// Number of Kerning Pairs of the current Font
     int                     mnPenWidth;         // Linienbreite
 
 public:
@@ -275,6 +285,12 @@ protected:
         const SalBitmap* pAlphaBitmap);
     virtual bool        drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
 
+private:
+    // local helpers
+
+    // get kernign pairs of the current font
+    sal_uLong               GetKernPairs();
+
 public:
     // public SalGraphics methods, the interface to the independent vcl part
 
@@ -366,6 +382,7 @@ public:
                                             bool bVertical,
                                             Int32Vector& rWidths,
                                             Ucs2UIntMap& rUnicodeEnc );
+    virtual int             GetMinKashidaWidth();
 
     virtual bool            GetGlyphBoundRect( sal_GlyphId, Rectangle& );
     virtual bool            GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& );
diff --git a/vcl/inc/wintextrender.hxx b/vcl/inc/wintextrender.hxx
deleted file mode 100644
index 90b0561..0000000
--- a/vcl/inc/wintextrender.hxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_VCL_INC_WINTEXTRENDER_HXX
-#define INCLUDED_VCL_INC_WINTEXTRENDER_HXX
-
-#include <tools/rational.hxx>
-#include <vcl/salgtype.hxx>
-#include <vcl/sysdata.hxx>
-#include <vcl/vclenum.hxx>
-#include <vcl/metric.hxx>
-
-#include "salgdi.hxx"
-#include "salglyphid.hxx"
-#include "fontsubset.hxx"
-#include <textrender.hxx>
-#include <win/salgdi.h>
-
-class ImplLayoutArgs;
-class ServerFontLayout;
-class PhysicalFontCollection;
-class PhysicalFontFace;
-
-/// Implementation of the GDI text rendering.
-class WinTextRender : public TextRenderImpl
-{
-    /// Rendering for a printer?
-    bool mbPrinter;
-
-    /// Parent WinSalGraphics.
-    WinSalGraphics& mrGraphics;
-
-    HFONT                   mhFonts[ MAX_FALLBACK ];        ///< Font + Fallbacks
-    const ImplWinFontData*  mpWinFontData[ MAX_FALLBACK ];  ///< pointer to the most recent font face
-    ImplWinFontEntry*       mpWinFontEntry[ MAX_FALLBACK ]; ///< pointer to the most recent font instance
-    float                   mfFontScale[ MAX_FALLBACK ];    ///< allows metrics emulation of huge font sizes
-    float                   mfCurrentFontScale;
-    HFONT                   mhDefFont;                      ///< DefaultFont
-
-    LOGFONTA*               mpLogFont;                      ///< LOG-Font which is currently selected (only W9x)
-    ImplFontAttrCache*      mpFontAttrCache;                ///< Cache font attributes from files in so/share/fonts
-    BYTE*                   mpFontCharSets;                 ///< All Charsets for the current font
-    BYTE                    mnFontCharSetCount;             ///< Number of Charsets of the current font; 0 - if not queried
-    bool                    mbFontKernInit;                 ///< FALSE: FontKerns must be queried
-    KERNINGPAIR*            mpFontKernPairs;                ///< Kerning Pairs of the current Font
-    sal_uIntPtr             mnFontKernPairCount;            ///< Number of Kerning Pairs of the current Font
-
-public:
-    WinTextRender(bool bPrinter, WinSalGraphics& rGraphics);
-    virtual ~WinTextRender();
-
-    virtual void SetTextColor(SalColor nSalColor) SAL_OVERRIDE;
-
-    virtual sal_uInt16 SetFont(FontSelectPattern*, int nFallbackLevel) SAL_OVERRIDE;
-
-    virtual void GetFontMetric(ImplFontMetricData*, int nFallbackLevel) SAL_OVERRIDE;
-
-    virtual const FontCharMapPtr GetFontCharMap() const SAL_OVERRIDE;
-
-    virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const SAL_OVERRIDE;
-
-    virtual void GetDevFontList(PhysicalFontCollection*) SAL_OVERRIDE;
-
-    virtual void ClearDevFontCache() SAL_OVERRIDE;
-
-    virtual bool AddTempDevFont(PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName) SAL_OVERRIDE;
-
-    virtual bool CreateFontSubset(const OUString& rToFile,
-                                  const PhysicalFontFace*,
-                                  sal_GlyphId* pGlyphIDs,
-                                  sal_uInt8* pEncoding,
-                                  sal_Int32* pWidths,
-                                  int nGlyphs,
-                                  FontSubsetInfo& rInfo) SAL_OVERRIDE;
-
-    virtual const Ucs2SIntMap* GetFontEncodingVector(const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded) SAL_OVERRIDE;
-
-    virtual const void* GetEmbedFontData(const PhysicalFontFace*,
-                                         const sal_Ucs* pUnicodes,
-                                         sal_Int32* pWidths,
-                                         FontSubsetInfo& rInfo,
-                                         long* pDataLen) SAL_OVERRIDE;
-
-    virtual void FreeEmbedFontData(const void* pData, long nDataLen) SAL_OVERRIDE;
-
-    virtual void GetGlyphWidths(const PhysicalFontFace*,
-                                bool bVertical,
-                                Int32Vector& rWidths,
-                                Ucs2UIntMap& rUnicodeEnc) SAL_OVERRIDE;
-
-    virtual bool GetGlyphBoundRect(sal_GlyphId nIndex, Rectangle&) SAL_OVERRIDE;
-
-    virtual bool GetGlyphOutline(sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon&) SAL_OVERRIDE;
-
-    virtual SalLayout* GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) SAL_OVERRIDE;
-
-    virtual void DrawServerFontLayout(const ServerFontLayout&) SAL_OVERRIDE;
-
-    virtual SystemFontData GetSysFontData(int nFallbackLevel) const SAL_OVERRIDE;
-
-private:
-    HDC getHDC() const;
-
-    /// Get kerning pairs of the current font.
-    sal_uLong GetKernPairs();
-
-    int GetMinKashidaWidth();
-
-    class ScopedFont
-    {
-        public:
-            explicit ScopedFont(WinTextRender & rData);
-
-            ~ScopedFont();
-
-        private:
-            WinTextRender & m_rData;
-            HFONT m_hOrigFont;
-    };
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index ecbc851..d8d84e8 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -35,7 +35,6 @@
 #include "salgdiimpl.hxx"
 #include "gdiimpl.hxx"
 #include "opengl/win/gdiimpl.hxx"
-#include <wintextrender.hxx>
 
 #include <vcl/opengl/OpenGLHelper.hxx>
 
@@ -501,6 +500,8 @@ void WinSalGraphics::DeInitGraphics()
         SelectPen( getHDC(), mhDefPen );
     if ( mhDefBrush )
         SelectBrush( getHDC(), mhDefBrush );
+    if ( mhDefFont )
+        SelectFont( getHDC(), mhDefFont );
 }
 
 HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
@@ -570,22 +571,33 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
     mbWindow(eType == WinSalGraphics::WINDOW),
     mhWnd(hWnd),
     mbScreen(bScreen),
+    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)
 {
     if (OpenGLHelper::isVCLOpenGLEnabled() && !mbPrinter)
-    {
         mpImpl.reset(new WinOpenGLSalGraphicsImpl(*this));
-        mpTextRenderImpl.reset((new WinTextRender(mbPrinter, *this)));
-    }
     else
-    {
         mpImpl.reset(new WinSalGraphicsImpl(*this));
-        mpTextRenderImpl.reset((new WinTextRender(mbPrinter, *this)));
+
+    for( int i = 0; i < MAX_FALLBACK; ++i )
+    {
+        mhFonts[ i ] = 0;
+        mpWinFontData[ i ]  = NULL;
+        mpWinFontEntry[ i ] = NULL;
+        mfFontScale[ i ] = 1.0;
     }
 }
 
@@ -602,6 +614,12 @@ WinSalGraphics::~WinSalGraphics()
 
     // delete cache data
     delete [] mpStdClipRgnData;
+
+    delete mpLogFont;
+
+    delete mpFontCharSets;
+
+    delete mpFontKernPairs;
 }
 
 bool WinSalGraphics::isPrinter() const
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index bd69703..f3933d9 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -49,7 +49,6 @@
 #include "sft.hxx"
 #include "win/saldata.hxx"
 #include "win/salgdi.h"
-#include <wintextrender.hxx>
 
 using namespace vcl;
 
@@ -1358,11 +1357,6 @@ void ImplWinFontData::GetFontCapabilities( HDC hDC ) const
 
 void WinSalGraphics::SetTextColor( SalColor nSalColor )
 {
-    mpTextRenderImpl->SetTextColor(nSalColor);
-}
-
-void WinTextRender::SetTextColor(SalColor nSalColor)
-{
     COLORREF aCol = PALETTERGB( SALCOLOR_RED( nSalColor ),
                                 SALCOLOR_GREEN( nSalColor ),
                                 SALCOLOR_BLUE( nSalColor ) );
@@ -1531,11 +1525,6 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontS
 
 sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
 {
-    return mpTextRenderImpl->SetFont(pFont, nFallbackLevel);
-}
-
-sal_uInt16 WinTextRender::SetFont(FontSelectPattern* pFont, int nFallbackLevel)
-{
     // return early if there is no new font
     if( !pFont )
     {
@@ -1559,7 +1548,7 @@ sal_uInt16 WinTextRender::SetFont(FontSelectPattern* pFont, int nFallbackLevel)
     mpWinFontData[ nFallbackLevel ] = static_cast<const ImplWinFontData*>( pFont->mpFontData );
 
     HFONT hOldFont = 0;
-    HFONT hNewFont = mrGraphics.ImplDoSetFont( pFont, mfFontScale[ nFallbackLevel ], hOldFont );
+    HFONT hNewFont = ImplDoSetFont( pFont, mfFontScale[ nFallbackLevel ], hOldFont );
     mfCurrentFontScale = mfFontScale[nFallbackLevel];
 
     if( !mhDefFont )
@@ -1610,11 +1599,6 @@ sal_uInt16 WinTextRender::SetFont(FontSelectPattern* pFont, int nFallbackLevel)
 
 void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
 {
-    mpTextRenderImpl->GetFontMetric(pMetric, nFallbackLevel);
-}
-
-void WinTextRender::GetFontMetric(ImplFontMetricData* pMetric, int nFallbackLevel)
-{
     // temporarily change the HDC to the font in the fallback level
     HFONT hOldFont = SelectFont( getHDC(), mhFonts[nFallbackLevel] );
 
@@ -1689,7 +1673,7 @@ void WinTextRender::GetFontMetric(ImplFontMetricData* pMetric, int nFallbackLeve
     pMetric->mnMinKashida = GetMinKashidaWidth();
 }
 
-sal_uLong WinTextRender::GetKernPairs()
+sal_uLong WinSalGraphics::GetKernPairs()
 {
     if ( mbFontKernInit )
     {
@@ -1720,11 +1704,6 @@ sal_uLong WinTextRender::GetKernPairs()
 
 const FontCharMapPtr WinSalGraphics::GetFontCharMap() const
 {
-    return mpTextRenderImpl->GetFontCharMap();
-}
-
-const FontCharMapPtr WinTextRender::GetFontCharMap() const
-{
     if( !mpWinFontData[0] )
     {
         FontCharMapPtr pDefFontCharMap( new FontCharMap() );
@@ -1735,11 +1714,6 @@ const FontCharMapPtr WinTextRender::GetFontCharMap() const
 
 bool WinSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
 {
-    return mpTextRenderImpl->GetFontCapabilities(rFontCapabilities);
-}
-
-bool WinTextRender::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
-{
     if( !mpWinFontData[0] )
         return false;
     return mpWinFontData[0]->GetFontCapabilities(rFontCapabilities);
@@ -2050,11 +2024,6 @@ static bool ImplGetFontAttrFromFile( const OUString& rFontFileURL,
 bool WinSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
     const OUString& rFontFileURL, const OUString& rFontName )
 {
-    return mpTextRenderImpl->AddTempDevFont(pFontCollection, rFontFileURL, rFontName);
-}
-
-bool WinTextRender::AddTempDevFont(PhysicalFontCollection* pFontCollection, const OUString& rFontFileURL, const OUString& rFontName)
-{
     SAL_INFO( "vcl.gdi", "WinSalGraphics::AddTempDevFont(): " << OUStringToOString( rFontFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
 
     ImplDevFontAttributes aDFA;
@@ -2110,11 +2079,6 @@ bool WinTextRender::AddTempDevFont(PhysicalFontCollection* pFontCollection, cons
 
 void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
 {
-    mpTextRenderImpl->GetDevFontList(pFontCollection);
-}
-
-void WinTextRender::GetDevFontList(PhysicalFontCollection* pFontCollection)
-{
     // make sure all fonts are registered at least temporarily
     static bool bOnce = true;
     if( bOnce )
@@ -2210,21 +2174,11 @@ void WinTextRender::GetDevFontList(PhysicalFontCollection* pFontCollection)
 
 void WinSalGraphics::ClearDevFontCache()
 {
-    mpTextRenderImpl->ClearDevFontCache();
-}
-
-void WinTextRender::ClearDevFontCache()
-{
     //anything to do here ?
 }
 
 bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
 {
-    return mpTextRenderImpl->GetGlyphBoundRect(aGlyphId, rRect);
-}
-
-bool WinTextRender::GetGlyphBoundRect(sal_GlyphId aGlyphId, Rectangle& rRect)
-{
     HDC hDC = getHDC();
 
     // use unity matrix
@@ -2256,11 +2210,6 @@ bool WinTextRender::GetGlyphBoundRect(sal_GlyphId aGlyphId, Rectangle& rRect)
 bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
     ::basegfx::B2DPolyPolygon& rB2DPolyPoly )
 {
-    return mpTextRenderImpl->GetGlyphOutline(aGlyphId, rB2DPolyPoly);
-}
-
-bool WinTextRender::GetGlyphOutline(sal_GlyphId aGlyphId, ::basegfx::B2DPolyPolygon& rB2DPolyPoly)
-{
     rB2DPolyPoly.clear();
 
     HDC  hDC = getHDC();
@@ -2440,13 +2389,25 @@ bool WinTextRender::GetGlyphOutline(sal_GlyphId aGlyphId, ::basegfx::B2DPolyPoly
     return true;
 }
 
-WinTextRender::ScopedFont::ScopedFont(WinTextRender & rData): m_rData(rData)
+class ScopedFont
+{
+public:
+    explicit ScopedFont(WinSalGraphics & rData);
+
+    ~ScopedFont();
+
+private:
+    WinSalGraphics & m_rData;
+    HFONT m_hOrigFont;
+};
+
+ScopedFont::ScopedFont(WinSalGraphics & rData): m_rData(rData)
 {
     m_hOrigFont = m_rData.mhFonts[0];
     m_rData.mhFonts[0] = 0; // avoid deletion of current font
 }
 
-WinTextRender::ScopedFont::~ScopedFont()
+ScopedFont::~ScopedFont()
 {
     if( m_hOrigFont )
     {
@@ -2490,13 +2451,6 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
     const PhysicalFontFace* pFont, sal_GlyphId* pGlyphIds, sal_uInt8* pEncoding,
     sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo )
 {
-    return mpTextRenderImpl->CreateFontSubset(rToFile, pFont, pGlyphIds, pEncoding, pGlyphWidths, nGlyphCount, rInfo);
-}
-
-bool WinTextRender::CreateFontSubset(const OUString& rToFile,
-    const PhysicalFontFace* pFont, sal_GlyphId* pGlyphIds, sal_uInt8* pEncoding,
-    sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo)
-{
     // TODO: use more of the central font-subsetting code, move stuff there if needed
 
     // create matching FontSelectPattern
@@ -2508,7 +2462,7 @@ bool WinTextRender::CreateFontSubset(const OUString& rToFile,
     ScopedFont aOldFont(*this);
     float fScale = 1.0;
     HFONT hOldFont = 0;
-    mrGraphics.ImplDoSetFont( &aIFSD, fScale, hOldFont );
+    ImplDoSetFont( &aIFSD, fScale, hOldFont );
 
     ImplWinFontData* pWinFontData = (ImplWinFontData*)aIFSD.mpFontData;
 
@@ -2651,13 +2605,6 @@ const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont,
     const sal_Unicode* pUnicodes, sal_Int32* pCharWidths,
     FontSubsetInfo& rInfo, long* pDataLen )
 {
-    return mpTextRenderImpl->GetEmbedFontData(pFont, pUnicodes, pCharWidths, rInfo, pDataLen);
-}
-
-const void* WinTextRender::GetEmbedFontData(const PhysicalFontFace* pFont,
-    const sal_Unicode* pUnicodes, sal_Int32* pCharWidths,
-    FontSubsetInfo& rInfo, long* pDataLen)
-{
     // create matching FontSelectPattern
     // we need just enough to get to the font file data
     FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false );
@@ -2709,23 +2656,13 @@ const void* WinTextRender::GetEmbedFontData(const PhysicalFontFace* pFont,
     return (void*)pData;
 }
 
-void WinSalGraphics::FreeEmbedFontData(const void* pData, long nLen)
-{
-    mpTextRenderImpl->FreeEmbedFontData(pData, nLen);
-}
-
-void WinTextRender::FreeEmbedFontData(const void* pData, long /*nLen*/)
+void WinSalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ )
 {
     delete[] reinterpret_cast<char*>(const_cast<void*>(pData));
 }
 
 const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
 {
-    return mpTextRenderImpl->GetFontEncodingVector(pFont, pNonEncoded);
-}
-
-const Ucs2SIntMap* WinTextRender::GetFontEncodingVector(const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded)
-{
     // TODO: even for builtin fonts we get here... why?
     if( !pFont->IsEmbeddable() )
         return NULL;
@@ -2754,12 +2691,6 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
                                      Int32Vector& rWidths,
                                      Ucs2UIntMap& rUnicodeEnc )
 {
-    mpTextRenderImpl->GetGlyphWidths(pFont, bVertical, rWidths, rUnicodeEnc);
-}
-
-void WinTextRender::GetGlyphWidths(const PhysicalFontFace* pFont, bool bVertical,
-        Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc)
-{
     // create matching FontSelectPattern
     // we need just enough to get to the font file data
     FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false );
@@ -2769,7 +2700,7 @@ void WinTextRender::GetGlyphWidths(const PhysicalFontFace* pFont, bool bVertical
 
     float fScale = 0.0;
     HFONT hOldFont = 0;
-    mrGraphics.ImplDoSetFont( &aIFSD, fScale, hOldFont );
+    ImplDoSetFont( &aIFSD, fScale, hOldFont );
 
     if( pFont->IsSubsettable() )
     {
@@ -2846,32 +2777,20 @@ void WinTextRender::GetGlyphWidths(const PhysicalFontFace* pFont, bool bVertical
     }
 }
 
-void WinSalGraphics::DrawServerFontLayout(const ServerFontLayout& rLayout)
-{
-    mpTextRenderImpl->DrawServerFontLayout(rLayout);
-}
-
-void WinTextRender::DrawServerFontLayout(const ServerFontLayout&)
+void WinSalGraphics::DrawServerFontLayout( const ServerFontLayout& )
 {}
 
-SystemFontData WinSalGraphics::GetSysFontData(int nFallbackLevel) const
-{
-    return mpTextRenderImpl->GetSysFontData(nFallbackLevel);
-}
-
-SystemFontData WinTextRender::GetSysFontData(int nFallbackLevel) const
+SystemFontData WinSalGraphics::GetSysFontData( int nFallbacklevel ) const
 {
     SystemFontData aSysFontData;
 
-    if (nFallbackLevel >= MAX_FALLBACK)
-        nFallbackLevel = MAX_FALLBACK - 1;
-    if (nFallbackLevel < 0)
-        nFallbackLevel = 0;
+    if (nFallbacklevel >= MAX_FALLBACK) nFallbacklevel = MAX_FALLBACK - 1;
+    if (nFallbacklevel < 0 ) nFallbacklevel = 0;
 
-    aSysFontData.hFont = mhFonts[nFallbackLevel];
+    aSysFontData.hFont = mhFonts[nFallbacklevel];
 
     OSL_TRACE("\r\n:WinSalGraphics::GetSysFontData(): FontID: %p, Fallback level: %d",
-              aSysFontData.hFont, nFallbackLevel);
+              aSysFontData.hFont, nFallbacklevel);
 
     return aSysFontData;
 }
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index dc5a2fc..2202897 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -27,7 +27,6 @@
 
 #include "win/salgdi.h"
 #include "win/saldata.hxx"
-#include <wintextrender.hxx>
 
 #include "sft.hxx"
 #include "sallayout.hxx"
@@ -2820,11 +2819,6 @@ void GraphiteWinLayout::Simplify( bool is_base )
 
 SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel )
 {
-    return mpTextRenderImpl->GetTextLayout(rArgs, nFallbackLevel);
-}
-
-SalLayout* WinTextRender::GetTextLayout(ImplLayoutArgs& rArgs, int nFallbackLevel)
-{
     DBG_ASSERT( mpWinFontEntry[nFallbackLevel], "WinSalGraphics mpWinFontEntry==NULL");
 
     WinLayout* pWinLayout = NULL;
@@ -2875,7 +2869,7 @@ SalLayout* WinTextRender::GetTextLayout(ImplLayoutArgs& rArgs, int nFallbackLeve
     return pWinLayout;
 }
 
-int WinTextRender::GetMinKashidaWidth()
+int    WinSalGraphics::GetMinKashidaWidth()
 {
     if( !mpWinFontEntry[0] )
         return 0;
diff --git a/vcl/win/source/gdi/wintextrender.cxx b/vcl/win/source/gdi/wintextrender.cxx
deleted file mode 100644
index df2382f..0000000
--- a/vcl/win/source/gdi/wintextrender.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <wintextrender.hxx>
-
-#include <win/salgdi.h>
-#include <win/wincomp.hxx>
-
-WinTextRender::WinTextRender(bool bPrinter, WinSalGraphics& rGraphics)
-    : mbPrinter(bPrinter)
-    , mrGraphics(rGraphics)
-    , mfCurrentFontScale(1.0)
-    , mhDefFont(0)
-    , mpLogFont(NULL)
-    , mpFontAttrCache(NULL)
-    , mpFontCharSets(NULL)
-    , mnFontCharSetCount(0)
-    , mbFontKernInit(false)
-    , mpFontKernPairs(NULL)
-    , mnFontKernPairCount(0)
-{
-    for (int i = 0; i < MAX_FALLBACK; ++i)
-    {
-        mhFonts[i] = 0;
-        mpWinFontData[i]  = NULL;
-        mpWinFontEntry[i] = NULL;
-        mfFontScale[i] = 1.0;
-    }
-}
-
-WinTextRender::~WinTextRender()
-{
-    if (mhDefFont)
-        SelectFont(getHDC(), mhDefFont);
-
-    delete[] mpLogFont;
-
-    delete[] mpFontCharSets;
-
-    delete[] mpFontKernPairs;
-}
-
-HDC WinTextRender::getHDC() const
-{
-    return mrGraphics.getHDC();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f2be14cdba8dbe0128751007acf9e82bde3e60a0
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Nov 14 00:06:52 2014 +0100

    Revert "vcl: remove non-existent include and hope that it builds?"
    
    This reverts commit 7e6205117d535905b46c0106e66e5e3b593ee813.

diff --git a/vcl/inc/wintextrender.hxx b/vcl/inc/wintextrender.hxx
index 0647980..90b0561 100644
--- a/vcl/inc/wintextrender.hxx
+++ b/vcl/inc/wintextrender.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_INC_WINTEXTRENDER_HXX
 #define INCLUDED_VCL_INC_WINTEXTRENDER_HXX
 
+#include <tools/rational.hxx>
 #include <vcl/salgtype.hxx>
 #include <vcl/sysdata.hxx>
 #include <vcl/vclenum.hxx>


More information about the Libreoffice-commits mailing list