Bug 1520877 - Part 3: Implement FillRoundedRect for DrawTargetCapture. r=mattwoodrow
authorBas Schouten <bschouten@mozilla.com>
Thu, 17 Jan 2019 20:34:21 +0100
changeset 514508 e3ef1e27eb9222d2215c91b9209291c75eaeb4df
parent 514507 1d614d0ffdc104414c18c108c6c75c93dbd459c4
child 514509 a346775c25b358822a76d4e599520391fdac4d3f
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1520877
milestone66.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 1520877 - Part 3: Implement FillRoundedRect for DrawTargetCapture. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D16894
gfx/2d/DrawCommand.h
gfx/2d/DrawCommands.h
gfx/2d/DrawTargetCapture.cpp
gfx/2d/DrawTargetCapture.h
--- a/gfx/2d/DrawCommand.h
+++ b/gfx/2d/DrawCommand.h
@@ -24,16 +24,17 @@ class CaptureCommandList;
 enum class CommandType : int8_t {
   DRAWSURFACE = 0,
   DRAWFILTER,
   DRAWSURFACEWITHSHADOW,
   CLEARRECT,
   COPYSURFACE,
   COPYRECT,
   FILLRECT,
+  FILLROUNDEDRECT,
   STROKERECT,
   STROKELINE,
   STROKE,
   FILL,
   FILLGLYPHS,
   STROKEGLYPHS,
   MASK,
   MASKSURFACE,
--- a/gfx/2d/DrawCommands.h
+++ b/gfx/2d/DrawCommands.h
@@ -364,16 +364,48 @@ class FillRectCommand : public DrawingCo
   static const CommandType Type = CommandType::FILLRECT;
 
  private:
   Rect mRect;
   StoredPattern mPattern;
   DrawOptions mOptions;
 };
 
+class FillRoundedRectCommand : public DrawingCommand {
+ public:
+  FillRoundedRectCommand(const RoundedRect& aRect, const Pattern& aPattern,
+                         const DrawOptions& aOptions)
+      : mRect(aRect), mPattern(aPattern), mOptions(aOptions) {}
+
+  CommandType GetType() const override { return FillRoundedRectCommand::Type; }
+
+  void CloneInto(CaptureCommandList* aList) override {
+    CLONE_INTO(FillRoundedRectCommand)(mRect, mPattern, mOptions);
+  }
+
+  void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const override {
+    aDT->FillRoundedRect(mRect, mPattern, mOptions);
+  }
+
+  void Log(TreeLog& aStream) const override {
+    aStream << "[FillRoundedRect rect=" << mRect.rect;
+    aStream << " pattern=" << mPattern.Get();
+    aStream << " opt=" << mOptions;
+    aStream << "]";
+  }
+
+  static const bool AffectsSnapshot = true;
+  static const CommandType Type = CommandType::FILLROUNDEDRECT;
+
+ private:
+  RoundedRect mRect;
+  StoredPattern mPattern;
+  DrawOptions mOptions;
+};
+
 class StrokeRectCommand : public StrokeOptionsCommand {
  public:
   StrokeRectCommand(const Rect& aRect, const Pattern& aPattern,
                     const StrokeOptions& aStrokeOptions,
                     const DrawOptions& aOptions)
       : StrokeOptionsCommand(aStrokeOptions),
         mRect(aRect),
         mPattern(aPattern),
--- a/gfx/2d/DrawTargetCapture.cpp
+++ b/gfx/2d/DrawTargetCapture.cpp
@@ -184,16 +184,22 @@ void DrawTargetCaptureImpl::CopyRect(con
   AppendCommand(CopyRectCommand)(aSourceRect, aDestination);
 }
 
 void DrawTargetCaptureImpl::FillRect(const Rect& aRect, const Pattern& aPattern,
                                      const DrawOptions& aOptions) {
   AppendCommand(FillRectCommand)(aRect, aPattern, aOptions);
 }
 
+void DrawTargetCaptureImpl::FillRoundedRect(const RoundedRect& aRect,
+                                            const Pattern& aPattern,
+                                            const DrawOptions& aOptions) {
+  AppendCommand(FillRoundedRectCommand)(aRect, aPattern, aOptions);
+}
+
 void DrawTargetCaptureImpl::StrokeRect(const Rect& aRect,
                                        const Pattern& aPattern,
                                        const StrokeOptions& aStrokeOptions,
                                        const DrawOptions& aOptions) {
   AppendCommand(StrokeRectCommand)(aRect, aPattern, aStrokeOptions, aOptions);
 }
 
 void DrawTargetCaptureImpl::StrokeLine(const Point& aStart, const Point& aEnd,
--- a/gfx/2d/DrawTargetCapture.h
+++ b/gfx/2d/DrawTargetCapture.h
@@ -60,16 +60,19 @@ class DrawTargetCaptureImpl : public Dra
       const DrawOptions &aOptions = DrawOptions()) override;
   virtual void CopySurface(SourceSurface *aSurface, const IntRect &aSourceRect,
                            const IntPoint &aDestination) override;
   virtual void CopyRect(const IntRect &aSourceRect,
                         const IntPoint &aDestination) override;
 
   virtual void FillRect(const Rect &aRect, const Pattern &aPattern,
                         const DrawOptions &aOptions = DrawOptions()) override;
+  virtual void FillRoundedRect(
+      const RoundedRect &aRect, const Pattern &aPattern,
+      const DrawOptions &aOptions = DrawOptions()) override;
   virtual void StrokeRect(const Rect &aRect, const Pattern &aPattern,
                           const StrokeOptions &aStrokeOptions = StrokeOptions(),
                           const DrawOptions &aOptions = DrawOptions()) override;
   virtual void StrokeLine(const Point &aStart, const Point &aEnd,
                           const Pattern &aPattern,
                           const StrokeOptions &aStrokeOptions = StrokeOptions(),
                           const DrawOptions &aOptions = DrawOptions()) override;
   virtual void Stroke(const Path *aPath, const Pattern &aPattern,