Skip to content

Commit 0248711

Browse files
committed
Moved OriginOffset cleanup to TranslateAndApplyShapeContextWithTrimOffset
1 parent 493f9dd commit 0248711

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

source/LottieToWinComp/Rectangles.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,6 @@ static void ApplyRectangleContentCommon(
330330
rectangle.DrawingDirection == DrawingDirection.Reverse,
331331
trimOffsetDegrees: trimOffsetDegrees);
332332

333-
context.LayerContext.OriginOffset = null;
334-
335333
compositionRectangle.SetDescription(context, () => rectangle.Name);
336334
compositionRectangle.Geometry.SetDescription(context, () => $"{rectangle.Name}.RectangleGeometry");
337335
}
@@ -427,8 +425,6 @@ static void ApplyRectangleContentCommonXY(
427425
rectangle.DrawingDirection == DrawingDirection.Reverse,
428426
trimOffsetDegrees: trimOffsetDegrees);
429427

430-
context.LayerContext.OriginOffset = null;
431-
432428
compositionRectangle.SetDescription(context, () => rectangle.Name);
433429
compositionRectangle.Geometry.SetDescription(context, () => $"{rectangle.Name}.RectangleGeometry");
434430
}

source/LottieToWinComp/Shapes.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public static void TranslateAndApplyShapeContextWithTrimOffset(
4545
Debug.Assert(shape.Geometry is not null, "Precondition");
4646

4747
shape.FillBrush = Brushes.TranslateShapeFill(context, context.Fill, context.Opacity);
48+
49+
// OriginOffset is used to adjust cordinates of FillBrush for Rectangle shapes.
50+
// It is not needed afterwards, so we clean it up to not affect other code.
51+
context.LayerContext.OriginOffset = null;
52+
4853
Brushes.TranslateAndApplyStroke(context, context.Stroke, shape, context.Opacity);
4954

5055
TranslateAndApplyTrimPath(

0 commit comments

Comments
 (0)