Mostly working, optimize curves completely within nodes.
authorDavid Gow <[email protected]>
Thu, 28 Aug 2014 11:57:09 +0000 (19:57 +0800)
committerDavid Gow <[email protected]>
Thu, 28 Aug 2014 11:57:09 +0000 (19:57 +0800)
src/bezier.h
src/document.cpp

index 751686d..9dd38c0 100644 (file)
@@ -305,7 +305,7 @@ namespace IPDF
                                Debug(" -- t0: %f to t1: %f", t0, t1);
                                Real ptx, pty;
                                Evaluate(ptx, pty, ((t1 + t0) / Real(2)));
-                               if (r.PointIn(ptx, pty))
+                               if (true || r.PointIn(ptx, pty))
                                {
                                        all_beziers.push_back(this->ReParametrise(t0, t1));
                                }
index 37f15e2..1383906 100644 (file)
@@ -132,7 +132,14 @@ int Document::ClipObjectToQuadChild(int object_id, QuadTreeNodeChildren type)
                }
        case BEZIER:
                {
-//             Rect child_node_bounds = m_objects.bounds[object_id];
+               // If we're entirely within the quadtree node, no clipping need occur.
+               if (ContainedInQuadChild(m_objects.bounds[object_id], type))
+               {
+                       m_objects.bounds.push_back(TransformToQuadChild(m_objects.bounds[object_id], type));
+                       m_objects.types.push_back(m_objects.types[object_id]);
+                       m_objects.data_indices.push_back(m_objects.data_indices[object_id]);
+                       return 1;
+               }
                Rect clip_bezier_bounds = TransformRectCoordinates(m_objects.bounds[object_id], TransformFromQuadChild(Rect{0,0,1,1}, type)); 
                std::vector<Bezier> new_curves = m_objects.beziers[m_objects.data_indices[object_id]].ClipToRectangle(clip_bezier_bounds);
                for (size_t i = 0; i < new_curves.size(); ++i)

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