@@ -3429,7 +3429,7 @@ private void AppendPlainStroke(
34293429 GpuSceneDrawMonoid drawTagMonoid = GpuSceneDrawTag . Map ( drawTag ) ;
34303430 Rectangle interestBounds = ToTargetLocal ( command . RasterizerOptions . Interest , this . rootTargetBounds ) ;
34313431 ( uint style0 , uint style1 , uint style2 , uint style3 , uint style4 , uint style5 , uint style6 , uint style7 , uint style8 , uint style9 ) =
3432- GetStrokeStyle ( command . GraphicsOptions , pen , widthScale , interestBounds ) ;
3432+ GetStrokeStyle ( command . GraphicsOptions , pen , widthScale , interestBounds , command . RasterizerOptions . CoverageBoost ) ;
34333433 int pathTagCheckpoint = this . PathTags . Count ;
34343434 int styleCheckpoint = this . Styles . Count ;
34353435 bool appendStyle = ! this . hasLastStyle ||
@@ -3572,7 +3572,7 @@ private void AppendExplicitStroke(
35723572 GpuSceneDrawMonoid drawTagMonoid = GpuSceneDrawTag . Map ( drawTag ) ;
35733573 Rectangle interestBounds = ToTargetLocal ( rasterizerOptions . Interest , this . rootTargetBounds ) ;
35743574 ( uint style0 , uint style1 , uint style2 , uint style3 , uint style4 , uint style5 , uint style6 , uint style7 , uint style8 , uint style9 ) =
3575- GetStrokeStyle ( graphicsOptions , pen , widthScale , interestBounds ) ;
3575+ GetStrokeStyle ( graphicsOptions , pen , widthScale , interestBounds , rasterizerOptions . CoverageBoost ) ;
35763576 int pathTagCheckpoint = this . PathTags . Count ;
35773577 int styleCheckpoint = this . Styles . Count ;
35783578 bool appendStyle = ! this . hasLastStyle ||
@@ -3711,7 +3711,7 @@ private void AppendExplicitStroke(
37113711 GpuSceneDrawMonoid drawTagMonoid = GpuSceneDrawTag . Map ( drawTag ) ;
37123712 Rectangle interestBounds = ToTargetLocal ( rasterizerOptions . Interest , this . rootTargetBounds ) ;
37133713 ( uint style0 , uint style1 , uint style2 , uint style3 , uint style4 , uint style5 , uint style6 , uint style7 , uint style8 , uint style9 ) =
3714- GetStrokeStyle ( graphicsOptions , pen , widthScale , interestBounds ) ;
3714+ GetStrokeStyle ( graphicsOptions , pen , widthScale , interestBounds , rasterizerOptions . CoverageBoost ) ;
37153715 int pathTagCheckpoint = this . PathTags . Count ;
37163716 int styleCheckpoint = this . Styles . Count ;
37173717 bool appendStyle = ! this . hasLastStyle ||
@@ -7561,17 +7561,9 @@ private static int EncodeStrokePath(
75617561
75627562 int segmentCount = keptCount - 1 ;
75637563
7564- // Match the CPU closure rule. A contour with at least three source points is closed
7565- // when it is declared closed or its endpoints are within one scaled stroke width.
7566- bool isClosed = false ;
7567- if ( contourPoints . Length >= 3 )
7568- {
7569- PointF last = contourPoints [ ^ 1 ] ;
7570- float closeThreshold = MathF . Max ( strokeWidth , 1E-3F ) ;
7571- isClosed = contour . IsClosed ||
7572- firstPoint == last ||
7573- Vector2 . DistanceSquared ( firstPoint , last ) <= closeThreshold * closeThreshold ;
7574- }
7564+ // An open path with a gap needs caps, even when the gap is shorter than the stroke width.
7565+ bool isClosed = contourPoints . Length >= 3 &&
7566+ ( contour . IsClosed || firstPoint == contourPoints [ ^ 1 ] ) ;
75757567
75767568 bool duplicateClosingPoint = keptCount > 1 && lastKept == firstPoint ;
75777569 int distinctPointCount = keptCount - ( isClosed && duplicateClosingPoint ? 1 : 0 ) ;
@@ -8774,9 +8766,8 @@ private static void AppendIdentityTransform(ref OwnedStream<uint> transforms)
87748766 /// </summary>
87758767 /// <remarks>
87768768 /// Word layout consumed by path_lowering.wgsl: 0 = style flags, 1 = device-space stroke width,
8777- /// 2 = packed draw flags, 3 = miter limit, 4 = arc detail scale, 5 = zero ,
8769+ /// 2 = packed draw flags, 3 = miter limit, 4 = arc detail scale, 5 = coverage boost ,
87788770 /// 6-9 = target-local interest rectangle as left, top, right, bottom.
8779- /// Strokes do not use antialiased text coverage boost data, so word 5 is zero in both modes.
87808771 /// <para>
87818772 /// Bits 0-10 of word 0 hold the arc limit: the interior vertex count of a round arc of
87828773 /// half a turn, from <see cref="GetStrokeArcLineCost"/>. The shader clamps the vertex count of
@@ -8789,6 +8780,7 @@ private static void AppendIdentityTransform(ref OwnedStream<uint> transforms)
87898780 /// <param name="pen">The pen that defines stroke width, joins, caps, and miter limit.</param>
87908781 /// <param name="widthScale">The transform-derived scale applied to the stroke width.</param>
87918782 /// <param name="interestBounds">The target-local raster interest bounds.</param>
8783+ /// <param name="coverageBoost">The coverage boost for antialiased text strokes.</param>
87928784 /// <returns>The ten packed style words.</returns>
87938785 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
87948786 private static (
@@ -8805,7 +8797,8 @@ private static (
88058797 GraphicsOptions options ,
88068798 Pen pen ,
88078799 float widthScale ,
8808- Rectangle interestBounds )
8800+ Rectangle interestBounds ,
8801+ float coverageBoost )
88098802 {
88108803 StyleFlags styleFlags = StyleFlags . Stroke
88118804 | EncodeStrokeJoinFlags ( pen . StrokeOptions . LineJoin )
@@ -8825,7 +8818,7 @@ private static (
88258818 PackStyleDrawFlags ( options ) ,
88268819 BitcastSingle ( ( float ) pen . StrokeOptions . MiterLimit ) ,
88278820 BitcastSingle ( ( float ) pen . StrokeOptions . ArcDetailScale ) ,
8828- 0U ,
8821+ options . Antialias ? BitcastSingle ( coverageBoost ) : 0U ,
88298822 BitcastSingle ( interestBounds . Left ) ,
88308823 BitcastSingle ( interestBounds . Top ) ,
88318824 BitcastSingle ( interestBounds . Right ) ,
0 commit comments