From ae1ae581367ec944e0c5525c5e8b49102b353c94 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Thu, 5 Jul 2012 17:18:03 +0200 Subject: [PATCH] Bug 769612 - Move the SVGAutoRenderState::SetPaintingToWindow() call to nsDisplayOuterSVG::Paint and kill nsSVGOuterSVGFrame::Paint. r=dholbert. --- layout/svg/base/src/nsSVGOuterSVGFrame.cpp | 34 +++++++++------------- layout/svg/base/src/nsSVGOuterSVGFrame.h | 4 --- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index b1f3b750b2b..e967b084861 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -487,15 +487,27 @@ nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder, PRTime start = PR_Now(); #endif + // Create an SVGAutoRenderState so we can call SetPaintingToWindow on + // it, but do so without changing the render mode: + SVGAutoRenderState state(aContext, SVGAutoRenderState::GetRenderMode(aContext)); + + if (aBuilder->IsPaintingToWindow()) { + state.SetPaintingToWindow(true); + } + nsRect viewportRect = mFrame->GetContentRectRelativeToSelf() + ToReferenceFrame(); nsRect clipRect = mVisibleRect.Intersect(viewportRect); + nsIntRect contentAreaDirtyRect = + (clipRect - viewportRect.TopLeft()). + ToOutsidePixels(mFrame->PresContext()->AppUnitsPerDevPixel()); + aContext->PushState(); aContext->IntersectClip(clipRect); aContext->Translate(viewportRect.TopLeft()); - mFrame->Paint(aBuilder, aContext, clipRect - viewportRect.TopLeft()); + nsSVGUtils::PaintFrameWithEffects(aContext, &contentAreaDirtyRect, mFrame); aContext->PopState(); NS_ASSERTION(!aContext->ThebesContext()->HasError(), "Cairo in error state"); @@ -594,26 +606,6 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, return NS_OK; } -void -nsSVGOuterSVGFrame::Paint(const nsDisplayListBuilder* aBuilder, - nsRenderingContext* aContext, - const nsRect& aDirtyRect) -{ - // Create an SVGAutoRenderState so we can call SetPaintingToWindow on - // it, but don't change the render mode: - SVGAutoRenderState state(aContext, SVGAutoRenderState::GetRenderMode(aContext)); - - if (aBuilder->IsPaintingToWindow()) { - state.SetPaintingToWindow(true); - } - - // Convert the (content area relative) dirty rect to dev pixels: - nsIntRect dirtyPxRect = - aDirtyRect.ToOutsidePixels(PresContext()->AppUnitsPerDevPixel()); - - nsSVGUtils::PaintFrameWithEffects(aContext, &dirtyPxRect, this); -} - nsSplittableType nsSVGOuterSVGFrame::GetSplittableType() const { diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.h b/layout/svg/base/src/nsSVGOuterSVGFrame.h index 253f129dfd8..56dce8480c8 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.h +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.h @@ -65,10 +65,6 @@ public: */ virtual nsIAtom* GetType() const; - void Paint(const nsDisplayListBuilder* aBuilder, - nsRenderingContext* aContext, - const nsRect& aDirtyRect); - #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const {