Make it work on Cabellera (again)
authorSam Moore <[email protected]>
Thu, 7 Aug 2014 03:44:01 +0000 (11:44 +0800)
committerSam Moore <[email protected]>
Thu, 7 Aug 2014 03:44:01 +0000 (11:44 +0800)
I keep forgetting I shouldn't use C++11 features
THEY ARE JUST SO CONVENIENT!

:(

Clownfish has C++11 but the open source AMD drivers don't like
geometry shaders and sulix threatened me with dire consequences
of installing fglrx...

Also fix the symlinks in svg-tests

src/document.cpp
src/document.h
src/svg-tests/koch1.svg
src/svg-tests/rabbit_simple.svg
src/svg-tests/shape.svg
src/tests/realops.cpp

index 71f3ed4..a4d6be6 100644 (file)
@@ -280,7 +280,7 @@ void Document::LoadSVG(const string & filename, const Rect & bounds)
        input.close();
 
        // Combine all SVG tags into one thing because lazy
        input.close();
 
        // Combine all SVG tags into one thing because lazy
-       for (xml_node svg : doc_xml.children("svg"))
+       for (xml_node svg = doc_xml.child("svg"); svg; svg = svg.next_sibling("svg"))
        {
                Real width = svg.attribute("width").as_float() * bounds.w;
                Real height = svg.attribute("width").as_float() * bounds.h;
        {
                Real width = svg.attribute("width").as_float() * bounds.w;
                Real height = svg.attribute("width").as_float() * bounds.h;
@@ -289,7 +289,7 @@ void Document::LoadSVG(const string & filename, const Rect & bounds)
                // Rectangles
                Real coords[4];
                const char * attrib_names[] = {"x", "y", "width", "height"};
                // Rectangles
                Real coords[4];
                const char * attrib_names[] = {"x", "y", "width", "height"};
-               for (pugi::xml_node rect : svg.children("rect"))
+               for (pugi::xml_node rect = svg.child("rect"); rect; rect = rect.next_sibling("rect"))
                {
                        for (size_t i = 0; i < 4; ++i)
                                coords[i] = rect.attribute(attrib_names[i]).as_float();
                {
                        for (size_t i = 0; i < 4; ++i)
                                coords[i] = rect.attribute(attrib_names[i]).as_float();
@@ -300,7 +300,7 @@ void Document::LoadSVG(const string & filename, const Rect & bounds)
                }               
                
                // Circles
                }               
                
                // Circles
-               for (pugi::xml_node circle : svg.children("circle"))
+               for (pugi::xml_node circle = svg.child("circle"); circle; circle = circle.next_sibling("circle"))
                {
                        Real cx = circle.attribute("cx").as_float();
                        Real cy = circle.attribute("cy").as_float();
                {
                        Real cx = circle.attribute("cx").as_float();
                        Real cy = circle.attribute("cy").as_float();
@@ -318,7 +318,7 @@ void Document::LoadSVG(const string & filename, const Rect & bounds)
                }               
                
                // paths
                }               
                
                // paths
-               for (pugi::xml_node path : svg.children("path"))
+               for (pugi::xml_node path = svg.child("path"); path; path = path.next_sibling("path"))
                {
                        
                        string d = path.attribute("d").as_string();
                {
                        
                        string d = path.attribute("d").as_string();
index 14a87d8..c0adc52 100644 (file)
@@ -12,7 +12,7 @@ namespace IPDF
                        Document(const std::string & filename = "") : m_objects(), m_count(0) {Load(filename);}
                        virtual ~Document() {}
                        
                        Document(const std::string & filename = "") : m_objects(), m_count(0) {Load(filename);}
                        virtual ~Document() {}
                        
-                       void LoadSVG(const std::string & filename, const Rect & bounds = {0,0,1,1});
+                       void LoadSVG(const std::string & filename, const Rect & bounds = Rect(0,0,1,1));
 
                        void Load(const std::string & filename = "");
                        void Save(const std::string & filename);
 
                        void Load(const std::string & filename = "");
                        void Save(const std::string & filename);
index 2305547..f1bd3e8 120000 (symlink)
@@ -1 +1 @@
-/home/sam/ipdf/sam/figures/koch1.svg
\ No newline at end of file
+../../../sam/figures/koch1.svg
\ No newline at end of file
index 30fed1a..83b5f92 120000 (symlink)
@@ -1 +1 @@
-/home/sam/ipdf/sam/figures/rabbit_simple.svg
\ No newline at end of file
+../../../sam/figures/rabbit_simple.svg
\ No newline at end of file
index 62d71a8..1ee4bea 120000 (symlink)
@@ -1 +1 @@
-/home/sam/ipdf/sam/figures/shape.svg
\ No newline at end of file
+../../../sam/figures/shape.svg
\ No newline at end of file
index b9ce441..61d747c 100644 (file)
@@ -1,3 +1,7 @@
+/**
+ * Test mathematical operations on the Real type and consistency with double
+ */
+
 #include "main.h"
 #include "real.h"
 
 #include "main.h"
 #include "real.h"
 

UCC git Repository :: git.ucc.asn.au