b=749426; don't use CreateSamplingRestrictedDrawable on mobile to avoid OOM; r=jrmuizel; a=joe
authorVladimir Vukicevic <vladimir@pobox.com>
Wed, 16 May 2012 10:03:08 -0400
changeset 95791 8a6bb72f1882e3f9d8a388e54667bb2a9eebca1b
parent 95790 d9e6e9bb3979cb919d17ea851cbdf6ad6126f7e0
child 95792 ac685c4554a508a2a7acafb2db0ec0d24001cd90
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, joe
bugs749426
milestone14.0a2
b=749426; don't use CreateSamplingRestrictedDrawable on mobile to avoid OOM; r=jrmuizel; a=joe
gfx/thebes/gfxUtils.cpp
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -505,16 +505,20 @@ gfxUtils::DrawPixelSnapped(gfxContext*  
                                             aFill, currentTarget);
     if (!workaround.Succeeded())
         return;
 
     nsRefPtr<gfxDrawable> drawable = aDrawable;
 
     aFilter = ReduceResamplingFilter(aFilter, aImageRect.Width(), aImageRect.Height(), aSourceRect.Width(), aSourceRect.Height());
 
+    // On Mobile, we don't ever want to do this; it has the potential for
+    // allocating very large temporary surfaces, especially since we'll
+    // do full-page snapshots often (see bug 749426).
+#ifndef MOZ_GFX_OPTIMIZE_MOBILE
     // OK now, the hard part left is to account for the subimage sampling
     // restriction. If all the transforms involved are just integer
     // translations, then we assume no resampling will occur so there's
     // nothing to do.
     // XXX if only we had source-clipping in cairo!
     if (aContext->CurrentMatrix().HasNonIntegerTranslation() ||
         aUserSpaceToImageSpace.HasNonIntegerTranslation()) {
         if (doTile || !aSubimage.Contains(aImageRect)) {
@@ -526,16 +530,17 @@ gfxUtils::DrawPixelSnapped(gfxContext*  
                 drawable.swap(restrictedDrawable);
             }
         }
         // We no longer need to tile: Either we never needed to, or we already
         // filled a surface with the tiled pattern; this surface can now be
         // drawn without tiling.
         doTile = false;
     }
+#endif
 
     gfxContext::GraphicsOperator op = aContext->CurrentOperator();
     if ((op == gfxContext::OPERATOR_OVER || workaround.PushedGroup()) &&
         aFormat == gfxASurface::ImageFormatRGB24) {
         aContext->SetOperator(OptimalFillOperator());
     }
 
     drawable->Draw(aContext, aFill, doTile, aFilter, aUserSpaceToImageSpace);