From: Daniel Oberländer Date: Thu, 29 May 2014 19:37:54 +0000 (+0200) Subject: Fix EllipseShape for Affectors in QtQuick.Particle X-Git-Tag: upstream/5.3.1~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7eb4e701dd361f58edcdf9a74770938d6ffa75b0;p=platform%2Fupstream%2Fqtdeclarative.git Fix EllipseShape for Affectors in QtQuick.Particle EllipseShape was theated like rectangles if set as shape in an Affector due to an unimplemented containment check (was marked as TODO in source code). This fix implements the missing check. Change-Id: I8df1406f147c56e799531fccf4963110c9fdd8ef Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp index f4374d8..6016d59 100644 --- a/src/particles/qquickellipseextruder.cpp +++ b/src/particles/qquickellipseextruder.cpp @@ -82,7 +82,13 @@ QPointF QQuickEllipseExtruder::extrude(const QRectF & r) bool QQuickEllipseExtruder::contains(const QRectF &bounds, const QPointF &point) { - return bounds.contains(point);//TODO: Ellipse + if (!bounds.contains(point)) + return false; + + QPointF relPoint(bounds.center() - point); + qreal xa = relPoint.x()/bounds.width(); + qreal yb = relPoint.y()/bounds.height(); + return (xa * xa + yb * yb) < 0.25; } QT_END_NAMESPACE