Skip to content

Commit

Permalink
Allow decimals for precomp size (#2138)
Browse files Browse the repository at this point in the history
Fixes #2121
  • Loading branch information
gpeal committed Oct 2, 2022
1 parent 108b1be commit 7275e64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lottie/src/main/java/com/airbnb/lottie/model/layer/Layer.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public enum MatteType {
private final int solidColor;
private final float timeStretch;
private final float startFrame;
private final int preCompWidth;
private final int preCompHeight;
private final float preCompWidth;
private final float preCompHeight;
@Nullable private final AnimatableTextFrame text;
@Nullable private final AnimatableTextProperties textProperties;
@Nullable private final AnimatableFloatValue timeRemapping;
Expand All @@ -65,7 +65,7 @@ public enum MatteType {
public Layer(List<ContentModel> shapes, LottieComposition composition, String layerName, long layerId,
LayerType layerType, long parentId, @Nullable String refId, List<Mask> masks,
AnimatableTransform transform, int solidWidth, int solidHeight, int solidColor,
float timeStretch, float startFrame, int preCompWidth, int preCompHeight,
float timeStretch, float startFrame, float preCompWidth, float preCompHeight,
@Nullable AnimatableTextFrame text, @Nullable AnimatableTextProperties textProperties,
List<Keyframe<Float>> inOutKeyframes, MatteType matteType,
@Nullable AnimatableFloatValue timeRemapping, boolean hidden, @Nullable BlurEffect blurEffect,
Expand Down Expand Up @@ -124,11 +124,11 @@ String getName() {
return refId;
}

int getPreCompWidth() {
float getPreCompWidth() {
return preCompWidth;
}

int getPreCompHeight() {
float getPreCompHeight() {
return preCompHeight;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static Layer parse(JsonReader reader, LottieComposition composition) thro
int solidWidth = 0;
int solidHeight = 0;
int solidColor = 0;
int preCompWidth = 0;
int preCompHeight = 0;
float preCompWidth = 0;
float preCompHeight = 0;
long parentId = -1;
float timeStretch = 1f;
float startFrame = 0f;
Expand Down Expand Up @@ -236,10 +236,10 @@ public static Layer parse(JsonReader reader, LottieComposition composition) thro
startFrame = (float) reader.nextDouble();
break;
case 16:
preCompWidth = (int) (reader.nextInt() * Utils.dpScale());
preCompWidth = (float) (reader.nextDouble() * Utils.dpScale());
break;
case 17:
preCompHeight = (int) (reader.nextInt() * Utils.dpScale());
preCompHeight = (float) (reader.nextDouble() * Utils.dpScale());
break;
case 18:
inFrame = (float) reader.nextDouble();
Expand Down

Large diffs are not rendered by default.

0 comments on commit 7275e64

Please sign in to comment.