[Libreoffice-commits] core.git: 2 commits - drawinglayer/source vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Sat Apr 26 10:29:29 PDT 2014


 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   10 +++++++
 vcl/source/filter/wmf/winmtf.cxx                        |   22 +++++++++++-----
 vcl/source/filter/wmf/winmtf.hxx                        |    2 +
 3 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit 17ca93a6e592d3109e47c756fcfe8ac975acae5f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sat Apr 26 19:20:22 2014 +0200

    fdo#74336 need to transform dash length / dot length / distance
    
    Dash length, dot length and distance also need to be world
    transformed to be compatible with device metrics.
    
    Change-Id: I57c04f5010006aaf8c1c32e0949cb39b7f2bc67d

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 7aa7337..7c4b01d 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -473,6 +473,20 @@ void WinMtfOutput::ImplMap( Font& rFont )
         rFont.SetOrientation( 3600 - rFont.GetOrientation() );
 }
 
+sal_Int32 WinMtfOutput::ImplConvertWidth(const sal_Int32 aWidth)
+{
+    Size aSize(aWidth, 0);
+    return ImplMap(aSize).Width();
+}
+
+void WinMtfOutput::ImplMap(LineInfo& rLineInfo)
+{
+    rLineInfo.SetWidth(ImplConvertWidth(rLineInfo.GetWidth()));
+    rLineInfo.SetDashLen(ImplConvertWidth(rLineInfo.GetDashLen()));
+    rLineInfo.SetDotLen(ImplConvertWidth(rLineInfo.GetDotLen()));
+    rLineInfo.SetDistance(ImplConvertWidth(rLineInfo.GetDistance()));
+}
+
 Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon )
 {
     sal_uInt16 nPoints = rPolygon.GetSize();
@@ -682,9 +696,7 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle )
         else if ( eType == GDI_PEN )
         {
             WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
-            Size aSize(pLineStyle->aLineInfo.GetWidth(), 0);
-            aSize = ImplMap(aSize);
-            pLineStyle->aLineInfo.SetWidth(aSize.Width());
+            ImplMap(pLineStyle->aLineInfo);
         }
     }
     sal_uInt32 nIndex;
@@ -716,9 +728,7 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS
             else if ( eType == GDI_PEN )
             {
                 WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
-                Size aSize(pLineStyle->aLineInfo.GetWidth(), 0);
-                aSize = ImplMap(aSize);
-                pLineStyle->aLineInfo.SetWidth(aSize.Width());
+                ImplMap(pLineStyle->aLineInfo);
             }
         }
         if ( (sal_uInt32)nIndex >= vGDIObj.size() )
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index 035686c..52b1848 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -619,6 +619,8 @@ class WinMtfOutput
     Size                ImplMap( const Size& rSz );
     Rectangle           ImplMap( const Rectangle& rRectangle );
     void                ImplMap( Font& rFont );
+    sal_Int32           ImplConvertWidth(const sal_Int32 aWidth);
+    void                ImplMap(LineInfo& rLineInfo);
     Polygon&            ImplMap( Polygon& rPolygon );
     PolyPolygon&        ImplMap( PolyPolygon& rPolyPolygon );
     Polygon&            ImplScale( Polygon& rPolygon );
commit 6d0005d95f20a326fe308a7c59dd2801f0d0b241
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sat Apr 26 19:13:31 2014 +0200

    fdo#74336 draw hairline if line width is small
    
    RenderPolygonStrokePrimitive2D draws a simple hairline if the
    line width is less than 1.0 (and less than 1.5 if no AA is used)
    so in tryDrawPolygonStrokePrimitive2DDirect we need to reflect
    this behaviour - otherwise the lines are drawn too small.
    
    Change-Id: Icd3d8f35a00346b1d624b6df010f43ed21968d04

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 73d12f3..1a4db95 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -237,6 +237,16 @@ namespace drawinglayer
                 fLineWidth = aLineWidth.getLength();
             }
 
+            // draw simple hairline for small line widths
+            // see also RenderPolygonStrokePrimitive2D which is used if this try fails
+            bool bIsAntiAliasing = getOptionsDrawinglayer().IsAntiAliasing();
+            if (   (basegfx::fTools::lessOrEqual(fLineWidth, 1.0) && bIsAntiAliasing)
+                || (basegfx::fTools::lessOrEqual(fLineWidth, 1.5) && !bIsAntiAliasing))
+            {
+                // draw simple hairline
+                fLineWidth = 0.0;
+            }
+
             bool bHasPoints(false);
             bool bTryWorked(false);
 


More information about the Libreoffice-commits mailing list