summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-14 07:45:06 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-14 07:45:06 +0200
commitdc9d933d81646b53edab245eb8f96b1e82ba752f (patch)
tree1ed71efd273183764ac549992dc3fc965a4c025f
parent6bb3a908d34728fec0a3520eac03ad9b69dd4a9b (diff)
downloadUXP-dc9d933d81646b53edab245eb8f96b1e82ba752f.tar
UXP-dc9d933d81646b53edab245eb8f96b1e82ba752f.tar.gz
UXP-dc9d933d81646b53edab245eb8f96b1e82ba752f.tar.lz
UXP-dc9d933d81646b53edab245eb8f96b1e82ba752f.tar.xz
UXP-dc9d933d81646b53edab245eb8f96b1e82ba752f.zip
Add pref to control CanOptimizeToImageLayer for large downscale factors.
This resolves #626
-rw-r--r--gfx/thebes/gfxPrefs.h1
-rw-r--r--layout/base/nsDisplayList.cpp5
-rw-r--r--modules/libpref/init/all.js6
3 files changed, 12 insertions, 0 deletions
diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
index 71485ff22..359a258c7 100644
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -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);
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 8035269e3..cb55bb2da 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -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);
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index beab06aff..1b2793ed3 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4346,6 +4346,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
//