Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit 0038e5d

Browse files
committed
fix: Stroke width scale.
1 parent fd8ba9f commit 0038e5d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,17 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
197197
}
198198
}
199199

200-
private val tValues = FloatArray(16)
200+
private val matrixScaleTempValues = FloatArray(16)
201201

202202
private fun requestScale(): Float {
203-
this.sharedFrameMatrix.getValues(tValues)
204-
if (tValues[0] == 0f) {
203+
this.sharedFrameMatrix.getValues(matrixScaleTempValues)
204+
if (matrixScaleTempValues[0] == 0f) {
205205
return 0f
206206
}
207-
var A = tValues[0].toDouble()
208-
var B = tValues[3].toDouble()
209-
var C = tValues[1].toDouble()
210-
var D = tValues[4].toDouble()
207+
var A = matrixScaleTempValues[0].toDouble()
208+
var B = matrixScaleTempValues[3].toDouble()
209+
var C = matrixScaleTempValues[1].toDouble()
210+
var D = matrixScaleTempValues[4].toDouble()
211211
if (A * D == B * C) return 0f
212212
var scaleX = Math.sqrt(A * A + B * B)
213213
A /= scaleX
@@ -222,7 +222,7 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
222222
if ( A * D < B * C ) {
223223
scaleX = -scaleX
224224
}
225-
return if (scaleEntity.ratioX) scaleEntity.ratio / Math.abs(scaleX.toFloat()) else scaleEntity.ratio / Math.abs(scaleY.toFloat())
225+
return if (scaleEntity.ratioX) Math.abs(scaleX.toFloat()) else Math.abs(scaleY.toFloat())
226226
}
227227

228228
private fun resetShapeStrokePaint(shape: SVGAVideoShapeEntity) {

0 commit comments

Comments
 (0)