Bug 795940 - Part 0.4 - Only try to downscale images that have a single instance on a web page, since that's all we support anyhow. r=jrmuizel
authorJoe Drew <joe@drew.ca>
Fri, 12 Oct 2012 18:20:25 -0400
changeset 110692 6bd34e2bfafc0ef93ccc7eae46f8a91204ce578b
parent 110691 510cab1158baced8c9dd8903a6e03899e57b1c86
child 110693 eb116dffd9f284a76464e604ce6a99625111edcc
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjrmuizel
bugs795940
milestone19.0a1
Bug 795940 - Part 0.4 - Only try to downscale images that have a single instance on a web page, since that's all we support anyhow. r=jrmuizel
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2787,18 +2787,20 @@ RasterImage::DrawWithPreDownscaleIfNeede
       userSpaceToImageSpace.Multiply(gfxMatrix().Scale(scale.width, scale.height));
 
       // Since we're switching to a scaled image, we we need to transform the
       // area of the subimage to draw accordingly, since imgFrame::Draw()
       // doesn't know about scaled frames.
       subimage.ScaleRoundOut(scale.width, scale.height);
     }
 
-    // If we're not waiting for exactly this result, ask for it.
-    else if (!(mScaleResult.status == SCALE_PENDING && mScaleResult.scale == scale)) {
+    // If we're not waiting for exactly this result, and there's only one
+    // instance of this image on this page, ask for a scale.
+    else if (!(mScaleResult.status == SCALE_PENDING && mScaleResult.scale == scale) &&
+             mLockCount == 1) {
       // If we have an oustanding request, signal it to stop (if it can).
       if (mScaleRequest) {
         mScaleRequest->stopped = true;
       }
 
       nsRefPtr<ScaleRunner> runner = new ScaleRunner(this, scale, frame);
       if (runner->IsOK()) {
         if (!sScaleWorkerThread) {