The QuadTree is ~72% more amazing.
authorDavid Gow <david@ingeniumdigital.com>
Wed, 10 Sep 2014 07:30:55 +0000 (15:30 +0800)
committerDavid Gow <david@ingeniumdigital.com>
Wed, 10 Sep 2014 07:30:55 +0000 (15:30 +0800)
src/document.cpp
src/view.cpp

index d825914..5890730 100644 (file)
@@ -105,6 +105,7 @@ int Document::ClipObjectToQuadChild(int object_id, QuadTreeNodeChildren type)
        {
        case RECT_FILLED:
        case RECT_OUTLINE:
+       case PATH:
                {
                Rect obj_bounds = TransformToQuadChild(m_objects.bounds[object_id], type);
                if (obj_bounds.x < 0)
@@ -147,6 +148,7 @@ int Document::ClipObjectToQuadChild(int object_id, QuadTreeNodeChildren type)
                        Rect new_bounds = TransformToQuadChild(m_objects.bounds[object_id], type);
                        Bezier new_curve_data = new_curves[i].ToAbsolute(TransformToQuadChild(m_objects.bounds[object_id],type));
                        new_bounds = new_curve_data.SolveBounds();
+                       Debug("New bounds: %s", new_bounds.Str().c_str());
                        new_curve_data = new_curve_data.ToRelative(new_bounds);
                        unsigned index = AddBezierData(new_curve_data);
                        m_objects.bounds.push_back(new_bounds);
index 60f2976..26e0591 100644 (file)
@@ -229,6 +229,15 @@ void View::Render(int width, int height)
        }
        m_screen.DebugFontPrintF("Current View QuadTree Node: %d (objs: %d -> %d)\n", m_current_quadtree_node, m_document.GetQuadTree().nodes[m_current_quadtree_node].object_begin,
                                m_document.GetQuadTree().nodes[m_current_quadtree_node].object_end);
+
+       Rect view_top_bounds = m_bounds;
+       QuadTreeIndex tmp = m_current_quadtree_node;
+       while (tmp != -1)
+       {
+               view_top_bounds = TransformFromQuadChild(view_top_bounds, m_document.GetQuadTree().nodes[tmp].child_type);
+               tmp = m_document.GetQuadTree().nodes[tmp].parent;
+       }
+       m_screen.DebugFontPrintF("Equivalent View Bounds: %s\n", view_top_bounds.Str().c_str());
 #endif
 
        if (!m_use_gpu_rendering)

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