From: David Gow Date: Tue, 5 Aug 2014 15:10:28 +0000 (+0800) Subject: Fix Bézier CPU rendering. X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=b85533b9da0dc3f6cdf8e329250518d4ac82e434;p=ipdf%2Fcode.git Fix Bézier CPU rendering. --- diff --git a/src/bezier.h b/src/bezier.h index 5a0015e..3a8e80d 100644 --- a/src/bezier.h +++ b/src/bezier.h @@ -23,12 +23,20 @@ namespace IPDF s << "Bezier{" << Float(x0) << "," << Float(y0) << " -> " << Float(x1) << "," << Float(y1) << " -> " << Float(x2) << "," << Float(y2) << "}"; return s.str(); } - Bezier(const Bezier & cpy, const Rect & t = Rect(0,0,1,1)) : x0(cpy.x0+t.x), y0(cpy.y0+t.y), x1(cpy.x1+t.x), y1(cpy.y1+t.y), x2(cpy.x2+t.x),y2(cpy.y2+t.y) + Bezier(const Bezier & cpy, const Rect & t = Rect(0,0,1,1)) : x0(cpy.x0), y0(cpy.y0), x1(cpy.x1), y1(cpy.y1), x2(cpy.x2),y2(cpy.y2) { - x1 = x0 + (x1-x0)*t.w; - y1 = y0 + (y1-y0)*t.h; - x2 = x0 + (x2-x0)*t.w; - y2 = y0 + (y2-y0)*t.h; + x0 *= t.w; + y0 *= t.h; + x1 *= t.w; + y1 *= t.h; + x2 *= t.w; + y2 *= t.h; + x0 += t.x; + y0 += t.y; + x1 += t.x; + y1 += t.y; + x2 += t.x; + y2 += t.y; } Rect ToRect() {return Rect(x0,y0,x2-x0,y2-y0);}