Backed out changeset c65de66fe0aa (bug 1119774) since this needs to be backedout too otherwise you will have a bustage or so :) on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2015-01-12 15:36:36 +01:00
parent daa579f611
commit 4c62bbd8de
6 changed files with 10 additions and 47 deletions

View File

@ -233,7 +233,6 @@ private:
DECL_GFX_PREF(Once, "image.cache.timeweight", ImageCacheTimeWeight, int32_t, 500);
DECL_GFX_PREF(Once, "image.cache.size", ImageCacheSize, int32_t, 5*1024*1024);
DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, false);
DECL_GFX_PREF(Live, "image.high_quality_downscaling.enabled", ImageHQDownscalingEnabled, bool, false);
DECL_GFX_PREF(Live, "image.high_quality_downscaling.min_factor", ImageHQDownscalingMinFactor, uint32_t, 1000);
DECL_GFX_PREF(Live, "image.high_quality_upscaling.max_size", ImageHQUpscalingMaxSize, uint32_t, 20971520);

View File

@ -52,16 +52,11 @@ public:
* multipart/x-mixed-replace image parts fall into this category.) If this
* flag is set, INIT_FLAG_DISCARDABLE and INIT_FLAG_DECODE_ON_DRAW must not be
* set.
*
* INIT_FLAG_DOWNSCALE_DURING_DECODE: The container should attempt to
* downscale images during decoding instead of decoding them to their
* intrinsic size.
*/
static const uint32_t INIT_FLAG_NONE = 0x0;
static const uint32_t INIT_FLAG_DISCARDABLE = 0x1;
static const uint32_t INIT_FLAG_DECODE_ON_DRAW = 0x2;
static const uint32_t INIT_FLAG_TRANSIENT = 0x4;
static const uint32_t INIT_FLAG_DOWNSCALE_DURING_DECODE = 0x8;
static const uint32_t INIT_FLAG_NONE = 0x0;
static const uint32_t INIT_FLAG_DISCARDABLE = 0x1;
static const uint32_t INIT_FLAG_DECODE_ON_DRAW = 0x2;
static const uint32_t INIT_FLAG_TRANSIENT = 0x4;
/**
* Creates a new image container.

View File

@ -31,22 +31,14 @@ namespace image {
ImageFactory::Initialize()
{ }
static bool
ShouldDownscaleDuringDecode(const nsCString& aMimeType)
{
// Not enabled for anything yet.
return false;
}
static uint32_t
ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
ComputeImageFlags(ImageURL* uri, bool isMultiPart)
{
nsresult rv;
// We default to the static globals.
bool isDiscardable = gfxPrefs::ImageMemDiscardable();
bool doDecodeOnDraw = gfxPrefs::ImageMemDecodeOnDraw();
bool doDownscaleDuringDecode = gfxPrefs::ImageDownscaleDuringDecodeEnabled();
// We want UI to be as snappy as possible and not to flicker. Disable
// discarding and decode-on-draw for chrome URLS.
@ -64,15 +56,10 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
isDiscardable = doDecodeOnDraw = false;
}
// Downscale-during-decode is only enabled for certain content types.
if (doDownscaleDuringDecode && !ShouldDownscaleDuringDecode(aMimeType)) {
doDownscaleDuringDecode = false;
}
// For multipart/x-mixed-replace, we basically want a direct channel to the
// decoder. Disable everything for this case.
// decoder. Disable both for this case as well.
if (isMultiPart) {
isDiscardable = doDecodeOnDraw = doDownscaleDuringDecode = false;
isDiscardable = doDecodeOnDraw = false;
}
// We have all the information we need.
@ -86,9 +73,6 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
if (isMultiPart) {
imageFlags |= Image::INIT_FLAG_TRANSIENT;
}
if (doDownscaleDuringDecode) {
imageFlags |= Image::INIT_FLAG_DOWNSCALE_DURING_DECODE;
}
return imageFlags;
}
@ -105,7 +89,7 @@ ImageFactory::CreateImage(nsIRequest* aRequest,
"Pref observers should have been initialized already");
// Compute the image's initialization flags.
uint32_t imageFlags = ComputeImageFlags(aURI, aMimeType, aIsMultiPart);
uint32_t imageFlags = ComputeImageFlags(aURI, aIsMultiPart);
// Select the type of image to create based on MIME type.
if (aMimeType.EqualsLiteral(IMAGE_SVG_XML)) {

View File

@ -325,21 +325,14 @@ RasterImage::Init(const char* aMimeType,
// transient images.
MOZ_ASSERT(!(aFlags & INIT_FLAG_TRANSIENT) ||
(!(aFlags & INIT_FLAG_DISCARDABLE) &&
!(aFlags & INIT_FLAG_DECODE_ON_DRAW),
!(aFlags & INIT_FLAG_DOWNSCALE_DURING_DECODE)),
"Illegal init flags for transient image");
!(aFlags & INIT_FLAG_DECODE_ON_DRAW)),
"Transient images can't be discardable or decode-on-draw");
// Store initialization data
mSourceDataMimeType.Assign(aMimeType);
mDiscardable = !!(aFlags & INIT_FLAG_DISCARDABLE);
mDecodeOnDraw = !!(aFlags & INIT_FLAG_DECODE_ON_DRAW);
mTransient = !!(aFlags & INIT_FLAG_TRANSIENT);
mDownscaleDuringDecode = !!(aFlags & INIT_FLAG_DOWNSCALE_DURING_DECODE);
#ifndef MOZ_ENABLE_SKIA
// Downscale-during-decode requires Skia.
mDownscaleDuringDecode = false;
#endif
// Lock this image's surfaces in the SurfaceCache if we're not discardable.
if (!mDiscardable) {

View File

@ -386,7 +386,6 @@ private: // data
bool mDiscardable:1; // Is container discardable?
bool mHasSourceData:1; // Do we have source data?
bool mHasBeenDecoded:1; // Decoded at least once?
bool mDownscaleDuringDecode:1;
// Whether we're waiting to start animation. If we get a StartAnimation() call
// but we don't yet have more than one frame, mPendingAnimation is set so that

View File

@ -3753,20 +3753,13 @@ pref("browser.zoom.reflowZoom.reflowTimeout", 500);
*/
pref("browser.zoom.reflowZoom.reflowTextOnPageLoad", true);
//
// 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.
// Size is given a weight of 1000 - timeweight.
pref("image.cache.timeweight", 500);
// Whether we attempt to downscale images during decoding.
pref("image.downscale-during-decode.enabled", false);
// The default Accept header sent for images loaded over HTTP(S)
pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5");