[Libreoffice-commits] core.git: include/basegfx svgio/inc svgio/qa svgio/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Mar 6 15:36:56 UTC 2019


 include/basegfx/DrawCommands.hxx      |   11 +++++++++++
 svgio/inc/svgvisitor.hxx              |    6 +++---
 svgio/qa/cppunit/SvgRead.cxx          |    9 +++++----
 svgio/source/svgreader/svgvisitor.cxx |    8 ++++----
 svgio/source/svguno/xsvgparser.cxx    |    2 +-
 5 files changed, 24 insertions(+), 12 deletions(-)

New commits:
commit d112761291b16c1d47bebdebf3169527f5e1249e
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Mar 2 23:49:57 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Mar 6 16:36:25 2019 +0100

    use gfx namespace for DrawCommands
    
    Change-Id: Ib2d97c4fee4e1bb433beeba4fb507fdc7d542af9
    Reviewed-on: https://gerrit.libreoffice.org/68775
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/basegfx/DrawCommands.hxx b/include/basegfx/DrawCommands.hxx
index 23afbecb9273..36321c312ba7 100644
--- a/include/basegfx/DrawCommands.hxx
+++ b/include/basegfx/DrawCommands.hxx
@@ -7,6 +7,13 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#ifndef INCLUDED_BASEGFX_DRAWCOMMANDS_H
+#define INCLUDED_BASEGFX_DRAWCOMMANDS_H
+
+#include <memory>
+
+namespace gfx
+{
 class DrawBase;
 
 class DrawCommand
@@ -71,4 +78,8 @@ public:
     }
 };
 
+} // end namespace gfx
+
+#endif // INCLUDED_BASEGFX_DRAWCOMMANDS_H
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgvisitor.hxx b/svgio/inc/svgvisitor.hxx
index ea56e4cd189a..46adbfb22924 100644
--- a/svgio/inc/svgvisitor.hxx
+++ b/svgio/inc/svgvisitor.hxx
@@ -22,8 +22,8 @@ namespace svgreader
 class SvgDrawVisitor : public Visitor
 {
 private:
-    std::shared_ptr<DrawRoot> mpDrawRoot;
-    std::shared_ptr<DrawBase> mpCurrent;
+    std::shared_ptr<gfx::DrawRoot> mpDrawRoot;
+    std::shared_ptr<gfx::DrawBase> mpCurrent;
 
 public:
     SvgDrawVisitor();
@@ -31,7 +31,7 @@ public:
     void visit(svgio::svgreader::SvgNode const& rNode) override;
     void goToChildren(svgio::svgreader::SvgNode const& rNode);
 
-    std::shared_ptr<DrawRoot> const& getDrawRoot() { return mpDrawRoot; }
+    std::shared_ptr<gfx::DrawRoot> const& getDrawRoot() { return mpDrawRoot; }
 };
 }
 }
diff --git a/svgio/qa/cppunit/SvgRead.cxx b/svgio/qa/cppunit/SvgRead.cxx
index 9077f92db7b6..3c7974794e1b 100644
--- a/svgio/qa/cppunit/SvgRead.cxx
+++ b/svgio/qa/cppunit/SvgRead.cxx
@@ -84,14 +84,15 @@ void Test::test()
 
     uno::Any aAny = xSvgParser->getDrawCommands(xStream, aPath);
     CPPUNIT_ASSERT(aAny.has<sal_uInt64>());
-    DrawRoot* pDrawRoot = reinterpret_cast<DrawRoot*>(aAny.get<sal_uInt64>());
+    gfx::DrawRoot* pDrawRoot = reinterpret_cast<gfx::DrawRoot*>(aAny.get<sal_uInt64>());
 
     CPPUNIT_ASSERT_EQUAL(size_t(1), pDrawRoot->maChildren.size());
     CPPUNIT_ASSERT_EQUAL(basegfx::B2DRange(0, 0, 120, 120), pDrawRoot->maRectangle);
 
-    CPPUNIT_ASSERT_EQUAL(DrawCommandType::Rectangle, pDrawRoot->maChildren[0]->getType());
-    CPPUNIT_ASSERT_EQUAL(basegfx::B2DRange(10, 10, 110, 110),
-                         static_cast<DrawRectangle*>(pDrawRoot->maChildren[0].get())->maRectangle);
+    CPPUNIT_ASSERT_EQUAL(gfx::DrawCommandType::Rectangle, pDrawRoot->maChildren[0]->getType());
+    CPPUNIT_ASSERT_EQUAL(
+        basegfx::B2DRange(10, 10, 110, 110),
+        static_cast<gfx::DrawRectangle*>(pDrawRoot->maChildren[0].get())->maRectangle);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/svgio/source/svgreader/svgvisitor.cxx b/svgio/source/svgreader/svgvisitor.cxx
index 841a1cb7022e..9ac651c66cc7 100644
--- a/svgio/source/svgreader/svgvisitor.cxx
+++ b/svgio/source/svgreader/svgvisitor.cxx
@@ -24,7 +24,7 @@ namespace svgio
 namespace svgreader
 {
 SvgDrawVisitor::SvgDrawVisitor()
-    : mpDrawRoot(std::make_shared<DrawRoot>())
+    : mpDrawRoot(std::make_shared<gfx::DrawRoot>())
     , mpCurrent(mpDrawRoot)
 {
 }
@@ -42,7 +42,7 @@ void SvgDrawVisitor::visit(svgio::svgreader::SvgNode const& rNode)
             double w = rSvgNode.getWidth().getNumber();
             double h = rSvgNode.getHeight().getNumber();
 
-            static_cast<DrawRoot*>(mpCurrent.get())->maRectangle
+            static_cast<gfx::DrawRoot*>(mpCurrent.get())->maRectangle
                 = basegfx::B2DRange(x, y, x + w, y + h);
         }
         break;
@@ -70,7 +70,7 @@ void SvgDrawVisitor::visit(svgio::svgreader::SvgNode const& rNode)
             double h = rRectNode.getHeight().getNumber();
 
             auto pRectangle
-                = std::make_shared<DrawRectangle>(basegfx::B2DRange(x, y, x + w, y + h));
+                = std::make_shared<gfx::DrawRectangle>(basegfx::B2DRange(x, y, x + w, y + h));
             mpCurrent->maChildren.push_back(pRectangle);
         }
         break;
@@ -80,7 +80,7 @@ void SvgDrawVisitor::visit(svgio::svgreader::SvgNode const& rNode)
             auto pPath = rPathNode.getPath();
             if (pPath)
             {
-                auto pDrawPath = std::make_shared<DrawPath>(*pPath);
+                auto pDrawPath = std::make_shared<gfx::DrawPath>(*pPath);
                 mpCurrent->maChildren.push_back(pDrawPath);
             }
         }
diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx
index 3ed675763f72..e188e43dfa6e 100644
--- a/svgio/source/svguno/xsvgparser.cxx
+++ b/svgio/source/svguno/xsvgparser.cxx
@@ -194,7 +194,7 @@ namespace svgio
                 {
                     mpVisitor = std::make_shared<SvgDrawVisitor>();
                     pCandidate->accept(*mpVisitor);
-                    std::shared_ptr<DrawRoot> pDrawRoot(mpVisitor->getDrawRoot());
+                    std::shared_ptr<gfx::DrawRoot> pDrawRoot(mpVisitor->getDrawRoot());
                     sal_uInt64 nPointer = reinterpret_cast<sal_uInt64>(pDrawRoot.get());
                     aAnyResult <<= sal_uInt64(nPointer);
                 }


More information about the Libreoffice-commits mailing list