mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Implement WebP image decoder.
This commit is contained in:
parent
85b4e45fa7
commit
9121db73a2
10 changed files with 579 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue