[Libreoffice-commits] .: 4 commits - vcl/Library_vcl.mk vcl/win

Tor Lillqvist tml at kemper.freedesktop.org
Thu Jul 14 08:28:36 PDT 2011


 vcl/Library_vcl.mk                    |    7 +-
 vcl/win/source/app/salinst.cxx        |   15 ++--
 vcl/win/source/app/saltimer.cxx       |    7 +-
 vcl/win/source/gdi/salgdi_gdiplus.cxx |  104 ++++++++++++++++++----------------
 vcl/win/source/gdi/salprn.cxx         |    8 +-
 vcl/win/source/window/salframe.cxx    |    7 +-
 6 files changed, 83 insertions(+), 65 deletions(-)

New commits:
commit c4f79507f4423869668a72a7acf72acf76e52e5e
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Thu Jul 14 18:25:51 2011 +0300

    Fixes for Windows cross-compilation
    
    Header names are all lower-case. Use our own sehandler.hxx instead of
    assuming that stuff being in a patches excpt.h.

diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index ecc8e92..fad1fd7 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -34,9 +34,6 @@
 #include <svsys.h>
 #include <process.h>
 #endif
-#ifdef __MINGW32__
-#include <excpt.h>
-#endif
 
 #include <osl/file.hxx>
 #include <osl/mutex.hxx>
@@ -72,15 +69,19 @@
 #pragma warning( disable: 4917 )
 #endif
 
-#include <GdiPlus.h>
-#include <GdiPlusEnums.h>
-#include <GdiPlusColor.h>
-#include <Shlobj.h>
+#include <gdiplus.h>
+#include <gdiplusenums.h>
+#include <gdipluscolor.h>
+#include <shlobj.h>
 
 #if defined _MSC_VER
 #pragma warning(pop)
 #endif
 
+#ifdef __MINGW32__
+#include <sehandler.hxx>
+#endif
+
 // =======================================================================
 
 void SalAbort( const XubString& rErrorText )
diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx
index 66a6f48..2dad65a 100644
--- a/vcl/win/source/app/saltimer.cxx
+++ b/vcl/win/source/app/saltimer.cxx
@@ -29,13 +29,14 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 #include <svsys.h>
-#ifdef __MINGW32__
-#include <excpt.h>
-#endif
 #include <win/saldata.hxx>
 #include <win/saltimer.h>
 #include <win/salinst.h>
 
+#ifdef __MINGW32__
+#include <sehandler.hxx>
+#endif
+
 // =======================================================================
 
 // Maximale Periode
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index 5baac4e..8d6bc83 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -39,10 +39,6 @@
 
 #include <tools/urlobj.hxx>
 
-#ifdef __MINGW32__
-#include <excpt.h>
-#endif
-
 #include <win/wincomp.hxx>
 #include <win/saldata.hxx>
 #include <win/salinst.h>
@@ -65,6 +61,10 @@
 #include <malloc.h>
 
 #ifdef __MINGW32__
+#include <sehandler.hxx>
+#endif
+
+#ifdef __MINGW32__
 #define CATCH_DRIVER_EX_BEGIN                                               \
     jmp_buf jmpbuf;                                                         \
     __SEHandler han;                                                        \
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 052ef31..7ae5cca 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -48,9 +48,6 @@
 #include <stdio.h>
 
 #include <svsys.h>
-#ifdef __MINGW32__
-#include <excpt.h>
-#endif
 
 #include <rtl/string.h>
 #include <rtl/ustring.h>
@@ -100,6 +97,10 @@ using ::std::max;
 
 #include <time.h>
 
+#ifdef __MINGW32__
+#include <sehandler.hxx>
+#endif
+
 using ::rtl::OUString;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
commit 593a6ac89d219cb45a8787030e7e8a3c206f750f
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Thu Jul 14 18:25:16 2011 +0300

    Use the flat GdiPlus API as needed because of the incomplete headers from Wine

diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx
index 8f26a36..d3c6057 100644
--- a/vcl/win/source/gdi/salgdi_gdiplus.cxx
+++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx
@@ -50,9 +50,9 @@
 #pragma warning(push, 1)
 #endif
 
-#include <GdiPlus.h>
-#include <GdiPlusEnums.h>
-#include <GdiPlusColor.h>
+#include <gdiplus.h>
+#include <gdiplusenums.h>
+#include <gdipluscolor.h>
 
 #if defined _MSC_VER
 #pragma warning(pop)
@@ -62,7 +62,7 @@
 
 // -----------------------------------------------------------------------
 
-void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
+void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
 {
     sal_uInt32 nCount(rPolygon.count());
 
@@ -71,44 +71,42 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, con
         const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1);
         const bool bControls(rPolygon.areControlPointsUsed());
         basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0));
-        Gdiplus::PointF aFCurr(Gdiplus::REAL(aCurr.getX()), Gdiplus::REAL(aCurr.getY()));
 
         for(sal_uInt32 a(0); a < nEdgeCount; a++)
         {
             const sal_uInt32 nNextIndex((a + 1) % nCount);
             const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex));
-            const Gdiplus::PointF aFNext(Gdiplus::REAL(aNext.getX()), Gdiplus::REAL(aNext.getY()));
 
             if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex)))
             {
                 const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a));
                 const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex));
 
-                rPath.AddBezier(
-                    aFCurr, 
-                    Gdiplus::PointF(Gdiplus::REAL(aCa.getX()), Gdiplus::REAL(aCa.getY())),
-                    Gdiplus::PointF(Gdiplus::REAL(aCb.getX()), Gdiplus::REAL(aCb.getY())),
-                    aFNext);
+                Gdiplus::DllExports::GdipAddPathBezier(pPath,
+                    aCurr.getX(), aCurr.getY(), 
+                    aCa.getX(), aCa.getY(),
+                    aCb.getX(), aCb.getY(),
+                    aNext.getX(), aNext.getY());
             }
             else
             {
-                rPath.AddLine(aFCurr, aFNext);
+                Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY());
             }
 
             if(a + 1 < nEdgeCount)
             {
-                aFCurr = aFNext;
+                aCurr = aNext;
 
                 if(bNoLineJoin)
                 {
-                    rPath.StartFigure();
+                    Gdiplus::DllExports::GdipStartPathFigure(pPath);
                 }
             }
         }
     }
 }
 
-void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
+void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin)
 {
     sal_uInt32 nCount(rPolygon.count());
 
@@ -117,37 +115,36 @@ void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath,
         const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1);
         const bool bControls(rPolygon.areControlPointsUsed());
         basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0));
-        Gdiplus::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY()));
 
         for(sal_uInt32 a(0); a < nEdgeCount; a++)
         {
             const sal_uInt32 nNextIndex((a + 1) % nCount);
             const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex));
-            const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY()));
 
             if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex)))
             {
                 const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a));
                 const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex));
 
-                rPath.AddBezier(
-                    aICurr, 
-                    Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())),
-                    Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())),
-                    aINext);
+                Gdiplus::DllExports::GdipAddPathBezier(
+                    pPath,
+                    aCurr.getX(), aCurr.getY(),
+                    aCa.getX(), aCa.getY(),
+                    aCb.getX(), aCb.getY(),
+                    aNext.getX(), aNext.getY());
             }
             else
             {
-                rPath.AddLine(aICurr, aINext);
+                Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY());
             }
 
             if(a + 1 < nEdgeCount)
             {
-                aICurr = aINext;
+                aCurr = aNext;
 
                 if(bNoLineJoin)
                 {
-                    rPath.StartFigure();
+                    Gdiplus::DllExports::GdipStartPathFigure(pPath);
                 }
             }
         }
@@ -160,33 +157,39 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly
 
     if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0))
     {
-        Gdiplus::Graphics aGraphics(mhDC);
+        Gdiplus::GpGraphics *pGraphics = NULL;
+        Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics);
         const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0));
         Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor));
-        Gdiplus::SolidBrush aTestBrush(aTestColor);
-        Gdiplus::GraphicsPath aPath;
+        Gdiplus::GpSolidFill *pTestBrush;
+        Gdiplus::DllExports::GdipCreateSolidFill(aTestColor.GetValue(), &pTestBrush);
+        Gdiplus::GpPath *pPath = NULL;
+        Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath);
 
         for(sal_uInt32 a(0); a < nCount; a++)
         {
             if(0 != a)
             {
-                aPath.StartFigure(); // #i101491# not needed for first run
+                Gdiplus::DllExports::GdipStartPathFigure(pPath); // #i101491# not needed for first run
             }
 
-            impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false);
-            aPath.CloseFigure();
+            impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolyPolygon.getB2DPolygon(a), false);
+            Gdiplus::DllExports::GdipClosePathFigure(pPath);
         }
 
         if(getAntiAliasB2DDraw())
         {
-            aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+            Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias);
         }
         else
         {
-            aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
+            Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone);
         }
 
-        aGraphics.FillPath(&aTestBrush, &aPath);
+        Gdiplus::DllExports::GdipFillPath(pGraphics, pTestBrush, pPath);
+
+        Gdiplus::DllExports::GdipDeletePath(pPath);
+        Gdiplus::DllExports::GdipDeleteGraphics(pGraphics);
     }
 
      return true;
@@ -198,11 +201,14 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f
 
     if(mbPen && nCount)
     {
-        Gdiplus::Graphics aGraphics(mhDC);
+        Gdiplus::GpGraphics *pGraphics = NULL;
+        Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics);
         const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) );
         Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor));
-        Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX()));
-        Gdiplus::GraphicsPath aPath;
+        Gdiplus::GpPen *pTestPen = NULL;
+        Gdiplus::DllExports::GdipCreatePen1(aTestColor.GetValue(), Gdiplus::REAL(rLineWidths.getX()), Gdiplus::UnitWorld, &pTestPen);
+        Gdiplus::GpPath *pPath;
+        Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath);
         bool bNoLineJoin(false);
 
         switch(eLineJoin)
@@ -217,49 +223,53 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f
             }
             case basegfx::B2DLINEJOIN_BEVEL :
             {
-                aTestPen.SetLineJoin(Gdiplus::LineJoinBevel);
+                Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinBevel);
                 break;
             }
             case basegfx::B2DLINEJOIN_MIDDLE :
             case basegfx::B2DLINEJOIN_MITER :
             {
                 const Gdiplus::REAL aMiterLimit(15.0);
-                aTestPen.SetMiterLimit(aMiterLimit);
-                aTestPen.SetLineJoin(Gdiplus::LineJoinMiter);
+                Gdiplus::DllExports::GdipSetPenMiterLimit(pTestPen, aMiterLimit);
+                Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinMiter);
                 break;
             }
             case basegfx::B2DLINEJOIN_ROUND :
             {
-                aTestPen.SetLineJoin(Gdiplus::LineJoinRound);
+                Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinRound);
                 break;
             }
         }
 
         if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5))
         {
-            impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin);
+            impAddB2DPolygonToGDIPlusGraphicsPathInteger(pPath, rPolygon, bNoLineJoin);
         }
         else
         {
-            impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin);
+            impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolygon, bNoLineJoin);
         }
 
         if(rPolygon.isClosed() && !bNoLineJoin)
         {
             // #i101491# needed to create the correct line joins
-            aPath.CloseFigure();
+            Gdiplus::DllExports::GdipClosePathFigure(pPath);
         }
         
         if(getAntiAliasB2DDraw())
         {
-            aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+            Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias);
         }
         else
         {
-            aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
+            Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone);
         }
 
-        aGraphics.DrawPath(&aTestPen, &aPath);
+        Gdiplus::DllExports::GdipDrawPath(pGraphics, pTestPen, pPath);
+
+        Gdiplus::DllExports::GdipDeletePath(pPath);
+        Gdiplus::DllExports::GdipDeletePen(pTestPen);
+        Gdiplus::DllExports::GdipDeleteGraphics(pGraphics);
     }
 
     return true;
commit 2fe34041cce7f5cb7a0b70f309d84d5c09937064
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Thu Jul 14 18:20:47 2011 +0300

    Use OLDNAMESLIB

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 2925acf..b6d7ba6 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -545,7 +545,7 @@ $(eval $(call gb_Library_add_linked_libs,vcl,\
     mpr \
     msimg32 \
     msvcrt \
-    oldnames \
+    $(OLDNAMESLIB) \
     ole32 \
     shell32 \
     user32 \
commit 9e60dd408d9d0b019c3d28f0c9d70f41245f7068
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Thu Jul 14 18:19:24 2011 +0300

    Use the gdiplus headers from Wine when cross-compiling to Windows

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 70bdad3..2925acf 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -42,12 +42,17 @@ endif
 $(eval $(call gb_Library_add_package_headers,vcl,vcl_inc))
 $(eval $(call gb_Library_add_package_headers,vcl,vcl_afmhash))
 
+ifeq ($(OS)$(COM),WNTGCC)
+GDIPLUSINCLUDE=-I$(OUTDIR)/inc/external/gdiplus
+endif
+
 $(eval $(call gb_Library_set_include,vcl,\
     $$(INCLUDE) \
     -I$(realpath $(SRCDIR)/vcl/inc) \
     -I$(realpath $(SRCDIR)/vcl/inc/pch) \
     -I$(SRCDIR)/solenv/inc \
     -I$(OUTDIR)/inc \
+    $(GDIPLUSINCLUDE) \
     -I$(WORKDIR)/CustomTarget/vcl/unx/generic/fontmanager \
 ))
 ifeq ($(GUIBASE),unx)


More information about the Libreoffice-commits mailing list