Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Nov 11, 2024
1 parent 6ed462e commit d2ee980
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
15 changes: 8 additions & 7 deletions coil-gif/src/main/java/coil3/gif/AnimatedImageDecoder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ class AnimatedImageDecoder(
var isSampled = false

val drawable = runInterruptible {
maybeWrapImageSourceToRewriteFrameDelay(source, enforceMinimumFrameDelay).use { source ->
maybeWrapImageSourceToRewriteFrameDelay(
source,
enforceMinimumFrameDelay,
).use { source ->
val imageSource = source.toImageDecoderSourceOrNull(options, animated = true)
?: ImageDecoder.createSource(source.source().use { it.squashToDirectByteBuffer() })
?: ImageDecoder.createSource(
source.source().use { it.squashToDirectByteBuffer() },
)
imageSource.decodeDrawable { info, _ ->
// Configure the output image's size.
val (srcWidth, srcHeight) = info.size
Expand Down Expand Up @@ -164,11 +169,7 @@ class AnimatedImageDecoder(
}

companion object {
/**
* Pass this to [ImageRequest.Builder.repeatCount] to repeat according to encoded LoopCount metadata.
* This only applies when using [AnimatedImageDecoder].
*/
@RequiresApi(28)
/** Pass this to [ImageRequest.Builder.repeatCount] to repeat according to encoded LoopCount metadata. */
const val ENCODED_LOOP_COUNT = -2
}
}
1 change: 0 additions & 1 deletion coil-gif/src/main/java/coil3/gif/GifDecoder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package coil3.gif

import android.graphics.Bitmap
import android.graphics.Movie
import android.os.Build
import coil3.ImageLoader
import coil3.asImage
import coil3.decode.DecodeResult
Expand Down
5 changes: 2 additions & 3 deletions coil-gif/src/main/java/coil3/gif/MovieDrawable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import android.graphics.PorterDuff
import android.graphics.Rect
import android.graphics.drawable.AnimatedImageDrawable
import android.graphics.drawable.Drawable
import android.os.Build.VERSION.SDK_INT
import android.os.SystemClock
import androidx.annotation.RequiresApi
import androidx.core.graphics.createBitmap
import androidx.core.graphics.withSave
import androidx.vectordrawable.graphics.drawable.Animatable2Compat
Expand Down Expand Up @@ -195,7 +193,8 @@ class MovieDrawable @JvmOverloads constructor(
@Suppress("DEPRECATION")
override fun getOpacity(): Int {
return if (paint.alpha == 255 &&
(pixelOpacity == OPAQUE || (pixelOpacity == UNCHANGED && movie.isOpaque))) {
(pixelOpacity == OPAQUE || (pixelOpacity == UNCHANGED && movie.isOpaque))
) {
PixelFormat.OPAQUE
} else {
PixelFormat.TRANSLUCENT
Expand Down

0 comments on commit d2ee980

Please sign in to comment.