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

Commit

Permalink
fix: Stroke width scale.
Browse files Browse the repository at this point in the history
  • Loading branch information
errnull committed May 9, 2019
1 parent fd8ba9f commit 0038e5d
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
}
}

private val tValues = FloatArray(16)
private val matrixScaleTempValues = FloatArray(16)

private fun requestScale(): Float {
this.sharedFrameMatrix.getValues(tValues)
if (tValues[0] == 0f) {
this.sharedFrameMatrix.getValues(matrixScaleTempValues)
if (matrixScaleTempValues[0] == 0f) {
return 0f
}
var A = tValues[0].toDouble()
var B = tValues[3].toDouble()
var C = tValues[1].toDouble()
var D = tValues[4].toDouble()
var A = matrixScaleTempValues[0].toDouble()
var B = matrixScaleTempValues[3].toDouble()
var C = matrixScaleTempValues[1].toDouble()
var D = matrixScaleTempValues[4].toDouble()
if (A * D == B * C) return 0f
var scaleX = Math.sqrt(A * A + B * B)
A /= scaleX
Expand All @@ -222,7 +222,7 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
if ( A * D < B * C ) {
scaleX = -scaleX
}
return if (scaleEntity.ratioX) scaleEntity.ratio / Math.abs(scaleX.toFloat()) else scaleEntity.ratio / Math.abs(scaleY.toFloat())
return if (scaleEntity.ratioX) Math.abs(scaleX.toFloat()) else Math.abs(scaleY.toFloat())
}

private fun resetShapeStrokePaint(shape: SVGAVideoShapeEntity) {
Expand Down

0 comments on commit 0038e5d

Please sign in to comment.