#706 lift format control for tiling, allowing large DNG tiling if supported

This commit is contained in:
Thibault Deckers 2024-01-22 20:34:49 +01:00
parent 4fada94fb6
commit da38e4a4ed
6 changed files with 5 additions and 18 deletions

View file

@ -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

View file

@ -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),
)

View file

@ -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,
) {

View file

@ -163,13 +163,4 @@ object MimeTypes {
}
val TIFF_EXTENSION_PATTERN = Regex(".*\\.tiff?", RegexOption.IGNORE_CASE)
val supportedByBitmapRegionDecoder: List<String> = 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,
)
}

View file

@ -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<String> _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<void> init() async {
@ -85,7 +82,6 @@ class Device {
_canUseCrypto = capabilities['canUseCrypto'] ?? false;
_hasGeocoder = capabilities['hasGeocoder'] ?? false;
_isDynamicColorAvailable = capabilities['isDynamicColorAvailable'] ?? false;
_regionDecodableMimeTypes = (capabilities['regionDecodableMimeTypes'] ?? []).cast<String>();
_showPinShortcutFeedback = capabilities['showPinShortcutFeedback'] ?? false;
_supportEdgeToEdgeUIMode = capabilities['supportEdgeToEdgeUIMode'] ?? false;
}

View file

@ -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);