mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1546894 - Fix PathBuilderCapture::CurrentPoint when closing a path. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D32459 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
58d68b812b
commit
75c8a4d940
@ -17,6 +17,7 @@ void PathBuilderCapture::MoveTo(const Point& aPoint) {
|
||||
op.mP1 = aPoint;
|
||||
mPathOps.push_back(op);
|
||||
mCurrentPoint = aPoint;
|
||||
mFirstPoint = aPoint;
|
||||
}
|
||||
|
||||
void PathBuilderCapture::LineTo(const Point& aPoint) {
|
||||
@ -48,28 +49,33 @@ void PathBuilderCapture::QuadraticBezierTo(const Point& aCP1,
|
||||
mCurrentPoint = aCP2;
|
||||
}
|
||||
|
||||
void PathBuilderCapture::Arc(const Point& aOrigin, float aRadius,
|
||||
void PathBuilderCapture::Arc(const Point& aCenter, float aRadius,
|
||||
float aStartAngle, float aEndAngle,
|
||||
bool aAntiClockwise) {
|
||||
PathOp op;
|
||||
op.mType = PathOp::OP_ARC;
|
||||
op.mP1 = aOrigin;
|
||||
op.mP1 = aCenter;
|
||||
op.mRadius = aRadius;
|
||||
op.mStartAngle = aStartAngle;
|
||||
op.mEndAngle = aEndAngle;
|
||||
op.mAntiClockwise = aAntiClockwise;
|
||||
mPathOps.push_back(op);
|
||||
mCurrentPoint = Point(aCenter.x + aRadius * cosf(aEndAngle),
|
||||
aCenter.y + aRadius * sinf(aEndAngle));
|
||||
}
|
||||
|
||||
void PathBuilderCapture::Close() {
|
||||
PathOp op;
|
||||
op.mType = PathOp::OP_CLOSE;
|
||||
mPathOps.push_back(op);
|
||||
mCurrentPoint = mFirstPoint;
|
||||
}
|
||||
|
||||
Point PathBuilderCapture::CurrentPoint() const { return mCurrentPoint; }
|
||||
|
||||
already_AddRefed<Path> PathBuilderCapture::Finish() {
|
||||
mCurrentPoint = Point(0.0, 0.0);
|
||||
mFirstPoint = Point(0.0, 0.0);
|
||||
return MakeAndAddRef<PathCapture>(std::move(mPathOps), mFillRule, mDT,
|
||||
mCurrentPoint);
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ class PathBuilderCapture : public PathBuilder {
|
||||
FillRule mFillRule;
|
||||
std::vector<PathOp> mPathOps;
|
||||
Point mCurrentPoint;
|
||||
Point mFirstPoint;
|
||||
RefPtr<DrawTarget> mDT;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user