Bug 1520877 - Part 3: Implement FillRoundedRect for DrawTargetCapture. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D16894

--HG--
extra : rebase_source : becf1b41cd67e82053804e293486400162cadf28
This commit is contained in:
Bas Schouten 2019-01-17 20:34:21 +01:00
parent 940959abd0
commit e146ae8233
4 changed files with 42 additions and 0 deletions

View File

@ -29,6 +29,7 @@ enum class CommandType : int8_t {
COPYSURFACE,
COPYRECT,
FILLRECT,
FILLROUNDEDRECT,
STROKERECT,
STROKELINE,
STROKE,

View File

@ -369,6 +369,38 @@ class FillRectCommand : public DrawingCommand {
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,

View File

@ -189,6 +189,12 @@ void DrawTargetCaptureImpl::FillRect(const Rect& aRect, const Pattern& aPattern,
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,

View File

@ -65,6 +65,9 @@ class DrawTargetCaptureImpl : public DrawTargetCapture {
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;