Skip to content

Commit b84ab21

Browse files
authored
Merge pull request svga#35 from andyliumstar/master
Update SVGACanvasDrawer.kt
2 parents b6050c8 + 5653e7b commit b84ab21

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

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

+8-11
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,7 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
118118
shape.shapePath?.let {
119119
sharedPath.addPath(it)
120120
}
121-
if (!sharedPath.isEmpty) {
122-
val thisTransform = Matrix()
123-
shape.transform?.let {
124-
thisTransform.postConcat(it)
125-
}
126-
thisTransform.postConcat(sharedContentTransform)
121+
if (!sharedPath.isEmpty) {
127122
sharedPath.transform(sharedContentTransform)
128123
sharedPaint.reset()
129124
sharedPaint.isAntiAlias = videoItem.antiAlias
@@ -195,8 +190,10 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
195190
shape.styles?.stroke?.let {
196191
sharedPaint.color = it
197192
}
193+
194+
val scale = requestScale()
198195
shape.styles?.strokeWidth?.let {
199-
sharedPaint.strokeWidth = it * requestScale()
196+
sharedPaint.strokeWidth = it * scale
200197
}
201198
shape.styles?.lineCap?.let {
202199
when {
@@ -213,14 +210,14 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
213210
}
214211
}
215212
shape.styles?.miterLimit?.let {
216-
sharedPaint.strokeMiter = it.toFloat() * requestScale()
213+
sharedPaint.strokeMiter = it.toFloat() * scale
217214
}
218215
shape.styles?.lineDash?.let {
219216
if (it.size == 3 && it[0] > 0 && it[1] > 0) {
220217
sharedPaint.pathEffect = DashPathEffect(floatArrayOf(
221-
(if (it[0] < 1.0f) 1.0f else it[0]) * requestScale(),
222-
(if (it[1] < 0.1f) 0.1f else it[1]) * requestScale()
223-
), it[2] * requestScale())
218+
(if (it[0] < 1.0f) 1.0f else it[0]) * scale,
219+
(if (it[1] < 0.1f) 0.1f else it[1]) * scale
220+
), it[2] * scale)
224221
}
225222
}
226223
}

0 commit comments

Comments
 (0)