[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 2 commits - drawinglayer/source vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Sun Apr 27 11:06:11 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, 30 insertions(+), 4 deletions(-)

New commits:
commit dd655ec3335f1755d84f1a74eb8a49625f20a8b3
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.
    
    Conflicts:
    	vcl/source/filter/wmf/winmtf.cxx
    
    Change-Id: I57c04f5010006aaf8c1c32e0949cb39b7f2bc67d

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 8bc853c..c21d5e8 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -483,6 +483,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();
@@ -701,8 +715,8 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle )
         }
         else if ( eType == GDI_PEN )
         {
-            Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
-            ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+            WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
+            ImplMap(pLineStyle->aLineInfo);
         }
     }
     sal_uInt32 nIndex;
@@ -729,8 +743,8 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS
                 ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
             else if ( eType == GDI_PEN )
             {
-                Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
-                ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+                WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
+                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 9db9245..7438588 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -635,6 +635,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 652d6c4481f767aaa9044a73f5400a0446be4c97
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 203ce5f..783a064 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