Bug 781731 - Fixed crash caused by an empty shadow region; r=Bas
authorAnthony Jones <ajones@mozilla.com>
Mon, 27 Aug 2012 11:35:10 +0200
changeset 105587 dfdfdf5ae236757f9267dc3a7fae8f951fcc9a92
parent 105586 8ac3a7df2b6a64ab5ebe600c91ec0de9ef33d9d4
child 105588 cd5eb6f6f4954a83fb37ec064b0c8e09d8750463
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersBas
bugs781731
milestone17.0a1
Bug 781731 - Fixed crash caused by an empty shadow region; r=Bas
content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
@@ -301,24 +301,31 @@ public:
       // We actually include the bounds of the shadow blur, this makes it
       // easier to execute the actual blur on hardware, and shouldn't affect
       // the amount of pixels that need to be touched.
       aBounds->Inflate(Margin(blurRadius, blurRadius,
                               blurRadius, blurRadius));
       mTempRect = mTempRect.Intersect(*aBounds);
     }
 
+    // Nothing to draw
+    if (mTempRect.IsEmpty()) {
+      mTarget = ctx->mTarget;
+      mCtx = nullptr;
+      return;
+    }
+
     mTempRect.ScaleRoundOut(1.0f);
 
     transform._31 -= mTempRect.x;
     transform._32 -= mTempRect.y;
       
     mTarget =
       mCtx->mTarget->CreateShadowDrawTarget(IntSize(int32_t(mTempRect.width), int32_t(mTempRect.height)),
-                                             FORMAT_B8G8R8A8, mSigma);
+                                            FORMAT_B8G8R8A8, mSigma);
 
     if (!mTarget) {
       // XXX - Deal with the situation where our temp size is too big to
       // fit in a texture.
       mTarget = ctx->mTarget;
       mCtx = nullptr;
     } else {
       mTarget->SetTransform(transform);