Bug 1365794 - optimize box blur surfaces for destination draw target. r=mchang
authorLee Salzman <lsalzman@mozilla.com>
Fri, 16 Jun 2017 16:50:39 -0400
changeset 364510 46868432ff69a48ad64d4f5f5676b99e6319b1f1
parent 364509 03e899794f41c126a06e0b396f2499ce542ea58c
child 364511 a0a703ef8e421c292a63b34d72b8a309e053cf03
push id32043
push userarchaeopteryx@coole-files.de
push dateSat, 17 Jun 2017 20:28:42 +0000
treeherdermozilla-central@0ef3bfc9f4b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmchang
bugs1365794
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1365794 - optimize box blur surfaces for destination draw target. r=mchang MozReview-Commit-ID: CfAwZZy6v5M
gfx/thebes/gfxBlur.cpp
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -586,16 +586,20 @@ GetBlur(gfxContext* aDestinationCtx,
 
   RefPtr<SourceSurface> boxShadow =
     CreateBoxShadow(destDT, minSize, aCornerRadii, aBlurRadius,
                     aShadowColor, aMirrorCorners, aOutBlurMargin);
   if (!boxShadow) {
     return nullptr;
   }
 
+  if (RefPtr<SourceSurface> opt = destDT->OptimizeSourceSurface(boxShadow)) {
+    boxShadow = opt;
+  }
+
   if (!useDestRect) {
     CacheBlur(destDT, minSize, aBlurRadius, aCornerRadii, aShadowColor,
               aOutBlurMargin, boxShadow);
   }
   return boxShadow.forget();
 }
 
 void
@@ -1128,16 +1132,20 @@ gfxAlphaBoxBlur::GetInsetBlur(const Rect
   minDrawTarget->Fill(maskPath, black);
 
   // Blur and fill in with the color we actually wanted
   RefPtr<SourceSurface> minInsetBlur = DoBlur(&aShadowColor);
   if (!minInsetBlur) {
     return nullptr;
   }
 
+  if (RefPtr<SourceSurface> opt = aDestDrawTarget->OptimizeSourceSurface(minInsetBlur)) {
+    minInsetBlur = opt;
+  }
+
   if (!aIsDestRect) {
     CacheInsetBlur(outerSize, whitespaceSize,
                    aBlurRadius, aInnerClipRadii,
                    aShadowColor, aDestDrawTarget->GetBackendType(),
                    minInsetBlur);
   }
 
   return minInsetBlur.forget();