diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-01-13 15:59:49 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-02-14 12:09:32 +0100 |
commit | 8ad4edf43f7e143967590dac02ca72d843f9ae11 (patch) | |
tree | 3ebada26f871c099c7ba6cb1a77d677d021e1d48 /svx | |
parent | b900907fde6d4507cff7844c5bcd6cc2f7b3821f (diff) |
support for the WebP image format (tdf#114532)
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 <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/core/graphichelper.cxx | 6 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 1 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 1 | ||||
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 2 |
4 files changed, 10 insertions, 0 deletions
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<css::graphic::X break; } case GfxLinkType::NativePdf: aExtension = ".pdf"; break; + case GfxLinkType::NativeWebp: aExtension = ".webp"; break; default: aExtension = ".grf"; diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 8eaec8e5a5fc..cb690df32623 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -34,6 +34,7 @@ constexpr OUStringLiteral FORMAT_BMP = u"bmp"; constexpr OUStringLiteral FORMAT_GIF = u"gif"; constexpr OUStringLiteral FORMAT_JPG = u"jpg"; constexpr OUStringLiteral FORMAT_PNG = u"png"; +constexpr OUStringLiteral FORMAT_WEBP = u"webp"; using namespace com::sun::star; @@ -182,6 +183,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, case GfxLinkType::NativeJpg: aExt = FORMAT_JPG; break; case GfxLinkType::NativePng: aExt = FORMAT_PNG; break; + case GfxLinkType::NativeWebp: aExt = FORMAT_WEBP; break; default: break; |