@@ -257,8 +257,7 @@ static void ApplyCommonStrokeProperties(
257257 public static CompositionBrush ? TranslateShapeFill (
258258 LayerContext context ,
259259 ShapeFill ? shapeFill ,
260- CompositeOpacity opacity ,
261- Rectangles . OriginOffset ? originOffset )
260+ CompositeOpacity opacity )
262261 {
263262 if ( shapeFill is null )
264263 {
@@ -270,9 +269,9 @@ static void ApplyCommonStrokeProperties(
270269 ShapeFill . ShapeFillKind . SolidColor =>
271270 TranslateSolidColorFill ( context , ( SolidColorFill ) shapeFill , opacity ) ,
272271 ShapeFill . ShapeFillKind . LinearGradient =>
273- TranslateLinearGradient ( context , ( LinearGradientFill ) shapeFill , opacity , originOffset ) ,
272+ TranslateLinearGradient ( context , ( LinearGradientFill ) shapeFill , opacity ) ,
274273 ShapeFill . ShapeFillKind . RadialGradient =>
275- TranslateRadialGradient ( context , ( RadialGradientFill ) shapeFill , opacity , originOffset ) ,
274+ TranslateRadialGradient ( context , ( RadialGradientFill ) shapeFill , opacity ) ,
276275 _ => throw new InvalidOperationException ( ) ,
277276 } ;
278277 }
@@ -419,10 +418,9 @@ static CompositionColorBrush TranslateBoundSolidColor(
419418 LayerContext context ,
420419 CompositionObject obj ,
421420 string propertyName ,
422- TrimmedAnimatable < Vector2 > value ,
423- Rectangles . OriginOffset ? offset )
421+ TrimmedAnimatable < Vector2 > value )
424422 {
425- if ( offset is null )
423+ if ( context is not ShapeLayerContext || ( ( ShapeLayerContext ) context ) . OriginOffset is null )
426424 {
427425 if ( value . IsAnimated )
428426 {
@@ -435,6 +433,8 @@ static CompositionColorBrush TranslateBoundSolidColor(
435433 }
436434 }
437435
436+ var offset = ( ( ShapeLayerContext ) context ) . OriginOffset ! ;
437+
438438 if ( ! offset . IsAnimated && ! value . IsAnimated )
439439 {
440440 return ConvertTo . Vector2 ( value . InitialValue ) + offset . OffsetValue ! ;
@@ -469,8 +469,7 @@ static CompositionColorBrush TranslateBoundSolidColor(
469469 static CompositionLinearGradientBrush ? TranslateLinearGradient (
470470 LayerContext context ,
471471 IGradient linearGradient ,
472- CompositeOpacity opacity ,
473- Rectangles . OriginOffset ? originOffset = null )
472+ CompositeOpacity opacity )
474473 {
475474 var result = context . ObjectFactory . CreateLinearGradientBrush ( ) ;
476475
@@ -480,13 +479,13 @@ static CompositionColorBrush TranslateBoundSolidColor(
480479 var startPoint = Optimizer . TrimAnimatable ( context , linearGradient . StartPoint ) ;
481480 var endPoint = Optimizer . TrimAnimatable ( context , linearGradient . EndPoint ) ;
482481
483- var startPointValue = AnimateVector2WithOriginOffsetOrGetValue ( context , result , nameof ( result . StartPoint ) , startPoint , originOffset ) ;
482+ var startPointValue = AnimateVector2WithOriginOffsetOrGetValue ( context , result , nameof ( result . StartPoint ) , startPoint ) ;
484483 if ( startPointValue is not null )
485484 {
486485 result . StartPoint = startPointValue ! ;
487486 }
488487
489- var endPointValue = AnimateVector2WithOriginOffsetOrGetValue ( context , result , nameof ( result . EndPoint ) , endPoint , originOffset ) ;
488+ var endPointValue = AnimateVector2WithOriginOffsetOrGetValue ( context , result , nameof ( result . EndPoint ) , endPoint ) ;
490489 if ( endPointValue is not null )
491490 {
492491 result . EndPoint = endPointValue ! ;
@@ -508,14 +507,13 @@ static CompositionColorBrush TranslateBoundSolidColor(
508507 static CompositionGradientBrush ? TranslateRadialGradient (
509508 LayerContext context ,
510509 IRadialGradient gradient ,
511- CompositeOpacity opacity ,
512- Rectangles . OriginOffset ? originOffset = null )
510+ CompositeOpacity opacity )
513511 {
514512 if ( ! context . ObjectFactory . IsUapApiAvailable ( nameof ( CompositionRadialGradientBrush ) , versionDependentFeatureDescription : "Radial gradient fill" ) )
515513 {
516514 // CompositionRadialGradientBrush didn't exist until UAP v8. If the target OS doesn't support
517515 // UAP v8 then fall back to linear gradients as a compromise.
518- return TranslateLinearGradient ( context , gradient , opacity , originOffset ) ;
516+ return TranslateLinearGradient ( context , gradient , opacity ) ;
519517 }
520518
521519 var result = context . ObjectFactory . CreateRadialGradientBrush ( ) ;
@@ -526,7 +524,7 @@ static CompositionColorBrush TranslateBoundSolidColor(
526524 var startPoint = Optimizer . TrimAnimatable ( context , gradient . StartPoint ) ;
527525 var endPoint = Optimizer . TrimAnimatable ( context , gradient . EndPoint ) ;
528526
529- var startPointValue = AnimateVector2WithOriginOffsetOrGetValue ( context , result , nameof ( result . EllipseCenter ) , startPoint , originOffset ) ;
527+ var startPointValue = AnimateVector2WithOriginOffsetOrGetValue ( context , result , nameof ( result . EllipseCenter ) , startPoint ) ;
530528 if ( startPointValue is not null )
531529 {
532530 result . EllipseCenter = startPointValue ! ;
0 commit comments