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

Armin Le Grand alg at apache.org
Tue Sep 10 10:48:25 PDT 2013


 vcl/source/filter/wmf/enhwmf.cxx |   20 ++++++++++++--------
 vcl/source/filter/wmf/winmtf.cxx |   13 +++++++++----
 vcl/source/filter/wmf/winmtf.hxx |    1 +
 vcl/source/filter/wmf/wmf.cxx    |    7 +++++++
 4 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit ae8cbeeba09607d34c3e0209bda3ccfdd71f0cbb
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Sep 10 11:48:33 2013 +0000

    Resolves: #i123216# No FontScaling by WorldTransform on WMF import
    
    (cherry picked from commit d0ebb70c004761552016b0fa0a259ef35a01f840)
    
    Conflicts:
    	svtools/source/filter/wmf/enhwmf.cxx
    	svtools/source/filter/wmf/winmtf.cxx
    	svtools/source/filter/wmf/winmtf.hxx
    	svtools/source/filter/wmf/wmf.cxx
    
    Change-Id: I3e85dcc019028b83eb2f650f1527333f2d5cf9dc

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index c09b317..6ceecc9 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1174,14 +1174,18 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
                         }
                         aLogFont.alfFaceName = OUString( lfFaceName );
 
-                        // #i121382# Need to apply WorldTransform to FontHeight/Width; this should be completely
-                        // changed to basegfx::B2DHomMatrix instead of 'struct XForm', but not now due to time
-                        // constraints and dangers
-                        const XForm& rXF = pOut->GetWorldTransform();
-                        const basegfx::B2DHomMatrix aWT(rXF.eM11, rXF.eM21, rXF.eDx, rXF.eM12, rXF.eM22, rXF.eDy);
-                        const basegfx::B2DVector aTransVec(aWT * basegfx::B2DVector(aLogFont.lfWidth, aLogFont.lfHeight));
-                        aLogFont.lfWidth = aTransVec.getX();
-                        aLogFont.lfHeight = aTransVec.getY();
+                        // #i123216# Not used in the test case of #121382# (always identity in XForm), also
+                        // no hints in ms docu if FontSize should be scaled with WT. Using with the example
+                        // from #i123216# creates errors, so removing.
+                        //
+                        // // #i121382# Need to apply WorldTransform to FontHeight/Width; this should be completely
+                        // // changed to basegfx::B2DHomMatrix instead of 'struct XForm', but not now due to time
+                        // // constraints and dangers
+                        // const XForm& rXF = pOut->GetWorldTransform();
+                        // const basegfx::B2DHomMatrix aWT(rXF.eM11, rXF.eM21, rXF.eDx, rXF.eM12, rXF.eM22, rXF.eDy);
+                        // const basegfx::B2DVector aTransVec(aWT * basegfx::B2DVector(aLogFont.lfWidth, aLogFont.lfHeight));
+                        // aLogFont.lfWidth = aTransVec.getX();
+                        // aLogFont.lfHeight = aTransVec.getY();
 
                         pOut->CreateObject( nIndex, GDI_FONT, new WinMtfFontStyle( aLogFont ) );
                     }
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 0972dcd..e189e0c 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -2069,10 +2069,10 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode )
     {
         case MWT_IDENTITY :
         {
-            maXForm.eM11 = maXForm.eM12 = maXForm.eM21 = maXForm.eM22 = 1.0f;
-            maXForm.eDx = maXForm.eDy = 0.0f;
+            maXForm.eM11 = maXForm.eM22 = 1.0f;
+            maXForm.eM12 = maXForm.eM21 = maXForm.eDx = maXForm.eDy = 0.0f;
+            break;
         }
-        break;
 
         case MWT_RIGHTMULTIPLY :
         case MWT_LEFTMULTIPLY :
@@ -2131,8 +2131,13 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode )
             maXForm.eM22 = cF[1][1];
             maXForm.eDx = cF[2][0];
             maXForm.eDy = cF[2][1];
+            break;
+        }
+        case MWT_SET:
+        {
+            SetWorldTransform(rXForm);
+            break;
         }
-        break;
     }
  }
 
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index df64f2a..3d3ee97 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -52,6 +52,7 @@
 #define MWT_IDENTITY            1
 #define MWT_LEFTMULTIPLY        2
 #define MWT_RIGHTMULTIPLY       3
+#define MWT_SET                 4
 
 #define ENHMETA_STOCK_OBJECT    0x80000000
 
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index 3c06d55..c0e2f46 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -45,6 +45,13 @@ sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaF
     {
         WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem, pExtHeader ).ReadWMF( );
     }
+
+#ifdef DBG_UTIL
+    // #i123216# allow a look at CheckSum and ByteSize for debugging
+    SAL_INFO("vcl.emf", "\t\t\tchecksum: 0x" << std::hex << rGDIMetaFile.GetChecksum() << std::dec);
+    SAL_INFO("vcl.emf", "\t\t\tsize: " << rGDIMetaFile.GetSizeBytes());
+#endif
+
     rStreamWMF.SetNumberFormatInt( nOrigNumberFormat );
     return !rStreamWMF.GetError();
 }


More information about the Libreoffice-commits mailing list