From da38e4a4ede04d6cbda4928afb1829853722220c Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Mon, 22 Jan 2024 20:34:49 +0100 Subject: [PATCH] #706 lift format control for tiling, allowing large DNG tiling if supported --- CHANGELOG.md | 1 + .../deckers/thibault/aves/channel/calls/DeviceHandler.kt | 1 - .../aves/channel/calls/fetchers/RegionFetcher.kt | 3 +++ .../main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt | 9 --------- lib/model/device.dart | 4 ---- lib/model/entry/extensions/props.dart | 5 +---- 6 files changed, 5 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b7b0ae7..77e140e0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Viewer: lift format control for tiling, allowing large DNG tiling if supported - Info: strip `unlocated` filter from context collection when editing location via map - Slideshow: keep playing when losing focus but app is still visible (e.g. split screen) - upgraded Flutter to stable v3.16.8 diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt index cc0fbf9bc..6693112dd 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/DeviceHandler.kt @@ -56,7 +56,6 @@ class DeviceHandler(private val context: Context) : MethodCallHandler { "canUseCrypto" to (sdkInt >= Build.VERSION_CODES.LOLLIPOP), "hasGeocoder" to Geocoder.isPresent(), "isDynamicColorAvailable" to DynamicColors.isDynamicColorAvailable(), - "regionDecodableMimeTypes" to MimeTypes.supportedByBitmapRegionDecoder, "showPinShortcutFeedback" to (sdkInt >= Build.VERSION_CODES.O), "supportEdgeToEdgeUIMode" to (sdkInt >= Build.VERSION_CODES.Q), ) diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/fetchers/RegionFetcher.kt b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/fetchers/RegionFetcher.kt index b3efb8a3c..2cf30d200 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/fetchers/RegionFetcher.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/fetchers/RegionFetcher.kt @@ -18,6 +18,9 @@ import deckers.thibault.aves.utils.StorageUtils import io.flutter.plugin.common.MethodChannel import kotlin.math.roundToInt +// As of Android 14 (API 34), `BitmapRegionDecoder` documentation states +// that "only the JPEG, PNG, WebP and HEIF formats are supported" +// but in practice it successfully decodes some others. class RegionFetcher internal constructor( private val context: Context, ) { diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt b/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt index 59bce9ebb..9d219a7a2 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt @@ -163,13 +163,4 @@ object MimeTypes { } val TIFF_EXTENSION_PATTERN = Regex(".*\\.tiff?", RegexOption.IGNORE_CASE) - - val supportedByBitmapRegionDecoder: List = listOf( - // Android's `BitmapRegionDecoder` documentation states that "only the JPEG and PNG formats are supported" - // but in practice (tested on API 25, 27, 29), it successfully decodes the formats listed below, - // and it actually fails to decode GIF, DNG and animated WEBP. Other formats were not tested. - HEIC, HEIF, JPEG, PNG, WEBP, ARW, CR2, NEF, NRW, ORF, PEF, RAF, RW2, SRW, - // custom support - TIFF, - ) } diff --git a/lib/model/device.dart b/lib/model/device.dart index 8137133c4..e2c687e21 100644 --- a/lib/model/device.dart +++ b/lib/model/device.dart @@ -12,7 +12,6 @@ class Device { late final bool _canAuthenticateUser, _canGrantDirectoryAccess, _canPinShortcut; late final bool _canRenderFlagEmojis, _canRenderSubdivisionFlagEmojis, _canRequestManageMedia, _canSetLockScreenWallpaper, _canUseCrypto; late final bool _hasGeocoder, _isDynamicColorAvailable, _isTelevision, _showPinShortcutFeedback, _supportEdgeToEdgeUIMode, _supportPictureInPicture; - late final List _regionDecodableMimeTypes; String get packageName => _packageName; @@ -50,8 +49,6 @@ class Device { bool get supportPictureInPicture => _supportPictureInPicture; - bool canDecodeRegion(String mimeType) => _regionDecodableMimeTypes.contains(mimeType); - Device._private(); Future init() async { @@ -85,7 +82,6 @@ class Device { _canUseCrypto = capabilities['canUseCrypto'] ?? false; _hasGeocoder = capabilities['hasGeocoder'] ?? false; _isDynamicColorAvailable = capabilities['isDynamicColorAvailable'] ?? false; - _regionDecodableMimeTypes = (capabilities['regionDecodableMimeTypes'] ?? []).cast(); _showPinShortcutFeedback = capabilities['showPinShortcutFeedback'] ?? false; _supportEdgeToEdgeUIMode = capabilities['supportEdgeToEdgeUIMode'] ?? false; } diff --git a/lib/model/entry/extensions/props.dart b/lib/model/entry/extensions/props.dart index bdcc48fce..8953e04c7 100644 --- a/lib/model/entry/extensions/props.dart +++ b/lib/model/entry/extensions/props.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'dart:ui'; import 'package:aves/model/app/support.dart'; -import 'package:aves/model/device.dart'; import 'package:aves/model/entry/entry.dart'; import 'package:aves/model/settings/settings.dart'; import 'package:aves/model/source/trash.dart'; @@ -33,7 +32,7 @@ extension ExtraAvesEntryProps on AvesEntry { // size - bool get useTiles => canDecodeRegion && (width > 4096 || height > 4096); + bool get useTiles => (width > 4096 || height > 4096) && !isAnimated; bool get isSized => width > 0 && height > 0; @@ -128,8 +127,6 @@ extension ExtraAvesEntryProps on AvesEntry { bool get canDecode => AppSupport.canDecode(mimeType); - bool get canDecodeRegion => device.canDecodeRegion(mimeType) && !isAnimated; - bool get canEditExif => AppSupport.canEditExif(mimeType); bool get canEditIptc => AppSupport.canEditIptc(mimeType);