mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 935297 - Part 3: Implement new API to allow streaming paths to arbitrary sinks on Cairo. r=mattwoodrow
This commit is contained in:
parent
681b14502b
commit
4a52b4556e
@ -236,6 +236,35 @@ PathCairo::GetStrokedBounds(const StrokeOptions &aStrokeOptions,
|
||||
return aTransform.TransformBounds(bounds);
|
||||
}
|
||||
|
||||
void
|
||||
PathCairo::StreamToSink(PathSink *aSink) const
|
||||
{
|
||||
for (size_t i = 0; i < mPathData.size(); i++) {
|
||||
switch (mPathData[i].header.type) {
|
||||
case CAIRO_PATH_MOVE_TO:
|
||||
i++;
|
||||
aSink->MoveTo(Point(mPathData[i].point.x, mPathData[i].point.y));
|
||||
break;
|
||||
case CAIRO_PATH_LINE_TO:
|
||||
i++;
|
||||
aSink->LineTo(Point(mPathData[i].point.x, mPathData[i].point.y));
|
||||
break;
|
||||
case CAIRO_PATH_CURVE_TO:
|
||||
aSink->BezierTo(Point(mPathData[i + 1].point.x, mPathData[i + 1].point.y),
|
||||
Point(mPathData[i + 2].point.x, mPathData[i + 2].point.y),
|
||||
Point(mPathData[i + 3].point.x, mPathData[i + 3].point.y));
|
||||
i += 3;
|
||||
break;
|
||||
case CAIRO_PATH_CLOSE_PATH:
|
||||
aSink->Close();
|
||||
break;
|
||||
default:
|
||||
// Corrupt path data!
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PathCairo::EnsureContainingContext() const
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
virtual Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions,
|
||||
const Matrix &aTransform = Matrix()) const;
|
||||
|
||||
virtual void StreamToSink(PathSink *aSink) const { MOZ_ASSERT(false); }
|
||||
virtual void StreamToSink(PathSink *aSink) const;
|
||||
|
||||
virtual FillRule GetFillRule() const { return mFillRule; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user