Skip to content

Commit

Permalink
#501: add toggle pref
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Feb 8, 2019
1 parent 630d191 commit ac0300a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions gfx/thebes/gfxPrefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class gfxPrefs final
DECL_GFX_PREF(Live, "image.mozsamplesize.enabled", ImageMozSampleSizeEnabled, bool, false);
DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit", ImageMTDecodingLimit, int32_t, -1);
DECL_GFX_PREF(Live, "image.single-color-optimization.enabled", ImageSingleColorOptimizationEnabled, bool, true);
DECL_GFX_PREF(Live, "image.webp.enabled", ImageWebPEnabled, bool, false);

DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabled, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
Expand Down
6 changes: 4 additions & 2 deletions image/DecoderFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
type = DecoderType::ICON;

// WEBP
} else if (!strcmp(aMimeType, IMAGE_WEBP)) {
} else if (!strcmp(aMimeType, IMAGE_WEBP) &&
MOZ_LIKELY(gfxPrefs::ImageWebPEnabled())) {
type = DecoderType::WEBP;
}

Expand Down Expand Up @@ -161,7 +162,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");

RefPtr<Decoder> decoder =
Expand Down
3 changes: 3 additions & 0 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4193,6 +4193,9 @@ pref("image.mem.surfacecache.discard_factor", 1);
// automatically determined based on the system's number of cores.
pref("image.multithreaded_decoding.limit", -1);

// Whether we attempt to decode WebP images or not.
pref("image.webp.enabled", true);

// Limit for the canvas image cache. 0 means we don't limit the size of the
// cache.
pref("canvas.image.cache.limit", 0);
Expand Down

0 comments on commit ac0300a

Please sign in to comment.