Skip to content

Commit

Permalink
Disable StaticImageDecoder if ExifOrientationPolicy is IGNORE. (#1992)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite authored Jan 2, 2024
1 parent 4790263 commit 76746e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion coil-core/src/androidMain/kotlin/coil3/RealImageLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package coil3

import android.os.Build.VERSION.SDK_INT
import coil3.decode.BitmapFactoryDecoder
import coil3.decode.ExifOrientationPolicy.IGNORE
import coil3.decode.StaticImageDecoderDecoder
import coil3.fetch.AssetUriFetcher
import coil3.fetch.BitmapFetcher
Expand Down Expand Up @@ -85,7 +86,7 @@ internal actual fun ComponentRegistry.Builder.addAndroidComponents(
.apply {
// Require API 29 for ImageDecoder support as API 28 has framework bugs:
// https://github.com/element-hq/element-android/pull/7184
if (SDK_INT >= 29) {
if (SDK_INT >= 29 && options.bitmapFactoryExifOrientationPolicy != IGNORE) {
add(
StaticImageDecoderDecoder.Factory(
maxParallelism = options.bitmapFactoryMaxParallelism,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package coil3.decode

import coil3.ImageLoader
import coil3.bitmapFactoryExifOrientationPolicy

/**
* Specifies the policy for handling the EXIF orientation flag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import coil3.annotation.ExperimentalCoilApi
import java.nio.ByteBuffer

/**
* Metadata containing the [bytebuffer] of a ByteBuffer, maybe direct
* Metadata containing the underlying [ByteBuffer] of the [ImageSource].
*/
@ExperimentalCoilApi
class ByteBufferMetadata(
val byteBuffer: ByteBuffer
val byteBuffer: ByteBuffer,
) : ImageSource.Metadata()

0 comments on commit 76746e4

Please sign in to comment.