Add pref to control CanOptimizeToImageLayer for large downscale factors.

This resolves #626
This commit is contained in:
wolfbeast 2018-07-14 07:45:06 +02:00 committed by Roy Tam
commit ca5c2ba100
3 changed files with 12 additions and 0 deletions

View file

@ -436,6 +436,7 @@ private:
DECL_GFX_PREF(Live, "image.decode-immediately.enabled", ImageDecodeImmediatelyEnabled, bool, false);
DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
DECL_GFX_PREF(Live, "image.infer-src-animation.threshold-ms", ImageInferSrcAnimationThresholdMS, uint32_t, 2000);
DECL_GFX_PREF(Once, "image.layerize.always", ImageLayerizeAlways, bool, false);
DECL_GFX_PREF(Once, "image.mem.decode_bytes_at_a_time", ImageMemDecodeBytesAtATime, uint32_t, 200000);
DECL_GFX_PREF(Live, "image.mem.discardable", ImageMemDiscardable, bool, false);
DECL_GFX_PREF(Once, "image.mem.surfacecache.discard_factor", ImageMemSurfaceCacheDiscardFactor, uint32_t, 1);

View file

@ -3513,6 +3513,11 @@ nsDisplayImageContainer::CanOptimizeToImageLayer(LayerManager* aManager,
return false;
}
if (gfxPrefs::ImageLayerizeAlways()) {
// If the user decides to trade off quality for performance, so be it!
return true;
}
const int32_t factor = mFrame->PresContext()->AppUnitsPerDevPixel();
const LayoutDeviceRect destRect =
LayoutDeviceRect::FromAppUnits(GetDestRect(), factor);

View file

@ -4354,6 +4354,12 @@ pref("image.http.accept", "image/webp,image/png,image/*;q=0.8,*/*;q=0.5");
// disable.
pref("image.infer-src-animation.threshold-ms", 2000);
// Whether to always optimize to image layers. Setting this to true will increase
// performance of downscaled large images at the expense of visual quality,
// because we can't use HQ downscaling in image layers.
// Aliasing may occur past downscaling beyond 34% in that case.
pref("image.layerize.always", false);
//
// Image memory management prefs
//