From 888c35be894bf163f37bb58bc4049f0f6ff3db60 Mon Sep 17 00:00:00 2001 From: Job Bautista Date: Sun, 19 Jun 2022 15:40:33 +0800 Subject: Issue #1769 - Part 2: Implement JPEG-XL decoder and about:config and MIME plumbing. Backported from Mozilla bug 1707590 whereever possible. --- image/DecoderFactory.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'image/DecoderFactory.cpp') diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp index dffe4dc211..303cd3d63b 100644 --- a/image/DecoderFactory.cpp +++ b/image/DecoderFactory.cpp @@ -19,6 +19,9 @@ #include "nsICODecoder.h" #include "nsIconDecoder.h" #include "nsWebPDecoder.h" +#ifdef MOZ_JXL +# include "nsJXLDecoder.h" +#endif namespace mozilla { @@ -77,6 +80,12 @@ DecoderFactory::GetDecoderType(const char* aMimeType) gfxPrefs::ImageWebPEnabled()) { type = DecoderType::WEBP; } +#ifdef MOZ_JXL + else if (!strcmp(aMimeType, IMAGE_JXL) && + gfxPrefs::ImageJXLEnabled()) { + type = DecoderType::JXL; + } +#endif return type; } @@ -116,6 +125,11 @@ DecoderFactory::GetDecoder(DecoderType aType, case DecoderType::WEBP: decoder = new nsWebPDecoder(aImage); break; +#ifdef MOZ_JXL + case DecoderType::JXL: + decoder = new nsJXLDecoder(aImage); + break; +#endif default: MOZ_ASSERT_UNREACHABLE("Unknown decoder type"); } -- cgit v1.2.3