[skip ci]: Remove unnecessary center point calculation code to simplify bitmap transformation logic

This commit is contained in:
ShirkNeko
2025-05-05 19:18:35 +08:00
parent ec86f5caf2
commit 349ca36d4e

View File

@@ -63,10 +63,6 @@ fun Context.applyTransformationToBitmap(bitmap: Bitmap, transformation: Backgrou
val safeScale = maxOf(0.1f, transformation.scale) val safeScale = maxOf(0.1f, transformation.scale)
matrix.postScale(safeScale, safeScale) matrix.postScale(safeScale, safeScale)
// 计算中心点
val centerX = targetWidth / 2f
val centerY = targetHeight / 2f
// 计算偏移量,确保不会出现负最大值的问题 // 计算偏移量,确保不会出现负最大值的问题
val widthDiff = (bitmap.width * safeScale - targetWidth) val widthDiff = (bitmap.width * safeScale - targetWidth)
val heightDiff = (bitmap.height * safeScale - targetHeight) val heightDiff = (bitmap.height * safeScale - targetHeight)