summaryrefslogtreecommitdiffstats
path: root/image/DecoderFactory.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 08:48:48 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 08:48:48 -0500
commitc6856f968b8c85502f14c6c3412b00a05fc0c0de (patch)
treec0720fdf31018c72fcb69134f2e9667d16970c3a /image/DecoderFactory.cpp
parent36f73c8cd27e62cbd3e85939d6fe11a240e3416f (diff)
parent1e1fb5ea2504e548bc17521bdb273c9e59b9cf01 (diff)
downloadUXP-c6856f968b8c85502f14c6c3412b00a05fc0c0de.tar
UXP-c6856f968b8c85502f14c6c3412b00a05fc0c0de.tar.gz
UXP-c6856f968b8c85502f14c6c3412b00a05fc0c0de.tar.lz
UXP-c6856f968b8c85502f14c6c3412b00a05fc0c0de.tar.xz
UXP-c6856f968b8c85502f14c6c3412b00a05fc0c0de.zip
Merge branch 'master' into configurebuild-work
Diffstat (limited to 'image/DecoderFactory.cpp')
-rw-r--r--image/DecoderFactory.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp
index 1c51d2fbc..2085fb7c4 100644
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -5,6 +5,7 @@
#include "DecoderFactory.h"
+#include "gfxPrefs.h"
#include "nsMimeTypes.h"
#include "mozilla/RefPtr.h"
@@ -17,6 +18,7 @@
#include "nsBMPDecoder.h"
#include "nsICODecoder.h"
#include "nsIconDecoder.h"
+#include "nsWebPDecoder.h"
namespace mozilla {
@@ -65,8 +67,12 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
// Icon
} else if (!strcmp(aMimeType, IMAGE_ICON_MS)) {
type = DecoderType::ICON;
- }
+ // WebP
+ } else if (!strcmp(aMimeType, IMAGE_WEBP) &&
+ gfxPrefs::ImageWebPEnabled()) {
+ type = DecoderType::WEBP;
+ }
return type;
}
@@ -100,6 +106,9 @@ DecoderFactory::GetDecoder(DecoderType aType,
case DecoderType::ICON:
decoder = new nsIconDecoder(aImage);
break;
+ case DecoderType::WEBP:
+ decoder = new nsWebPDecoder(aImage);
+ break;
default:
MOZ_ASSERT_UNREACHABLE("Unknown decoder type");
}
@@ -171,7 +180,8 @@ DecoderFactory::CreateAnimationDecoder(DecoderType aType,
return nullptr;
}
- MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG,
+ MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG ||
+ aType == DecoderType::WEBP,
"Calling CreateAnimationDecoder for non-animating DecoderType");
// Create an anonymous decoder. Interaction with the SurfaceCache and the