From: David Gow Date: Sun, 5 Oct 2014 04:33:48 +0000 (+0800) Subject: Painfully merge branch 'master' of git.ucc.asn.au:ipdf/code X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a54254dcb23c8db9b78d5bd42e1ca54efda4c8e8;p=ipdf%2Fcode.git Painfully merge branch 'master' of git.ucc.asn.au:ipdf/code Conflicts: src/document.cpp --- a54254dcb23c8db9b78d5bd42e1ca54efda4c8e8 diff --cc src/document.cpp index ffe3b8a,22e4235..6e022df --- a/src/document.cpp +++ b/src/document.cpp @@@ -417,34 -340,24 +417,34 @@@ unsigned Document::Add(ObjectType type #ifndef QUADTREE_DISABLED if (qti != -1) { - while (m_quadtree.nodes[qti].next_overlay != -1) + QuadTreeIndex new_qti = qti; + while (m_quadtree.nodes[new_qti].next_overlay != -1) { - if (m_count == m_quadtree.nodes[qti].object_end+1) + if (m_count == m_quadtree.nodes[new_qti].object_end+1) { - m_quadtree.nodes[qti].object_end++; + m_quadtree.nodes[new_qti].object_end++; goto done; } - qti = m_quadtree.nodes[qti].next_overlay; + new_qti = m_quadtree.nodes[new_qti].next_overlay; + } + { + QuadTreeIndex overlay = m_quadtree.nodes.size(); + Debug("Adding new overlay, nqti = %d, overlay = %d", new_qti, overlay); + m_quadtree.nodes.push_back(m_quadtree.nodes[qti]); + m_quadtree.nodes[overlay].object_begin = m_count; + // All objects are dirty. + m_quadtree.nodes[overlay].object_dirty = m_count; + m_quadtree.nodes[overlay].object_end = m_count+1; + m_quadtree.nodes[overlay].next_overlay = -1; + m_quadtree.nodes[new_qti].next_overlay = overlay; + new_qti = overlay; } - done: - QuadTreeIndex overlay = m_quadtree.nodes.size(); - m_quadtree.nodes.push_back(m_quadtree.nodes[qti]); - m_quadtree.nodes[overlay].object_begin = m_count; - m_quadtree.nodes[overlay].object_end = m_count+1; - m_quadtree.nodes[qti].next_overlay = overlay; ++done: // matches is not amused, but sulix is nice and moved it inside the #ifdef for him. + m_count++; + PropagateQuadChanges(qti); } -done: // matches is not amused #endif - return (m_count++); // Why can't we just use the size of types or something? + return m_count; // Why can't we just use the size of types or something? } unsigned Document::AddBezierData(const Bezier & bezier)