Bug 1478815 part 2 - Make DrawTargetDual aware of component alpha clearing. r=bas
authorRyan Hunt <rhunt@eqrion.net>
Wed, 01 Aug 2018 12:45:35 -0500
changeset 486004 caa552d03ce8719a138044afb1bab409bd2cd47a
parent 486003 61ebda8713d36f89af5435cc2daa7d43accb93bd
child 486005 a3148cb43f975770fca07d919478c274b67aa6cc
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1478815
milestone63.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 1478815 part 2 - Make DrawTargetDual aware of component alpha clearing. r=bas This commit changes the behavior of DrawTargetDual::Clear to be aware that it has on-white and on-black buffers, and perform clearing appropriately. This is slightly against what the DrawTarget documentation says the method should do, but it allows us to move another paint thread operation into DrawTargetCapture and simplify our ContentClient implementations. I haven't seen any obvious breakage with this, and reftests are green. An alternative would be to add a separate Clear method with documented difference here. MozReview-Commit-ID: 65CzcxlRqv7
gfx/2d/DrawTargetDual.cpp
gfx/2d/DrawTargetDual.h
--- a/gfx/2d/DrawTargetDual.cpp
+++ b/gfx/2d/DrawTargetDual.cpp
@@ -121,16 +121,23 @@ DrawTargetDual::MaskSurface(const Patter
 {
   DualPattern source(aSource);
   DualSurface mask(aMask);
   mA->MaskSurface(*source.mA, mask.mA, aOffset, aOptions);
   mB->MaskSurface(*source.mB, mask.mB, aOffset, aOptions);
 }
 
 void
+DrawTargetDual::ClearRect(const Rect &aRect)
+{
+  mA->FillRect(aRect, ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
+  mB->FillRect(aRect, ColorPattern(Color(1.0, 1.0, 1.0, 1.0)));
+}
+
+void
 DrawTargetDual::CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect,
                             const IntPoint &aDestination)
 {
   DualSurface surface(aSurface);
   mA->CopySurface(surface.mA, aSourceRect, aDestination);
   mB->CopySurface(surface.mB, aSourceRect, aDestination);
 }
 
--- a/gfx/2d/DrawTargetDual.h
+++ b/gfx/2d/DrawTargetDual.h
@@ -53,17 +53,16 @@ public:
 
   virtual void DetachAllSnapshots() override;
 
   FORWARD_FUNCTION(Flush)
   FORWARD_FUNCTION1(PushClip, const Path *, aPath)
   FORWARD_FUNCTION1(PushClipRect, const Rect &, aRect)
   FORWARD_FUNCTION(PopClip)
   FORWARD_FUNCTION(PopLayer)
-  FORWARD_FUNCTION1(ClearRect, const Rect &, aRect)
 
   virtual void SetTransform(const Matrix &aTransform) override {
     mTransform = aTransform;
     mA->SetTransform(aTransform);
     mB->SetTransform(aTransform);
   }
 
   virtual void DrawSurface(SourceSurface *aSurface, const Rect &aDest, const Rect & aSource,
@@ -82,16 +81,18 @@ public:
                            SourceSurface *aMask,
                            Point aOffset,
                            const DrawOptions &aOptions = DrawOptions()) override;
 
   virtual void DrawSurfaceWithShadow(SourceSurface *aSurface, const Point &aDest,
                                      const Color &aColor, const Point &aOffset,
                                      Float aSigma, CompositionOp aOp) override;
 
+  virtual void ClearRect(const Rect &aRect) override;
+
   virtual void CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect,
                            const IntPoint &aDestination) override;
 
   virtual void FillRect(const Rect &aRect, const Pattern &aPattern, const DrawOptions &aOptions) override;
 
   virtual void StrokeRect(const Rect &aRect, const Pattern &aPattern,
                           const StrokeOptions &aStrokeOptions, const DrawOptions &aOptions) override;