From b502551a0010ac86034470bfa91fd65beff417f7 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Fri, 2 Feb 2018 09:24:10 -0600 Subject: [PATCH] Deduplicate unneeded SetTransform and SetPermitSubpixelAA calls from DrawTargetCapture (bug 1431813, r=bas) --HG-- extra : rebase_source : 30b2051494aa247df922e87779a1f866e1b45e97 --- gfx/2d/DrawTargetCapture.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gfx/2d/DrawTargetCapture.cpp b/gfx/2d/DrawTargetCapture.cpp index d39cfb973b90..de473fe7bcbf 100644 --- a/gfx/2d/DrawTargetCapture.cpp +++ b/gfx/2d/DrawTargetCapture.cpp @@ -119,6 +119,11 @@ DrawTargetCaptureImpl::DetachAllSnapshots() void DrawTargetCaptureImpl::SetPermitSubpixelAA(bool aPermitSubpixelAA) { + // Save memory by eliminating state changes with no effect + if (mPermitSubpixelAA == aPermitSubpixelAA) { + return; + } + AppendCommand(SetPermitSubpixelAACommand)(aPermitSubpixelAA); // Have to update mPermitSubpixelAA for this DT @@ -310,6 +315,11 @@ DrawTargetCaptureImpl::PopClip() void DrawTargetCaptureImpl::SetTransform(const Matrix& aTransform) { + // Save memory by eliminating state changes with no effect + if (mTransform.ExactlyEquals(aTransform)) { + return; + } + AppendCommand(SetTransformCommand)(aTransform); // Have to update the transform for this DT