X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fdocument.cpp;h=aff9a2326ac25263aba808af3cdd927bedf7b5c8;hp=d01e07535ca001608a52738be910b1e15336f36d;hb=a8297c3461718f2d9afc7a2f8ca620d320ac5f97;hpb=180d764223a3568f734434a15d56f18e9ddc012b diff --git a/src/document.cpp b/src/document.cpp index d01e075..aff9a23 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1,5 +1,6 @@ #include "document.h" #include "bezier.h" +#include "profiler.h" #include #include @@ -101,6 +102,7 @@ void Document::GenBaseQuadtree() int Document::ClipObjectToQuadChild(int object_id, QuadTreeNodeChildren type) { + PROFILE_SCOPE("Document::ClipObjectToQuadChild"); switch (m_objects.types[object_id]) { case RECT_FILLED: @@ -168,6 +170,7 @@ int Document::ClipObjectToQuadChild(int object_id, QuadTreeNodeChildren type) } QuadTreeIndex Document::GenQuadChild(QuadTreeIndex parent, QuadTreeNodeChildren type) { + PROFILE_SCOPE("Document::GenQuadChild()"); QuadTreeIndex new_index = m_quadtree.nodes.size(); Debug("-------------- Generating Quadtree Node %d (parent %d, type %d) ----------------------", new_index, parent, type); m_quadtree.nodes.push_back(QuadTreeNode{QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, parent, type, 0, 0, -1}); @@ -208,6 +211,7 @@ QuadTreeIndex Document::GenQuadChild(QuadTreeIndex parent, QuadTreeNodeChildren void Document::OverlayQuadChildren(QuadTreeIndex orig_parent, QuadTreeIndex parent, QuadTreeNodeChildren type) { + PROFILE_SCOPE("Document::OverlayQuadChildren()"); QuadTreeIndex new_index = m_quadtree.nodes.size(); Debug("-------------- Generating Quadtree Node %d (orig %d parent %d, type %d) ----------------------", new_index, orig_parent, parent, type); m_quadtree.nodes.push_back(QuadTreeNode{QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, QUADTREE_EMPTY, orig_parent, type, 0, 0, -1}); @@ -413,6 +417,7 @@ unsigned Document::AddBezier(const Bezier & bezier) unsigned Document::Add(ObjectType type, const Rect & bounds, unsigned data_index, QuadTreeIndex qti) { + PROFILE_SCOPE("Document::Add"); m_objects.types.push_back(type); m_objects.bounds.push_back(bounds); m_objects.data_indices.push_back(data_index); @@ -445,7 +450,7 @@ done: // matches is not amused, but sulix is nice and moved it inside the #ifdef m_count++; PropagateQuadChanges(qti); } - return m_count; + return m_count-1; #else // words fail me (still not amused) return (m_count++); #endif