Skip to content

Commit b060ce8

Browse files
Merge branch 'dev'
2 parents 1c13a21 + 2d7dd24 commit b060ce8

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

library/src/main/java/com/opensource/svgaplayer/utils/BitmapUtils.kt renamed to library/src/main/java/com/opensource/svgaplayer/bitmap/BitmapSampleSizeCalculator.kt

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
package com.opensource.svgaplayer.utils
1+
package com.opensource.svgaplayer.bitmap
22

33
import android.graphics.BitmapFactory
4-
import android.util.Log
54

65
/**
76
*
87
* Create by im_dsd 2020/7/7 17:59
98
*/
10-
internal object BitmapUtils {
9+
internal object BitmapSampleSizeCalculator {
1110

12-
fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int {
11+
fun calculate(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int {
1312
// Raw height and width of image
1413
val (height: Int, width: Int) = options.run { outHeight to outWidth }
1514
var inSampleSize = 1
16-
Log.d("##SVGA","## calculateInSampleSize $reqWidth $reqHeight $width $height")
1715

1816
if (reqHeight <= 0 || reqWidth <= 0) {
1917
return inSampleSize

library/src/main/java/com/opensource/svgaplayer/bitmap/SVGABitmapDecoder.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package com.opensource.svgaplayer.bitmap
22

33
import android.graphics.Bitmap
44
import android.graphics.BitmapFactory
5-
import android.util.Log
6-
import com.opensource.svgaplayer.utils.BitmapUtils
75

86
/**
97
* Bitmap 解码器
@@ -26,8 +24,7 @@ internal abstract class SVGABitmapDecoder<T> {
2624
}
2725

2826
// Calculate inSampleSize
29-
inSampleSize = BitmapUtils.calculateInSampleSize(this, reqWidth, reqHeight)
30-
Log.d("##SVGA","## SVGABitmapDecoder inSampleSize $inSampleSize")
27+
inSampleSize = BitmapSampleSizeCalculator.calculate(this, reqWidth, reqHeight)
3128
// Decode bitmap with inSampleSize set
3229
inJustDecodeBounds = false
3330
onDecode(data, this)

0 commit comments

Comments
 (0)