X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fpath.cpp;h=0516e5bc03334ea84aa5ab4ff621f44345af8ea9;hp=251de1eeb21f450c833ea3ce156a5113440f5dc0;hb=326f04a375ce3120f7e8957e3d7cd5f296f513e3;hpb=ef0af5fd0129161a9e079bd3cd1298b53f1fe11a diff --git a/src/path.cpp b/src/path.cpp index 251de1e..0516e5b 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -54,17 +54,12 @@ Path::Path(Objects & objects, unsigned start, unsigned end, const Colour & fill, m_left = objects.beziers[objects.data_indices[left]].ToAbsolute(objects.bounds[left]).GetLeft(); m_right = objects.beziers[objects.data_indices[right]].ToAbsolute(objects.bounds[right]).GetRight(); + m_bounds = SolveBounds(objects).Convert(); #ifdef TRANSFORM_BEZIERS_TO_PATH - x = m_left.x; - y = m_top.y; - w = m_right.x - m_left.x; - h = m_bottom.y - m_top.y; - - Rect bounds = SolveBounds(objects); for (unsigned i = m_start; i <= m_end; ++i) { //Debug("Transform %s -> %s", objects.bounds[i].Str().c_str(), bounds.Str().c_str()); - objects.bounds[i] = TransformRectCoordinates(bounds, objects.bounds[i]); + objects.bounds[i] = TransformRectCoordinates(m_bounds.Convert(), objects.bounds[i]); //Debug("-> %s", objects.bounds[i].Str().c_str()); } #endif @@ -198,18 +193,12 @@ vector & Path::FillPoints(const Objects & objects, const View & view) Rect Path::SolveBounds(const Objects & objects) { - #ifdef TRANSFORM_BEZIERS_TO_PATH - return Rect(Real(x.ToDouble()), Real(y.ToDouble()), Real(w.ToDouble()), Real(h.ToDouble())); - #else - return Rect(m_left.x, m_top.y, m_right.x-m_left.x, m_bottom.y-m_top.y); - #endif + return Rect(m_left.x, m_top.y, m_right.x-m_left.x, m_bottom.y-m_top.y); } Rect & Path::GetBounds(Objects & objects) { - #ifdef TRANSFORM_BEZIERS_TO_PATH - objects.bounds[m_index] = Rect(Real(x.ToDouble()), Real(y.ToDouble()), Real(w.ToDouble()), Real(h.ToDouble())); - #endif + objects.bounds[m_index] = m_bounds.Convert(); return objects.bounds[m_index]; }