From 8ad4edf43f7e143967590dac02ca72d843f9ae11 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 13 Jan 2022 15:59:49 +0100 Subject: support for the WebP image format (tdf#114532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit implements a WebP reader and writer for both lossless and lossy WebP, export dialog options for selecting lossless/lossy and quality for lossy, and various internal support for the format. Since writing WebP to e.g. ODT documents would make those images unreadable by previous versions with no WebP support, support for that is explicitly disabled in GraphicFilter, to be enabled somewhen later. Change-Id: I9b10f6da6faa78a0bb74415a92e9f163c14685f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128920 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- svx/source/core/graphichelper.cxx | 6 ++++++ svx/source/gallery2/galtheme.cxx | 1 + svx/source/xml/xmlgrhlp.cxx | 1 + svx/source/xoutdev/_xoutbmp.cxx | 2 ++ 4 files changed, 10 insertions(+) (limited to 'svx') diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index a6b51e62fc5d..1cb36105ed27 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -118,6 +118,9 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic& case GfxLinkType::NativePdf: aExtension = "pdf"; break; + case GfxLinkType::NativeWebp: + aExtension = "webp"; + break; default: break; } @@ -159,6 +162,9 @@ OUString GraphicHelper::GetImageType(const Graphic& rGraphic) case GfxLinkType::NativeBmp: aGraphicTypeString = SvxResId(STR_IMAGE_BMP); break; + case GfxLinkType::NativeWebp: + aGraphicTypeString = SvxResId(STR_IMAGE_WEBP); + break; default: break; } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index dff3696b8cd8..4a9d10e609ff 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -407,6 +407,7 @@ bool GalleryTheme::InsertGraphic(const Graphic& rGraphic, sal_uInt32 nInsertPos) case GfxLinkType::NativeMet: nExportFormat = ConvertDataFormat::MET; break; case GfxLinkType::NativePct: nExportFormat = ConvertDataFormat::PCT; break; case GfxLinkType::NativeSvg: nExportFormat = ConvertDataFormat::SVG; break; + case GfxLinkType::NativeWebp: nExportFormat = ConvertDataFormat::WEBP; break; default: break; } diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 522e6c076d19..6a8c7c08fce5 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -700,6 +700,7 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference