From b85533b9da0dc3f6cdf8e329250518d4ac82e434 Mon Sep 17 00:00:00 2001 From: David Gow Date: Tue, 5 Aug 2014 23:10:28 +0800 Subject: [PATCH] =?utf8?q?Fix=20B=C3=A9zier=20CPU=20rendering.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/bezier.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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);} -- 2.20.1