Skip to content

Commit bedc91d

Browse files
committed
Merge remote-tracking branch 'origin/master' into 1.5.0
# Conflicts: # library/src/main/java/com/opensource/svgaplayer/SVGAVideoShapeEntity.kt
2 parents 988102e + 2d3f245 commit bedc91d

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

library/src/main/java/com/opensource/svgaplayer/SVGACanvasDrawer.kt

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
176176
sharedContentTransform.preConcat(sprite.frameEntity.transform)
177177
sprite.frameEntity.shapes.forEach { shape ->
178178
sharedPath.reset()
179+
shape.buildPath()
179180
shape.shapePath?.let {
180181
sharedPath.addPath(it)
181182
}

library/src/main/java/com/opensource/svgaplayer/SVGAVideoShapeEntity.kt

+13-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import java.util.HashMap
1717
* Created by cuiminghui on 2017/2/22.
1818
*/
1919

20+
val sharedPath = Path()
21+
2022
class SVGAVideoShapeEntity {
2123

2224
enum class Type {
@@ -76,7 +78,6 @@ class SVGAVideoShapeEntity {
7678
parseArgs(obj)
7779
parseStyles(obj)
7880
parseTransform(obj)
79-
buildPath()
8081
}
8182

8283
val isKeep: Boolean
@@ -247,11 +248,15 @@ class SVGAVideoShapeEntity {
247248
}
248249
}
249250

250-
private fun buildPath() {
251-
val aPath = Path()
251+
252+
fun buildPath() {
253+
if (this.shapePath != null) {
254+
return
255+
}
256+
sharedPath.reset()
252257
if (this.type == SVGAVideoShapeEntity.Type.shape) {
253258
(this.args?.get("d") as? String)?.let {
254-
SVGAPath(it).buildPath(aPath)
259+
SVGAPath(it).buildPath(sharedPath)
255260
}
256261
}
257262
else if (this.type == SVGAVideoShapeEntity.Type.ellipse) {
@@ -263,7 +268,7 @@ class SVGAVideoShapeEntity {
263268
val y = yv.toFloat()
264269
val rx = rxv.toFloat()
265270
val ry = ryv.toFloat()
266-
aPath.addOval(RectF(x - rx, y - ry, x + rx, y + ry), Path.Direction.CW)
271+
sharedPath.addOval(RectF(x - rx, y - ry, x + rx, y + ry), Path.Direction.CW)
267272
}
268273
else if (this.type == SVGAVideoShapeEntity.Type.rect) {
269274
val xv = this.args?.get("x") as? Number ?: return
@@ -276,9 +281,10 @@ class SVGAVideoShapeEntity {
276281
val width = wv.toFloat()
277282
val height = hv.toFloat()
278283
val cornerRadius = crv.toFloat()
279-
aPath.addRoundRect(RectF(x, y, x + width, y + height), cornerRadius, cornerRadius, Path.Direction.CW)
284+
sharedPath.addRoundRect(RectF(x, y, x + width, y + height), cornerRadius, cornerRadius, Path.Direction.CW)
280285
}
281-
this.shapePath = aPath
286+
this.shapePath = Path()
287+
this.shapePath?.addPath(sharedPath)
282288
}
283289

284290
}

readme.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# SVGAPlayer
22

3+
[![](https://jitpack.io/v/yyued/SVGAPlayer-Android.svg)](https://jitpack.io/#yyued/SVGAPlayer-Android)
4+
35
## Version
46

57
### 2.0.0
@@ -39,7 +41,7 @@ allprojects {
3941

4042
add dependency to build.gradle (Final Release https://jitpack.io/#yyued/SVGAPlayer-Android/ )
4143
```
42-
compile 'com.github.yyued:SVGAPlayer-Android:1.2.7'
44+
compile 'com.github.yyued:SVGAPlayer-Android:1.2.10'
4345
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.1"
4446
```
4547

0 commit comments

Comments
 (0)