Bug 781731 - Set azure shadow canvas size match thebes in order to match performance; r=roc
authorAnthony Jones <ajones@mozilla.com>
Mon, 27 Aug 2012 11:34:12 +0200
changeset 105585 3b2797ed0518b438b468bac4d1a76f08afc02be7
parent 105584 aec0729913fee9e86cf3d7aff9315382f963b5ec
child 105586 8ac3a7df2b6a64ab5ebe600c91ec0de9ef33d9d4
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersroc
bugs781731
milestone17.0a1
Bug 781731 - Set azure shadow canvas size match thebes in order to match performance; r=roc
content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
@@ -282,17 +282,18 @@ public:
     if (mSigma > SIGMA_MAX) {
       mSigma = SIGMA_MAX;
     }
       
     Matrix transform = mCtx->mTarget->GetTransform();
 
     mTempRect = mgfx::Rect(0, 0, ctx->mWidth, ctx->mHeight);
 
-    Float blurRadius = mSigma * 3;
+    static const gfxFloat GAUSSIAN_SCALE_FACTOR = (3 * sqrt(2 * M_PI) / 4) * 1.5;
+    int32_t blurRadius = (int32_t) floor(mSigma * GAUSSIAN_SCALE_FACTOR + 0.5);
 
     // We need to enlarge and possibly offset our temporary surface
     // so that things outside of the canvas may cast shadows.
     mTempRect.Inflate(Margin(blurRadius + NS_MAX<Float>(state.shadowOffset.x, 0),
                              blurRadius + NS_MAX<Float>(state.shadowOffset.y, 0),
                              blurRadius + NS_MAX<Float>(-state.shadowOffset.x, 0),
                              blurRadius + NS_MAX<Float>(-state.shadowOffset.y, 0)));