Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerst committed Dec 24, 2023
2 parents 32fff62 + f76c45e commit 7cd170b
Show file tree
Hide file tree
Showing 21 changed files with 178 additions and 132 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

## <a id="unreleased"></a>[Unreleased]

## <a id="v1.10.2"></a>[v1.10.2] - 2023-12-24

### Changed

- Viewer: keep controls in the lower right corner even with RTL locales

### Fixed

- crash when loading SVG defined with large dimensions

## <a id="v1.10.1"></a>[v1.10.1] - 2023-12-21

- Cataloguing: detect/filter `Ultra HDR`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class MediaFetchBytesHandler(private val context: Context) : MethodCallHandler {
MimeTypes.SVG -> SvgRegionFetcher(context).fetch(
uri = uri,
sizeBytes = sizeBytes,
scale = sampleSize,
regionRect = regionRect,
imageWidth = imageWidth,
imageHeight = imageHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ class SvgRegionFetcher internal constructor(
suspend fun fetch(
uri: Uri,
sizeBytes: Long?,
scale: Int,
regionRect: Rect,
imageWidth: Int,
imageHeight: Int,
result: MethodChannel.Result,
) {
if (!MemoryUtils.canAllocate(sizeBytes)) {
// opening an SVG that large would yield an OOM during parsing from `com.caverock.androidsvg.SVGParser`
result.error("fetch-read-large", "SVG too large at $sizeBytes bytes, for uri=$uri regionRect=$regionRect", null)
result.error("fetch-read-large-file", "SVG too large at $sizeBytes bytes, for uri=$uri regionRect=$regionRect", null)
return
}

Expand Down Expand Up @@ -67,8 +68,8 @@ class SvgRegionFetcher internal constructor(
val viewBox = svg.documentViewBox
val svgWidth = viewBox.width()
val svgHeight = viewBox.height()
val xf = imageWidth / ceil(svgWidth)
val yf = imageHeight / ceil(svgHeight)
val xf = imageWidth / scale / ceil(svgWidth)
val yf = imageHeight / scale / ceil(svgHeight)
// some SVG paths do not respect the rendering viewbox and do not reach its edges
// so we render to a slightly larger bitmap, using a slightly larger viewbox,
// and crop that bitmap to the target region size
Expand All @@ -87,6 +88,15 @@ class SvgRegionFetcher internal constructor(

val targetBitmapWidth = regionRect.width()
val targetBitmapHeight = regionRect.height()

// use `Long` as rect size could be unexpectedly large and go beyond `Int` max
val targetBitmapSizeBytes: Long = ARGB_8888_BYTE_SIZE.toLong() * targetBitmapWidth * targetBitmapHeight
if (!MemoryUtils.canAllocate(targetBitmapSizeBytes)) {
// decoding a region that large would yield an OOM when creating the bitmap
result.error("fetch-read-large-region", "SVG region too large for uri=$uri regionRect=$regionRect", null)
return
}

var bitmap = Bitmap.createBitmap(
targetBitmapWidth + bleedX * 2,
targetBitmapHeight + bleedY * 2,
Expand All @@ -106,4 +116,8 @@ class SvgRegionFetcher internal constructor(
val uri: Uri,
val svg: SVG,
)

companion object {
const val ARGB_8888_BYTE_SIZE = 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ object MimeTypes {

// as of `metadata-extractor` v2.14.0
fun canReadWithMetadataExtractor(mimeType: String) = when (mimeType) {
DJVU, WBMP -> false
DJVU, SVG, WBMP -> false
MKV, MP2T, MP2TS, OGV, WEBM -> false
else -> true
}
Expand Down
4 changes: 2 additions & 2 deletions fastlane/metadata/android/ar/full_description.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<i>أيفيس</i> يمكنه التعامل مع جميع أنواع الصور ومقاطع الفيديو ، بما في ذلك ملفات JPEG و MP4 النموذجية ، ولكن أيضًا أشياء أكثر غرابة مثل <b>ملفات TIFF و SVG و AVI القديمة متعددة الصفحات والمزيد</b>! يقوم بمسح مجموعة الوسائط الخاصة بك لتحديد <b> الصور المتحركة</b>, <b>الإستعراضات</b> (المعروف أيضًا باسم الصور البانورامية), <b>360 درجة مقاطع الفيديو</b>, إلى جانب <b>GeoTIFF</b> الملفات.
<i>Aves</i> يمكنه التعامل مع جميع أنواع الصور ومقاطع الفيديو ، بما في ذلك ملفات JPEG و MP4 النموذجية ، ولكن أيضًا أشياء أكثر غرابة مثل <b>ملفات TIFF و SVG و AVI القديمة متعددة الصفحات والمزيد</b>! يقوم بمسح مجموعة الوسائط الخاصة بك لتحديد <b> الصور المتحركة</b>, <b>الإستعراضات</b> (المعروف أيضًا باسم الصور البانورامية), <b>360 درجة مقاطع الفيديو</b>, إلى جانب <b>GeoTIFF</b> الملفات.

<b>الملاحة والبحث</b> جزء مهم من <i>Aves</i>الهدف هو أن يكون بإمكان المستخدمين التنقل بسهولة من الألبومات إلى الصور إلى الوسوم إلى الخرائط، وما إلى ذلك..

<i>Aves</i>تتكامل مع نظام Android (من KitKat إلى Android 14، بما في ذلك Android TV) مع ميزات مثلs <b>الودجتس</b>, <b>اختصارات التطبيق</b>, <b>حافظة الشاشة</b> و<b>البحث العالمي</b> التعامل معه. كما أنه يعمل كـ <b>عارض واختار لوسائط (ملفات الوسائط)</b>.
<i>Aves</i>تتكامل مع نظام Android (من KitKat إلى Android 14، بما في ذلك Android TV) مع ميزات مثلs <b>الودجتس</b>, <b>اختصارات التطبيق</b>, <b>حافظة الشاشة</b> و<b>البحث العالمي</b> التعامل معه. كما أنه يعمل كـ <b>عارض الوسائط ومنتقيها</b>.
4 changes: 4 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/111.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
In v1.10.2:
- JPEG MPF support
- enjoy the app in Arabic & Belarusian
Full changelog available on GitHub
4 changes: 4 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/11101.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
In v1.10.2:
- JPEG MPF support
- enjoy the app in Arabic & Belarusian
Full changelog available on GitHub
Loading

0 comments on commit 7cd170b

Please sign in to comment.