зеркало из https://github.com/mozilla/gecko-dev.git
Bug 486918 - Create and obey a high-quality downscaling pref, and turn it off on OS X and mobile. r=jlebar
This commit is contained in:
Родитель
e72e50b42e
Коммит
2b9b4de964
|
@ -27,6 +27,7 @@ pref("browser.cache.memory.capacity", 1024); // kilobytes
|
|||
|
||||
/* image cache prefs */
|
||||
pref("image.cache.size", 1048576); // bytes
|
||||
pref("image.high_quality_downscaling.enabled", false);
|
||||
|
||||
/* offline cache prefs */
|
||||
pref("browser.offline-apps.notify", false);
|
||||
|
|
|
@ -109,6 +109,9 @@ static PRLogModuleInfo *gCompressedImageAccountingLog = PR_NewLogModule ("Compre
|
|||
// makes us slower to start up.
|
||||
static uint32_t gDecodeBytesAtATime = 0;
|
||||
static uint32_t gMaxMSBeforeYield = 0;
|
||||
static bool gHQDownscaling = false;
|
||||
// This is interpreted as a floating-point value / 1000
|
||||
static uint32_t gHQDownscalingMinFactor = 1000;
|
||||
|
||||
static void
|
||||
InitPrefCaches()
|
||||
|
@ -117,6 +120,10 @@ InitPrefCaches()
|
|||
"image.mem.decode_bytes_at_a_time", 200000);
|
||||
Preferences::AddUintVarCache(&gMaxMSBeforeYield,
|
||||
"image.mem.max_ms_before_yield", 400);
|
||||
Preferences::AddBoolVarCache(&gHQDownscaling,
|
||||
"image.high_quality_downscaling.enabled", false);
|
||||
Preferences::AddUintVarCache(&gHQDownscalingMinFactor,
|
||||
"image.high_quality_downscaling.min_factor", 1000);
|
||||
}
|
||||
|
||||
/* We define our own error checking macros here for 2 reasons:
|
||||
|
@ -189,9 +196,6 @@ namespace mozilla {
|
|||
namespace image {
|
||||
|
||||
/* static */ StaticRefPtr<RasterImage::DecodeWorker> RasterImage::DecodeWorker::sSingleton;
|
||||
|
||||
#define PRE_DOWNSCALE_MIN_FACTOR 0.9
|
||||
|
||||
/* static */ nsRefPtr<RasterImage::ScaleWorker> RasterImage::ScaleWorker::sSingleton;
|
||||
/* static */ nsRefPtr<RasterImage::DrawWorker> RasterImage::DrawWorker::sSingleton;
|
||||
static nsCOMPtr<nsIThread> sScaleWorkerThread = nullptr;
|
||||
|
@ -2793,14 +2797,15 @@ RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
|
|||
{
|
||||
// The high-quality scaler requires Skia.
|
||||
#ifdef MOZ_ENABLE_SKIA
|
||||
return (aFilter == gfxPattern::FILTER_GOOD) &&
|
||||
!mAnim && mDecoded &&
|
||||
(aScale.width <= 1.0 && aScale.height <= 1.0) &&
|
||||
(aScale.width < PRE_DOWNSCALE_MIN_FACTOR ||
|
||||
aScale.height < PRE_DOWNSCALE_MIN_FACTOR);
|
||||
#else
|
||||
return false;
|
||||
if (gHQDownscaling && aFilter == gfxPattern::FILTER_GOOD &&
|
||||
!mAnim && mDecoded &&
|
||||
(aScale.width <= 1.0 && aScale.height <= 1.0)) {
|
||||
gfxFloat factor = gHQDownscalingMinFactor / 1000.0;
|
||||
return (aScale.width < factor || aScale.height < factor);
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -27,6 +27,8 @@ function setDefaultPrefs() {
|
|||
// Disable addon updates and prefetching so we don't leak them
|
||||
branch.setBoolPref("extensions.update.enabled", false);
|
||||
branch.setBoolPref("extensions.getAddons.cache.enabled", false);
|
||||
// Disable high-quality downscaling, since it makes reftests more difficult.
|
||||
branch.setBoolPref("image.high_quality_downscaling.enabled", false);
|
||||
}
|
||||
|
||||
var windowListener = {
|
||||
|
|
|
@ -91,6 +91,8 @@ RefTestCmdLineHandler.prototype =
|
|||
// Disable addon updates and prefetching so we don't leak them
|
||||
branch.setBoolPref("extensions.update.enabled", false);
|
||||
branch.setBoolPref("extensions.getAddons.cache.enabled", false);
|
||||
// Disable high-quality downscaling, since it makes reftests more difficult.
|
||||
branch.setBoolPref("image.high_quality_downscaling.enabled", false);
|
||||
|
||||
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(nsIWindowWatcher);
|
||||
|
|
|
@ -60,6 +60,7 @@ pref("browser.cache.memory.capacity", 1024); // kilobytes
|
|||
|
||||
/* image cache prefs */
|
||||
pref("image.cache.size", 1048576); // bytes
|
||||
pref("image.high_quality_downscaling.enabled", false);
|
||||
|
||||
/* offline cache prefs */
|
||||
pref("browser.offline-apps.notify", true);
|
||||
|
|
|
@ -3520,7 +3520,7 @@ pref("zoom.minPercent", 30);
|
|||
pref("zoom.maxPercent", 300);
|
||||
pref("toolkit.zoomManager.zoomValues", ".3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4,3");
|
||||
|
||||
// Image cache prefs
|
||||
// Image-related prefs
|
||||
// The maximum size, in bytes, of the decoded images we cache
|
||||
pref("image.cache.size", 5242880);
|
||||
// A weight, from 0-1000, to place on time when comparing to size.
|
||||
|
@ -3530,6 +3530,18 @@ pref("image.cache.timeweight", 500);
|
|||
// The default Accept header sent for images loaded over HTTP(S)
|
||||
pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5");
|
||||
|
||||
// Whether we do high-quality image downscaling. OS X natively supports
|
||||
// high-quality image scaling.
|
||||
#ifdef XP_MACOSX
|
||||
pref("image.high_quality_downscaling.enabled", false);
|
||||
#else
|
||||
pref("image.high_quality_downscaling.enabled", true);
|
||||
#endif
|
||||
|
||||
// The minimum percent downscaling we'll use high-quality downscaling on,
|
||||
// interpreted as a floating-point number / 1000.
|
||||
pref("image.high_quality_downscaling.min_factor", 1000);
|
||||
|
||||
//
|
||||
// Image memory management prefs
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче