Bug 922807. Always draw images with OVER. r=roc
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 01 Oct 2013 21:22:44 -0400
changeset 149598 e18473d7b8bbc7dec3e2544a518bd0f2a68dbf6f
parent 149597 beacc621ec68f057d3bad9592c6408ff73751475
child 149599 3b4383185c501155adfaea1993d5414891a91d75
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs922807
milestone27.0a1
Bug 922807. Always draw images with OVER. r=roc There's no reason I can see to draw them with SOURCE. SOURCE is slower with the Azure wrapper (see FillAzure()). It is also slow with cairo when we have a clip.
gfx/thebes/gfxUtils.cpp
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -185,16 +185,17 @@ gfxUtils::ConvertBGRAtoRGBA(gfxImageSurf
 }
 
 static bool
 IsSafeImageTransformComponent(gfxFloat aValue)
 {
   return aValue >= -32768 && aValue <= 32767;
 }
 
+#ifndef MOZ_GFX_OPTIMIZE_MOBILE
 /**
  * This returns the fastest operator to use for solid surfaces which have no
  * alpha channel or their alpha channel is uniformly opaque.
  * This differs per render mode.
  */
 static gfxContext::GraphicsOperator
 OptimalFillOperator()
 {
@@ -206,17 +207,16 @@ OptimalFillOperator()
     } else {
 #endif
         return gfxContext::OPERATOR_SOURCE;
 #ifdef XP_WIN
     }
 #endif
 }
 
-#ifndef MOZ_GFX_OPTIMIZE_MOBILE
 // EXTEND_PAD won't help us here; we have to create a temporary surface to hold
 // the subimage of pixels we're allowed to sample.
 static already_AddRefed<gfxDrawable>
 CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
                                  gfxContext* aContext,
                                  const gfxMatrix& aUserSpaceToImageSpace,
                                  const gfxRect& aSourceRect,
                                  const gfxRect& aSubimage,
@@ -477,25 +477,17 @@ gfxUtils::DrawPixelSnapped(gfxContext*  
         }
         // 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 == gfxImageFormatRGB24) {
-        aContext->SetOperator(OptimalFillOperator());
-    }
-
     drawable->Draw(aContext, aFill, doTile, aFilter, userSpaceToImageSpace);
-
-    aContext->SetOperator(op);
 }
 
 /* static */ int
 gfxUtils::ImageFormatToDepth(gfxImageFormat aFormat)
 {
     switch (aFormat) {
         case gfxImageFormatARGB32:
             return 32;