[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - filter/source

Samuel Mehrbrodt s.mehrbrodt at gmail.com
Sun Dec 29 12:58:21 PST 2013


 filter/source/svg/svgreader.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 050e42346bd2d7ce8ab454df400b48f52c2aeecf
Author: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Date:   Sat Dec 7 12:14:40 2013 +0100

    fdo#39206 Add support for image transformation in SVG Import
    
    Change-Id: I268599b0c13bbacf5db526fed79453a5443145a5
    Reviewed-on: https://gerrit.libreoffice.org/6968
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit fb978b8123a47123d184daf390ce17eaacbc05d9)

diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index e74f669..e3f1af3 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -1421,7 +1421,7 @@ struct ShapeWritingVisitor
                 // collect attributes
                 const sal_Int32 nNumAttrs( xAttributes->getLength() );
                 OUString sAttributeValue;
-                double x=0.0,y=0.0,width=0.0,height=0.0;
+                double x=0.0, y=0.0, width=0.0, height=0.0;
                 for( sal_Int32 i=0; i<nNumAttrs; ++i )
                 {
                     sAttributeValue = xAttributes->item(i)->getNodeValue();
@@ -1446,6 +1446,20 @@ struct ShapeWritingVisitor
                             break;
                     }
                 }
+                // extract basic transformations out of CTM
+                basegfx::B2DTuple aScale, aTranslate;
+                double fRotate, fShearX;
+                if (maCurrState.maCTM.decompose(aScale, aTranslate, fRotate, fShearX))
+                {
+                    // apply transform
+                    x *= aScale.getX();
+                    width *= aScale.getX();
+                    y *= aScale.getY();
+                    height *= aScale.getY();
+                    x += aTranslate.getX();
+                    y += aTranslate.getY();
+                    //TODO: Rotate
+                }
 
                 OUString sValue = xElem->hasAttribute("href") ? xElem->getAttribute("href") : "";
                 OString aValueUtf8( sValue.getStr(), sValue.getLength(), RTL_TEXTENCODING_UTF8 );
@@ -1508,6 +1522,7 @@ struct ShapeWritingVisitor
                     y *= aScale.getY();
                     x += aTranslate.getX();
                     y += aTranslate.getY();
+                    //TODO: Rotate
                 }
                 else {
                     // some heuristic attempts to have text output


More information about the Libreoffice-commits mailing list