X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fdocument.cpp;h=1383906acd16d96c2b014393cf20882a4a72d527;hp=37f15e2b820deeb5265e8296654c918957f6b975;hb=a69d8466e4ad4dd92488798582e680ae31029038;hpb=7d41c1b8d1da72ef3e238f93ee7622ae9affb9de;ds=sidebyside diff --git a/src/document.cpp b/src/document.cpp index 37f15e2..1383906 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -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 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)