From: David Gow Date: Wed, 10 Sep 2014 07:30:55 +0000 (+0800) Subject: The QuadTree is ~72% more amazing. X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=commitdiff_plain;h=815a521a657dd67ab1d7b8b6a8804c061ca09c16 The QuadTree is ~72% more amazing. --- diff --git a/src/document.cpp b/src/document.cpp index d825914..5890730 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -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); diff --git a/src/view.cpp b/src/view.cpp index 60f2976..26e0591 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -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)