Skip to content

Commit 0bb4e93

Browse files
author
PonyCui
committed
Revert "feat: add 2.x proto support for matte."
This reverts commit 895edf0.
1 parent c3364e5 commit 0bb4e93

9 files changed

Lines changed: 18 additions & 47 deletions

File tree

‎app/src/main/assets/matte2.svga‎

-738 Bytes
Binary file not shown.

‎app/src/main/java/com/example/ponycui_home/svgaplayer/AnimationFromAssetsActivity.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void onClick(View view) {
3737

3838
private void loadAnimation() {
3939
SVGAParser parser = new SVGAParser(this);
40-
parser.decodeFromAssets("matte2.svga", new SVGAParser.ParseCompletion() {
40+
parser.decodeFromAssets("matte1.svga", new SVGAParser.ParseCompletion() {
4141
@Override
4242
public void onComplete(@NotNull SVGAVideoEntity videoItem) {
4343
animationView.setVideoItem(videoItem);

‎library/src/main/java/com/opensource/svgaplayer/proto/AudioEntity.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generated by Wire protocol buffer compiler, do not edit.
2-
// Source file: svga.proto at 20:1
2+
// Source file: svga.proto at 18:1
33
package com.opensource.svgaplayer.proto;
44

55
import com.squareup.wire.FieldEncoding;

‎library/src/main/java/com/opensource/svgaplayer/proto/FrameEntity.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generated by Wire protocol buffer compiler, do not edit.
2-
// Source file: svga.proto at 116:1
2+
// Source file: svga.proto at 114:1
33
package com.opensource.svgaplayer.proto;
44

55
import com.squareup.wire.FieldEncoding;

‎library/src/main/java/com/opensource/svgaplayer/proto/Layout.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generated by Wire protocol buffer compiler, do not edit.
2-
// Source file: svga.proto at 28:1
2+
// Source file: svga.proto at 26:1
33
package com.opensource.svgaplayer.proto;
44

55
import com.squareup.wire.FieldEncoding;

‎library/src/main/java/com/opensource/svgaplayer/proto/MovieEntity.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generated by Wire protocol buffer compiler, do not edit.
2-
// Source file: svga.proto at 124:1
2+
// Source file: svga.proto at 122:1
33
package com.opensource.svgaplayer.proto;
44

55
import com.squareup.wire.FieldEncoding;

‎library/src/main/java/com/opensource/svgaplayer/proto/ShapeEntity.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generated by Wire protocol buffer compiler, do not edit.
2-
// Source file: svga.proto at 44:1
2+
// Source file: svga.proto at 42:1
33
package com.opensource.svgaplayer.proto;
44

55
import com.squareup.wire.FieldEncoding;

‎library/src/main/java/com/opensource/svgaplayer/proto/SpriteEntity.java‎

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ public final class SpriteEntity extends Message<SpriteEntity, SpriteEntity.Build
2222

2323
private static final long serialVersionUID = 0L;
2424

25-
public static final String DEFAULT_MATTEKEY = "";
26-
2725
public static final String DEFAULT_IMAGEKEY = "";
2826

2927
/**
@@ -33,42 +31,31 @@ public final class SpriteEntity extends Message<SpriteEntity, SpriteEntity.Build
3331
tag = 1,
3432
adapter = "com.squareup.wire.ProtoAdapter#STRING"
3533
)
36-
public final String matteKey;
37-
38-
/**
39-
* 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。
40-
*/
41-
@WireField(
42-
tag = 2,
43-
adapter = "com.squareup.wire.ProtoAdapter#STRING"
44-
)
4534
public final String imageKey;
4635

4736
/**
4837
* 帧列表
4938
*/
5039
@WireField(
51-
tag = 3,
40+
tag = 2,
5241
adapter = "com.opensource.svgaplayer.proto.FrameEntity#ADAPTER",
5342
label = WireField.Label.REPEATED
5443
)
5544
public final List<FrameEntity> frames;
5645

57-
public SpriteEntity(String matteKey, String imageKey, List<FrameEntity> frames) {
58-
this(matteKey, imageKey, frames, ByteString.EMPTY);
46+
public SpriteEntity(String imageKey, List<FrameEntity> frames) {
47+
this(imageKey, frames, ByteString.EMPTY);
5948
}
6049

61-
public SpriteEntity(String matteKey, String imageKey, List<FrameEntity> frames, ByteString unknownFields) {
50+
public SpriteEntity(String imageKey, List<FrameEntity> frames, ByteString unknownFields) {
6251
super(ADAPTER, unknownFields);
63-
this.matteKey = matteKey;
6452
this.imageKey = imageKey;
6553
this.frames = Internal.immutableCopyOf("frames", frames);
6654
}
6755

6856
@Override
6957
public Builder newBuilder() {
7058
Builder builder = new Builder();
71-
builder.matteKey = matteKey;
7259
builder.imageKey = imageKey;
7360
builder.frames = Internal.copyOf("frames", frames);
7461
builder.addUnknownFields(unknownFields());
@@ -81,7 +68,6 @@ public boolean equals(Object other) {
8168
if (!(other instanceof SpriteEntity)) return false;
8269
SpriteEntity o = (SpriteEntity) other;
8370
return unknownFields().equals(o.unknownFields())
84-
&& Internal.equals(matteKey, o.matteKey)
8571
&& Internal.equals(imageKey, o.imageKey)
8672
&& frames.equals(o.frames);
8773
}
@@ -91,7 +77,6 @@ public int hashCode() {
9177
int result = super.hashCode;
9278
if (result == 0) {
9379
result = unknownFields().hashCode();
94-
result = result * 37 + (matteKey != null ? matteKey.hashCode() : 0);
9580
result = result * 37 + (imageKey != null ? imageKey.hashCode() : 0);
9681
result = result * 37 + frames.hashCode();
9782
super.hashCode = result;
@@ -102,15 +87,12 @@ public int hashCode() {
10287
@Override
10388
public String toString() {
10489
StringBuilder builder = new StringBuilder();
105-
if (matteKey != null) builder.append(", matteKey=").append(matteKey);
10690
if (imageKey != null) builder.append(", imageKey=").append(imageKey);
10791
if (!frames.isEmpty()) builder.append(", frames=").append(frames);
10892
return builder.replace(0, 2, "SpriteEntity{").append('}').toString();
10993
}
11094

11195
public static final class Builder extends Message.Builder<SpriteEntity, Builder> {
112-
public String matteKey;
113-
11496
public String imageKey;
11597

11698
public List<FrameEntity> frames;
@@ -122,14 +104,6 @@ public Builder() {
122104
/**
123105
* 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层。
124106
*/
125-
public Builder matteKey(String matteKey) {
126-
this.matteKey = matteKey;
127-
return this;
128-
}
129-
130-
/**
131-
* 元件所对应的位图键名, 如果 imageKey 含有 .vector 后缀,该 sprite 为矢量图层 含有 .matte 后缀,该 sprite 为遮罩图层。
132-
*/
133107
public Builder imageKey(String imageKey) {
134108
this.imageKey = imageKey;
135109
return this;
@@ -146,7 +120,7 @@ public Builder frames(List<FrameEntity> frames) {
146120

147121
@Override
148122
public SpriteEntity build() {
149-
return new SpriteEntity(matteKey, imageKey, frames, super.buildUnknownFields());
123+
return new SpriteEntity(imageKey, frames, super.buildUnknownFields());
150124
}
151125
}
152126

@@ -157,17 +131,15 @@ private static final class ProtoAdapter_SpriteEntity extends ProtoAdapter<Sprite
157131

158132
@Override
159133
public int encodedSize(SpriteEntity value) {
160-
return (value.matteKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.matteKey) : 0)
161-
+ (value.imageKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(2, value.imageKey) : 0)
162-
+ FrameEntity.ADAPTER.asRepeated().encodedSizeWithTag(3, value.frames)
134+
return (value.imageKey != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.imageKey) : 0)
135+
+ FrameEntity.ADAPTER.asRepeated().encodedSizeWithTag(2, value.frames)
163136
+ value.unknownFields().size();
164137
}
165138

166139
@Override
167140
public void encode(ProtoWriter writer, SpriteEntity value) throws IOException {
168-
if (value.matteKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.matteKey);
169-
if (value.imageKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 2, value.imageKey);
170-
FrameEntity.ADAPTER.asRepeated().encodeWithTag(writer, 3, value.frames);
141+
if (value.imageKey != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.imageKey);
142+
FrameEntity.ADAPTER.asRepeated().encodeWithTag(writer, 2, value.frames);
171143
writer.writeBytes(value.unknownFields());
172144
}
173145

@@ -177,9 +149,8 @@ public SpriteEntity decode(ProtoReader reader) throws IOException {
177149
long token = reader.beginMessage();
178150
for (int tag; (tag = reader.nextTag()) != -1;) {
179151
switch (tag) {
180-
case 1: builder.matteKey(ProtoAdapter.STRING.decode(reader)); break;
181-
case 2: builder.imageKey(ProtoAdapter.STRING.decode(reader)); break;
182-
case 3: builder.frames.add(FrameEntity.ADAPTER.decode(reader)); break;
152+
case 1: builder.imageKey(ProtoAdapter.STRING.decode(reader)); break;
153+
case 2: builder.frames.add(FrameEntity.ADAPTER.decode(reader)); break;
183154
default: {
184155
FieldEncoding fieldEncoding = reader.peekFieldEncoding();
185156
Object value = fieldEncoding.rawProtoAdapter().decode(reader);

‎library/src/main/java/com/opensource/svgaplayer/proto/Transform.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Code generated by Wire protocol buffer compiler, do not edit.
2-
// Source file: svga.proto at 35:1
2+
// Source file: svga.proto at 33:1
33
package com.opensource.svgaplayer.proto;
44

55
import com.squareup.wire.FieldEncoding;

0 commit comments

Comments
 (0)