@@ -390,7 +390,7 @@ bool _mustRenderClip(uint clipGenId, uiRect clipBounds) {
390
390
391
391
RenderLayer _createMaskLayer ( RenderLayer parentLayer , uiRect maskBounds ,
392
392
_drawPathDrawMeshCallbackDelegate drawCallback ,
393
- uiPaint paint , bool convex , float alpha , Texture tex , uiRect texBound , TextBlobMesh textMesh ,
393
+ uiPaint paint , bool convex , float alpha , float strokeMult , Texture tex , uiRect texBound , TextBlobMesh textMesh ,
394
394
uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool notEmoji ) {
395
395
var textureWidth = Mathf . CeilToInt ( maskBounds . width * this . _devicePixelRatio ) ;
396
396
if ( textureWidth < 1 ) {
@@ -419,7 +419,7 @@ RenderLayer _createMaskLayer(RenderLayer parentLayer, uiRect maskBounds,
419
419
var maskState = maskLayer . states [ maskLayer . states . Count - 1 ] ;
420
420
maskState . matrix = parentState . matrix ;
421
421
422
- drawCallback . Invoke ( uiPaint . shapeOnly ( paint ) , fillMesh , strokeMesh , convex , alpha , tex , texBound , textMesh , notEmoji ) ;
422
+ drawCallback . Invoke ( uiPaint . shapeOnly ( paint ) , fillMesh , strokeMesh , convex , alpha , strokeMult , tex , texBound , textMesh , notEmoji ) ;
423
423
424
424
var removed = this . _layers . removeLast ( ) ;
425
425
D . assert ( removed == maskLayer ) ;
@@ -481,7 +481,7 @@ RenderLayer _createBlurLayer(RenderLayer maskLayer, float sigmaX, float sigmaY,
481
481
}
482
482
483
483
void _drawWithMaskFilter ( uiRect meshBounds , uiPaint paint , uiMaskFilter maskFilter ,
484
- uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , Texture tex , uiRect texBound , TextBlobMesh textMesh , bool notEmoji ,
484
+ uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , float strokeMult , Texture tex , uiRect texBound , TextBlobMesh textMesh , bool notEmoji ,
485
485
_drawPathDrawMeshCallbackDelegate drawCallback ) {
486
486
var layer = this . _currentLayer ;
487
487
var clipBounds = layer . layerBounds ;
@@ -514,7 +514,7 @@ void _drawWithMaskFilter(uiRect meshBounds, uiPaint paint, uiMaskFilter maskFilt
514
514
return ;
515
515
}
516
516
517
- var maskLayer = this . _createMaskLayer ( layer , maskBounds , drawCallback , paint , convex , alpha , tex , texBound ,
517
+ var maskLayer = this . _createMaskLayer ( layer , maskBounds , drawCallback , paint , convex , alpha , strokeMult , tex , texBound ,
518
518
textMesh , fillMesh , strokeMesh , notEmoji ) ;
519
519
520
520
var blurLayer = this . _createBlurLayer ( maskLayer , sigma , sigma , layer ) ;
@@ -528,10 +528,10 @@ void _drawWithMaskFilter(uiRect meshBounds, uiPaint paint, uiMaskFilter maskFilt
528
528
layer . draws . Add ( CanvasShader . texRT ( layer , paint , blurMesh , blurLayer ) ) ;
529
529
}
530
530
531
- delegate void _drawPathDrawMeshCallbackDelegate ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha ,
531
+ delegate void _drawPathDrawMeshCallbackDelegate ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , float strokeMult ,
532
532
Texture tex , uiRect textBlobBounds , TextBlobMesh textMesh , bool notEmoji ) ;
533
533
534
- void _drawPathDrawMeshCallback ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , Texture tex ,
534
+ void _drawPathDrawMeshCallback ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , float strokeMult , Texture tex ,
535
535
uiRect textBlobBounds , TextBlobMesh textMesh , bool notEmoji ) {
536
536
if ( ! this . _applyClip ( fillMesh . bounds ) ) {
537
537
ObjectPool < uiMeshMesh > . release ( fillMesh ) ;
@@ -548,11 +548,11 @@ void _drawPathDrawMeshCallback(uiPaint p, uiMeshMesh fillMesh, uiMeshMesh stroke
548
548
}
549
549
550
550
if ( strokeMesh != null ) {
551
- layer . draws . Add ( CanvasShader . strokeAlpha ( layer , p , 1.0f , strokeMesh ) ) ;
551
+ layer . draws . Add ( CanvasShader . strokeAlpha ( layer , p , strokeMult , strokeMesh ) ) ;
552
552
}
553
553
}
554
554
555
- void _drawPathDrawMeshCallback2 ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , Texture tex ,
555
+ void _drawPathDrawMeshCallback2 ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , float strokeMult , Texture tex ,
556
556
uiRect textBlobBounds , TextBlobMesh textMesh , bool notEmoji ) {
557
557
if ( ! this . _applyClip ( strokeMesh . bounds ) ) {
558
558
ObjectPool < uiMeshMesh > . release ( strokeMesh ) ;
@@ -561,11 +561,11 @@ void _drawPathDrawMeshCallback2(uiPaint p, uiMeshMesh fillMesh, uiMeshMesh strok
561
561
562
562
var layer = this . _currentLayer ;
563
563
564
- layer . draws . Add ( CanvasShader . strokeAlpha ( layer , p , alpha , strokeMesh ) ) ;
564
+ layer . draws . Add ( CanvasShader . strokeAlpha ( layer , p , strokeMult , strokeMesh ) ) ;
565
565
layer . draws . Add ( CanvasShader . stroke1 ( layer , strokeMesh . duplicate ( ) ) ) ;
566
566
}
567
567
568
- void _drawTextDrawMeshCallback ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , Texture tex ,
568
+ void _drawTextDrawMeshCallback ( uiPaint p , uiMeshMesh fillMesh , uiMeshMesh strokeMesh , bool convex , float alpha , float strokeMult , Texture tex ,
569
569
uiRect textBlobBounds , TextBlobMesh textMesh , bool notEmoji ) {
570
570
if ( ! this . _applyClip ( textBlobBounds ) ) {
571
571
ObjectPool < TextBlobMesh > . release ( textMesh ) ;
@@ -610,14 +610,15 @@ void _drawPath(uiPath path, uiPaint paint) {
610
610
var strokeMesh = cache . strokeMesh ;
611
611
var fmesh = fillMesh . transform ( state . matrix ) ;
612
612
var smesh = strokeMesh ? . transform ( state . matrix ) ;
613
+ float strokeMult = 1.0f ;
613
614
614
615
if ( paint . maskFilter != null && paint . maskFilter . Value . sigma != 0 ) {
615
- this . _drawWithMaskFilter ( fmesh . bounds , paint , paint . maskFilter . Value , fmesh , smesh , convex , 0 , null ,
616
+ this . _drawWithMaskFilter ( fmesh . bounds , paint , paint . maskFilter . Value , fmesh , smesh , convex , 0 , strokeMult , null ,
616
617
uiRectHelper . zero , null , false , this . ___drawPathDrawMeshCallback ) ;
617
618
return ;
618
619
}
619
620
620
- this . _drawPathDrawMeshCallback ( paint , fmesh , smesh , convex , 0 , null , uiRectHelper . zero , null , false ) ;
621
+ this . _drawPathDrawMeshCallback ( paint , fmesh , smesh , convex , 0 , strokeMult , null , uiRectHelper . zero , null , false ) ;
621
622
}
622
623
else {
623
624
var state = this . _currentLayer . currentState ;
@@ -635,10 +636,13 @@ void _drawPath(uiPath path, uiPaint paint) {
635
636
strokeWidth = this . _fringeWidth ;
636
637
}
637
638
639
+ strokeWidth = strokeWidth / state . scale * 0.5f ;
640
+ float strokeMult = ( this . _fringeWidth * 0.5f + strokeWidth * 0.5f ) / this . _fringeWidth ;
641
+
638
642
var cache = path . flatten ( state . scale * this . _devicePixelRatio ) ;
639
643
640
644
var strokeMesh = cache . computeStrokeMesh (
641
- strokeWidth / state . scale * 0.5f ,
645
+ strokeWidth ,
642
646
this . _fringeWidth ,
643
647
paint . strokeCap ,
644
648
paint . strokeJoin ,
@@ -647,12 +651,12 @@ void _drawPath(uiPath path, uiPaint paint) {
647
651
var mesh = strokeMesh . transform ( state . matrix ) ;
648
652
649
653
if ( paint . maskFilter != null && paint . maskFilter . Value . sigma != 0 ) {
650
- this . _drawWithMaskFilter ( mesh . bounds , paint , paint . maskFilter . Value , null , mesh , false , alpha , null ,
654
+ this . _drawWithMaskFilter ( mesh . bounds , paint , paint . maskFilter . Value , null , mesh , false , alpha , strokeMult , null ,
651
655
uiRectHelper . zero , null , false , this . ___drawPathDrawMeshCallback2 ) ;
652
656
return ;
653
657
}
654
658
655
- this . _drawPathDrawMeshCallback2 ( paint , null , mesh , false , alpha , null , uiRectHelper . zero , null , false ) ;
659
+ this . _drawPathDrawMeshCallback2 ( paint , null , mesh , false , alpha , strokeMult , null , uiRectHelper . zero , null , false ) ;
656
660
}
657
661
}
658
662
@@ -962,12 +966,12 @@ void _drawTextBlob(TextBlob textBlob, uiOffset offset, uiPaint paint) {
962
966
}
963
967
964
968
if ( paint . maskFilter != null && paint . maskFilter . Value . sigma != 0 ) {
965
- this . _drawWithMaskFilter ( textBlobBounds , paint , paint . maskFilter . Value , null , null , false , 0 , tex ,
969
+ this . _drawWithMaskFilter ( textBlobBounds , paint , paint . maskFilter . Value , null , null , false , 0 , 0 , tex ,
966
970
textBlobBounds , mesh , notEmoji , this . ___drawTextDrawMeshCallback ) ;
967
971
return ;
968
972
}
969
973
970
- this . _drawTextDrawMeshCallback ( paint , null , null , false , 0 , tex , textBlobBounds , mesh , notEmoji ) ;
974
+ this . _drawTextDrawMeshCallback ( paint , null , null , false , 0 , 0 , tex , textBlobBounds , mesh , notEmoji ) ;
971
975
}
972
976
973
977
public void flush ( uiPicture picture ) {
0 commit comments