Bug 1399178: Record SetPermitSubpixelAA. r=dvander
MozReview-Commit-ID: HfMK5SOSFtr
--- a/gfx/2d/DrawCommand.h
+++ b/gfx/2d/DrawCommand.h
@@ -32,16 +32,17 @@ enum class CommandType : int8_t {
MASK,
MASKSURFACE,
PUSHCLIP,
PUSHCLIPRECT,
PUSHLAYER,
POPCLIP,
POPLAYER,
SETTRANSFORM,
+ SETPERMITSUBPIXELAA,
FLUSH
};
class DrawingCommand
{
public:
virtual ~DrawingCommand() {}
@@ -670,16 +671,35 @@ public:
aDT->SetTransform(mTransform);
}
}
private:
Matrix mTransform;
};
+class SetPermitSubpixelAACommand : public DrawingCommand
+{
+ friend class DrawTargetCaptureImpl;
+public:
+ explicit SetPermitSubpixelAACommand(bool aPermitSubpixelAA)
+ : DrawingCommand(CommandType::SETPERMITSUBPIXELAA)
+ , mPermitSubpixelAA(aPermitSubpixelAA)
+ {
+ }
+
+ virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix* aMatrix) const
+ {
+ aDT->SetPermitSubpixelAA(mPermitSubpixelAA);
+ }
+
+private:
+ bool mPermitSubpixelAA;
+};
+
class FlushCommand : public DrawingCommand
{
public:
explicit FlushCommand()
: DrawingCommand(CommandType::FLUSH)
{
}
--- a/gfx/2d/DrawTargetCapture.cpp
+++ b/gfx/2d/DrawTargetCapture.cpp
@@ -73,16 +73,27 @@ DrawTargetCaptureImpl::Snapshot()
void
DrawTargetCaptureImpl::DetachAllSnapshots()
{}
#define AppendCommand(arg) new (AppendToCommandList<arg>()) arg
void
+DrawTargetCaptureImpl::SetPermitSubpixelAA(bool aPermitSubpixelAA)
+{
+ AppendCommand(SetPermitSubpixelAACommand)(aPermitSubpixelAA);
+
+ // Have to update the transform for this DT
+ // because some code paths query the current transform
+ // to render specific things.
+ DrawTarget::SetPermitSubpixelAA(aPermitSubpixelAA);
+}
+
+void
DrawTargetCaptureImpl::DrawSurface(SourceSurface *aSurface,
const Rect &aDest,
const Rect &aSource,
const DrawSurfaceOptions &aSurfOptions,
const DrawOptions &aOptions)
{
aSurface->GuaranteePersistance();
AppendCommand(DrawSurfaceCommand)(aSurface, aDest, aSource, aSurfOptions, aOptions);
--- a/gfx/2d/DrawTargetCapture.h
+++ b/gfx/2d/DrawTargetCapture.h
@@ -22,16 +22,17 @@ public:
DrawTargetCaptureImpl(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat);
bool Init(const IntSize& aSize, DrawTarget* aRefDT);
virtual BackendType GetBackendType() const override { return mRefDT->GetBackendType(); }
virtual DrawTargetType GetType() const override { return mRefDT->GetType(); }
virtual bool IsCaptureDT() const override { return true; }
virtual already_AddRefed<SourceSurface> Snapshot() override;
+ virtual void SetPermitSubpixelAA(bool aPermitSubpixelAA) override;
virtual void DetachAllSnapshots() override;
virtual IntSize GetSize() override { return mSize; }
virtual void Flush() override {}
virtual void DrawSurface(SourceSurface *aSurface,
const Rect &aDest,
const Rect &aSource,
const DrawSurfaceOptions &aSurfOptions,
const DrawOptions &aOptions) override;