summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-04-04 12:35:31 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-07-07 09:41:24 +0200
commitc0653c1e268ff8f6a6fe422aadb27675d8b1f583 (patch)
treeb24b5fab1c97370c058b48bce3e9b7a94818397a /vcl/source
parent02c91f82c2f8de24c6c2097d41725d9bae9d164a (diff)
vcl: add more GIF metadata to GraphicFormatDetector
Change-Id: Ie85947371df087495a80179e4e0f2f660877e368 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166277 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Jenkins
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/filter/GraphicFormatDetector.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx
index a878a8ca111d..7963505f4b2e 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -28,6 +28,7 @@
#include <tools/zcodec.hxx>
#include <tools/fract.hxx>
#include <filter/WebpReader.hxx>
+#include "igif/gifread.hxx"
#include <vcl/TypeSerializer.hxx>
#include <vcl/outdev.hxx>
#include <utility>
@@ -824,6 +825,8 @@ bool GraphicFormatDetector::checkTIF()
bool GraphicFormatDetector::checkGIF()
{
+ SeekGuard aGuard(mrStream, mnStreamPosition);
+
if (mnFirstLong == 0x47494638 && (maFirstBytes[4] == 0x37 || maFirstBytes[4] == 0x39)
&& maFirstBytes[5] == 0x61)
{
@@ -834,6 +837,14 @@ bool GraphicFormatDetector::checkGIF()
sal_uInt16 nHeight = maFirstBytes[8] | (maFirstBytes[9] << 8);
maMetadata.maPixSize = Size(nWidth, nHeight);
maMetadata.mnBitsPerPixel = ((maFirstBytes[10] & 112) >> 4) + 1;
+
+ Size aLogicSize;
+ bool bAnimated = IsGIFAnimated(mrStream, aLogicSize);
+ if (aLogicSize.getWidth() && aLogicSize.getHeight())
+ {
+ maMetadata.maLogSize = aLogicSize;
+ }
+ maMetadata.mbIsAnimated = bAnimated;
}
return true;
}
@@ -954,6 +965,7 @@ bool GraphicFormatDetector::checkAPNG()
if (PngImageReader::isAPng(mrStream))
{
maMetadata.mnFormat = GraphicFileFormat::APNG;
+ maMetadata.mbIsAnimated = true;
return true;
}
return false;