path ops in progress

fix numeric check for cubic-to-quad conversion
to be 80-bit safe

git-svn-id: http://skia.googlecode.com/svn/trunk@8727 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
caryclark@google.com 2013-04-17 16:19:02 +00:00
parent b3f0921fba
commit 7ec5e394e7

View File

@ -254,13 +254,19 @@ static int check_quadratic(const SkDCubic& cubic, SkDCubic& reduction) {
double dx10 = cubic[1].fX - cubic[0].fX;
double dx23 = cubic[2].fX - cubic[3].fX;
double midX = cubic[0].fX + dx10 * 3 / 2;
if (!AlmostEqualUlps(midX - cubic[3].fX, dx23 * 3 / 2)) {
double sideAx = midX - cubic[3].fX;
double sideBx = dx23 * 3 / 2;
if (approximately_zero(sideAx) ? !approximately_equal(sideAx, sideBx)
: !AlmostEqualUlps(sideAx, sideBx)) {
return 0;
}
double dy10 = cubic[1].fY - cubic[0].fY;
double dy23 = cubic[2].fY - cubic[3].fY;
double midY = cubic[0].fY + dy10 * 3 / 2;
if (!AlmostEqualUlps(midY - cubic[3].fY, dy23 * 3 / 2)) {
double sideAy = midY - cubic[3].fY;
double sideBy = dy23 * 3 / 2;
if (approximately_zero(sideAy) ? !approximately_equal(sideAy, sideBy)
: !AlmostEqualUlps(sideAy, sideBy)) {
return 0;
}
reduction[0] = cubic[0];