зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1297427 - Use calculate curve origin instead of reusing center curve origin in DottedCornerFinder. r=bas
This commit is contained in:
Родитель
1989131fea
Коммит
d4bbac96b5
|
@ -329,6 +329,9 @@ CalculateDistanceToEllipticArc(const Point& P, const Point& normal,
|
|||
Float n1 = (- B + S) / A;
|
||||
Float n2 = (- B - S) / A;
|
||||
|
||||
MOZ_ASSERT(n1 >= 0);
|
||||
MOZ_ASSERT(n2 >= 0);
|
||||
|
||||
return n1 < n2 ? n1 : n2;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ DottedCornerFinder::DottedCornerFinder(const Bezier& aOuterBezier,
|
|||
mNormalSign((aCorner == C_TL || aCorner == C_BR) ? -1.0f : 1.0f),
|
||||
mC0(aC0), mCn(aCn),
|
||||
mR0(aR0), mRn(aRn), mMaxR(std::max(aR0, aRn)),
|
||||
mCurveOrigin(mC0.x, mCn.y),
|
||||
mCenterCurveOrigin(mC0.x, mCn.y),
|
||||
mInnerCurveOrigin(mInnerBezier.mPoints[0].x, mInnerBezier.mPoints[3].y),
|
||||
mBestOverlap(0.0f),
|
||||
mHasZeroBorderWidth(false), mHasMore(true),
|
||||
mMaxCount(aCornerDim.width + aCornerDim.height),
|
||||
|
@ -185,8 +186,8 @@ DottedCornerFinder::Next(void)
|
|||
phi = M_PI / 2.0f + phi;
|
||||
}
|
||||
|
||||
Point C(mCurveOrigin.x + mCenterCurveR * cos(phi),
|
||||
mCurveOrigin.y + mCenterCurveR * sin(phi));
|
||||
Point C(mCenterCurveOrigin.x + mCenterCurveR * cos(phi),
|
||||
mCenterCurveOrigin.y + mCenterCurveR * sin(phi));
|
||||
return DottedCornerFinder::Result(C, mR0);
|
||||
}
|
||||
|
||||
|
@ -288,7 +289,7 @@ DottedCornerFinder::FindNext(Float overlap)
|
|||
}
|
||||
|
||||
Point normal = PointRotateCCW90(Diff / DiffLength) * (-mNormalSign);
|
||||
r = CalculateDistanceToEllipticArc(C, normal, mCurveOrigin,
|
||||
r = CalculateDistanceToEllipticArc(C, normal, mInnerCurveOrigin,
|
||||
mInnerWidth, mInnerHeight);
|
||||
|
||||
// Check overlap along arc.
|
||||
|
|
|
@ -57,7 +57,9 @@ public:
|
|||
|
||||
Result(const Point& aC, Float aR)
|
||||
: C(aC), r(aR)
|
||||
{}
|
||||
{
|
||||
MOZ_ASSERT(aR >= 0);
|
||||
}
|
||||
};
|
||||
|
||||
// aBorderRadiusX
|
||||
|
@ -189,11 +191,12 @@ private:
|
|||
Float mMaxR;
|
||||
|
||||
// Parameters for the center curve with perfect circle and the inner curve.
|
||||
// The center curve doesn't necessarily share the origin with others.
|
||||
//
|
||||
// ___---+
|
||||
// __-- |
|
||||
// _- |
|
||||
// / __---+
|
||||
// / __-+ |
|
||||
// / __-- |
|
||||
// | / |
|
||||
// | / __--+--
|
||||
|
@ -203,18 +206,39 @@ private:
|
|||
// | | | | |
|
||||
// | | | | | mInnerHeight
|
||||
// | | | | |
|
||||
// | | | | |
|
||||
// | | | | v
|
||||
// +----+----+---------+
|
||||
// | | | mCurveOrigin
|
||||
// | |<------->|
|
||||
// | mInnerWidth |
|
||||
// | |
|
||||
// |<------------>|
|
||||
// mCenterCurveR
|
||||
// | + | | |
|
||||
// | | | v
|
||||
// +---------+---------+
|
||||
// | | mInnerCurveOrigin
|
||||
// |<------->|
|
||||
// mInnerWidth
|
||||
//
|
||||
Point mCurveOrigin;
|
||||
// ___---+
|
||||
// __--
|
||||
// _-
|
||||
// / __-+
|
||||
// / __-- |
|
||||
// | / |
|
||||
// | / __--+
|
||||
// | | _- |
|
||||
// | | / |
|
||||
// | | / |
|
||||
// | | | |
|
||||
// | | | |
|
||||
// | | | |
|
||||
// | +--- | ------+
|
||||
// | | | | mCenterCurveOrigin
|
||||
// + | + |
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// |<---------->|
|
||||
// mCenterCurveR
|
||||
//
|
||||
Point mCenterCurveOrigin;
|
||||
Float mCenterCurveR;
|
||||
Point mInnerCurveOrigin;
|
||||
Float mInnerWidth;
|
||||
Float mInnerHeight;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче