Bug 1342302 - Part 3. Rename ImageLayerClipState::mDirtyRectGfx to mDirtyRectInDevPx. r=mstange

MozReview-Commit-ID: 7YyQStU0Seq

--HG--
extra : rebase_source : 93de69c294de348b8f4a8699f2db4aeaff88966d
This commit is contained in:
cku 2017-02-24 14:56:11 +08:00
parent 2f8c78bab0
commit 87c1f58dc0
3 changed files with 24 additions and 23 deletions

View File

@ -1992,9 +1992,9 @@ ComputeBoxValue(nsIFrame* aForFrame, StyleGeometryBox aBox)
bool
nsCSSRendering::ImageLayerClipState::IsValid() const
{
// mDirtyRectGfx comes from mDirtyRect. If mDirtyRectGfx is not empty,
// mDirtyRect can never be empty.
if (!mDirtyRectGfx.IsEmpty() && mDirtyRect.IsEmpty()) {
// mDirtyRectInDevPx comes from mDirtyRectInAppUnits. mDirtyRectInAppUnits
// can not be empty if mDirtyRectInDevPx is not.
if (!mDirtyRectInDevPx.IsEmpty() && mDirtyRectInAppUnits.IsEmpty()) {
return false;
}
@ -2043,8 +2043,8 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
clipAreaRelativeToStrokeBox + aBorderArea.TopLeft();
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
aAppUnitsPerPixel, &aClipState->mDirtyRect,
&aClipState->mDirtyRectGfx);
aAppUnitsPerPixel, &aClipState->mDirtyRectInAppUnits,
&aClipState->mDirtyRectInDevPx);
MOZ_ASSERT(aClipState->IsValid());
return;
}
@ -2053,8 +2053,8 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
aClipState->mBGClipArea = aCallerDirtyRect;
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect,
aAppUnitsPerPixel, &aClipState->mDirtyRect,
&aClipState->mDirtyRectGfx);
aAppUnitsPerPixel, &aClipState->mDirtyRectInAppUnits,
&aClipState->mDirtyRectInDevPx);
MOZ_ASSERT(aClipState->IsValid());
return;
}
@ -2163,7 +2163,8 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
}
SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect, aAppUnitsPerPixel,
&aClipState->mDirtyRect, &aClipState->mDirtyRectGfx);
&aClipState->mDirtyRectInAppUnits,
&aClipState->mDirtyRectInDevPx);
MOZ_ASSERT(aClipState->IsValid());
}
@ -2173,7 +2174,7 @@ SetupImageLayerClip(nsCSSRendering::ImageLayerClipState& aClipState,
gfxContext *aCtx, nscoord aAppUnitsPerPixel,
gfxContextAutoSaveRestore* aAutoSR)
{
if (aClipState.mDirtyRectGfx.IsEmpty()) {
if (aClipState.mDirtyRectInDevPx.IsEmpty()) {
// Our caller won't draw anything under this condition, so no need
// to set more up.
return;
@ -2185,8 +2186,6 @@ SetupImageLayerClip(nsCSSRendering::ImageLayerClipState& aClipState,
return;
}
DrawTarget* drawTarget = aCtx->GetDrawTarget();
// If we have rounded corners, clip all subsequent drawing to the
// rounded rectangle defined by bgArea and bgRadii (we don't know
// whether the rounded corners intrude on the dirtyRect or not).
@ -2215,14 +2214,15 @@ SetupImageLayerClip(nsCSSRendering::ImageLayerClipState& aClipState,
// https://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
NS_WARNING("converted background area should not be empty");
// Make our caller not do anything.
aClipState.mDirtyRectGfx.SizeTo(gfxSize(0.0, 0.0));
aClipState.mDirtyRectInDevPx.SizeTo(gfxSize(0.0, 0.0));
return;
}
aAutoSR->EnsureSaved(aCtx);
RefPtr<Path> roundedRect =
MakePathForRoundedRect(*drawTarget, bgAreaGfx, aClipState.mClippedRadii);
MakePathForRoundedRect(*aCtx->GetDrawTarget(), bgAreaGfx,
aClipState.mClippedRadii);
aCtx->Clip(roundedRect);
}
}
@ -2231,7 +2231,7 @@ static void
DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
gfxContext *aCtx, nscoord aAppUnitsPerPixel)
{
if (aClipState.mDirtyRectGfx.IsEmpty()) {
if (aClipState.mDirtyRectInDevPx.IsEmpty()) {
// Our caller won't draw anything under this condition, so no need
// to set more up.
return;
@ -2243,7 +2243,7 @@ DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
// table painting seems to depend on it.
if (!aClipState.mHasRoundedCorners || aClipState.mCustomClip) {
aCtx->NewPath();
aCtx->Rectangle(aClipState.mDirtyRectGfx, true);
aCtx->Rectangle(aClipState.mDirtyRectInDevPx, true);
aCtx->Fill();
return;
}
@ -2256,12 +2256,12 @@ DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
// https://hg.mozilla.org/mozilla-central/rev/50e934e4979b landed.
NS_WARNING("converted background area should not be empty");
// Make our caller not do anything.
aClipState.mDirtyRectGfx.SizeTo(gfxSize(0.0, 0.0));
aClipState.mDirtyRectInDevPx.SizeTo(gfxSize(0.0, 0.0));
return;
}
aCtx->Save();
gfxRect dirty = ThebesRect(bgAreaGfx).Intersect(aClipState.mDirtyRectGfx);
gfxRect dirty = ThebesRect(bgAreaGfx).Intersect(aClipState.mDirtyRectInDevPx);
aCtx->NewPath();
aCtx->Rectangle(dirty, true);
@ -3406,7 +3406,8 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
clipState.mCustomClip = true;
clipState.mHasRoundedCorners = false;
SetupDirtyRects(clipState.mBGClipArea, aParams.dirtyRect, appUnitsPerPixel,
&clipState.mDirtyRect, &clipState.mDirtyRectGfx);
&clipState.mDirtyRectInAppUnits,
&clipState.mDirtyRectInDevPx);
} else {
GetImageLayerClip(layers.BottomLayer(),
aParams.frame, aBorder, aParams.borderArea,
@ -3500,7 +3501,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
}
}
if ((aParams.layer < 0 || i == (uint32_t)startLayer) &&
!clipState.mDirtyRectGfx.IsEmpty()) {
!clipState.mDirtyRectInDevPx.IsEmpty()) {
CompositionOp co = DetermineCompositionOp(aParams, layers, i);
nsBackgroundLayerState state =
PrepareImageLayer(&aParams.presCtx, aParams.frame,
@ -3520,7 +3521,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
aParams.renderingCtx,
state.mDestArea, state.mFillArea,
state.mAnchor + paintBorderArea.TopLeft(),
clipState.mDirtyRect,
clipState.mDirtyRectInAppUnits,
state.mRepeatSize, aParams.opacity);
if (co != CompositionOp::OP_OVER) {

View File

@ -598,8 +598,8 @@ struct nsCSSRendering {
struct ImageLayerClipState {
nsRect mBGClipArea; // Affected by mClippedRadii
nsRect mAdditionalBGClipArea; // Not affected by mClippedRadii
nsRect mDirtyRect;
gfxRect mDirtyRectGfx;
nsRect mDirtyRectInAppUnits;
gfxRect mDirtyRectInDevPx;
nscoord mRadii[8];
RectCornerRadii mClippedRadii;

View File

@ -7697,7 +7697,7 @@ ComputeMaskGeometry(PaintFramesParams& aParams)
false, /* aWillPaintBorder */
appUnitsPerDevPixel,
&clipState);
currentMaskSurfaceRect = clipState.mDirtyRectGfx;
currentMaskSurfaceRect = clipState.mDirtyRectInDevPx;
}
maskInUserSpace = maskInUserSpace.Union(currentMaskSurfaceRect);