Bug 1210560 - Followup 3: Fix an assertion that can occur on mochitest bc4. r=jrmuizel on a CLOSED TREE
authorBas Schouten <bschouten@mozilla.com>
Wed, 11 Nov 2015 21:56:59 +0100
changeset 308442 1c7753515d42624c2588eb07ace904dc2de48208
parent 308310 ae320c1f8f7c4eeba7c4b89111ea280bd74dbab7
child 308443 d12f758f5f362ffed1aa195d266289e1ed2a1123
push id7470
push users.kaspari@gmail.com
push dateThu, 12 Nov 2015 12:51:02 +0000
reviewersjrmuizel
bugs1210560
milestone45.0a1
Bug 1210560 - Followup 3: Fix an assertion that can occur on mochitest bc4. r=jrmuizel on a CLOSED TREE
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -785,24 +785,24 @@ gfxContext::SetFontSmoothingBackgroundCo
 Color
 gfxContext::GetFontSmoothingBackgroundColor()
 {
   return CurrentState().fontSmoothingBackgroundColor;
 }
 
 // masking
 void
-gfxContext::Mask(SourceSurface* aSurface, const Matrix& aTransform)
+gfxContext::Mask(SourceSurface* aSurface, Float aAlpha, const Matrix& aTransform)
 {
   Matrix old = mTransform;
   Matrix mat = aTransform * mTransform;
 
   ChangeTransform(mat);
   mDT->MaskSurface(PatternFromState(this), aSurface, Point(),
-                   DrawOptions(1.0f, CurrentState().op, CurrentState().aaMode));
+                   DrawOptions(aAlpha, CurrentState().op, CurrentState().aaMode));
   ChangeTransform(old);
 }
 
 void
 gfxContext::Mask(gfxASurface *surface, const gfxPoint& offset)
 {
   PROFILER_LABEL("gfxContext", "Mask",
     js::ProfileEntry::Category::GRAPHICS);
@@ -995,18 +995,17 @@ gfxContext::PopGroupAndBlend()
 
   CompositionOp oldOp = GetOp();
   SetOp(CompositionOp::OP_OVER);
 
   if (mask) {
     if (!maskTransform.HasNonTranslation()) {
       Mask(mask, opacity, Point(maskTransform._31, maskTransform._32));
     } else {
-      MOZ_ASSERT(opacity == 1.0f);
-      Mask(mask, maskTransform);
+      Mask(mask, opacity, maskTransform);
     }
   } else {
     Paint(opacity);
   }
 
   SetOp(oldOp);
 }
 
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -310,17 +310,18 @@ public:
 
     /**
      ** Painting with a Mask
      **/
     /**
      * Like Paint, except that it only draws the source where pattern is
      * non-transparent.
      */
-    void Mask(mozilla::gfx::SourceSurface *aSurface, const mozilla::gfx::Matrix& aTransform);
+    void Mask(mozilla::gfx::SourceSurface *aSurface, mozilla::gfx::Float aAlpha, const mozilla::gfx::Matrix& aTransform);
+    void Mask(mozilla::gfx::SourceSurface *aSurface, const mozilla::gfx::Matrix& aTransform) { Mask(aSurface, 1.0f, aTransform); }
 
     /**
      * Shorthand for creating a pattern and calling the pattern-taking
      * variant of Mask.
      */
     void Mask(gfxASurface *surface, const gfxPoint& offset = gfxPoint(0.0, 0.0));
 
     void Mask(mozilla::gfx::SourceSurface *surface, float alpha = 1.0f, const mozilla::gfx::Point& offset = mozilla::gfx::Point());