minor fix
This commit is contained in:
parent
a4c6a82b4f
commit
e8b46b02d8
1 changed files with 15 additions and 13 deletions
|
@ -19,12 +19,13 @@ class TiffRegionFetcher internal constructor(
|
|||
result: MethodChannel.Result,
|
||||
) {
|
||||
try {
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
val fd = context.contentResolver.openFileDescriptor(uri, "r")?.detachFd()
|
||||
if (fd == null) {
|
||||
val pfd = context.contentResolver.openFileDescriptor(uri, "r")
|
||||
if (pfd == null) {
|
||||
result.error("getRegion-tiff-fd", "failed to get file descriptor for uri=$uri", null)
|
||||
return
|
||||
}
|
||||
pfd.use {
|
||||
val fd = pfd.detachFd()
|
||||
val options = TiffBitmapFactory.Options().apply {
|
||||
inDirectoryNumber = page
|
||||
inSampleSize = sampleSize
|
||||
|
@ -36,6 +37,7 @@ class TiffRegionFetcher internal constructor(
|
|||
} else {
|
||||
result.error("getRegion-tiff-null", "failed to decode region for uri=$uri page=$page regionRect=$regionRect", null)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
result.error("getRegion-tiff-read-exception", "failed to read from uri=$uri page=$page regionRect=$regionRect", e.message)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue