Bug 752953 - Simplify IntersectRect calculations. r=roc

This commit is contained in:
Mats Palmgren 2012-05-09 21:53:15 +02:00
parent d1fcc7c337
commit 206b9047a9

View File

@ -1295,9 +1295,7 @@ nsDisplayBackground::GetInsideClipRegion(nsPresContext* aPresContext,
*aSnap = false;
result = nsLayoutUtils::RoundedRectIntersectRect(clipRect, radii, aRect);
} else {
nsRect r;
r.IntersectRect(clipRect, aRect);
result = r;
result = clipRect.Intersect(aRect);
}
return result;
}
@ -1967,8 +1965,7 @@ nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRect bounds = GetBounds(aBuilder, &snap);
nsRegion visibleUnderChildren;
visibleUnderChildren.And(*aVisibleRegion, bounds);
nsRect allowExpansion;
allowExpansion.IntersectRect(bounds, aAllowVisibleRegionExpansion);
nsRect allowExpansion = bounds.Intersect(aAllowVisibleRegionExpansion);
return
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren,
allowExpansion);
@ -2108,10 +2105,9 @@ nsDisplayScrollLayer::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion childVisibleRegion = displayport + aBuilder->ToReferenceFrame(mScrollFrame);
nsRect boundedRect;
boundedRect.IntersectRect(childVisibleRegion.GetBounds(), mList.GetBounds(aBuilder));
nsRect allowExpansion;
allowExpansion.IntersectRect(boundedRect, aAllowVisibleRegionExpansion);
nsRect boundedRect =
childVisibleRegion.GetBounds().Intersect(mList.GetBounds(aBuilder));
nsRect allowExpansion = boundedRect.Intersect(aAllowVisibleRegionExpansion);
bool visible = mList.ComputeVisibilityForSublist(
aBuilder, &childVisibleRegion, boundedRect, allowExpansion);
mVisibleRect = boundedRect;
@ -2260,8 +2256,7 @@ nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder,
nsRect nsDisplayClip::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) {
nsRect r = nsDisplayWrapList::GetBounds(aBuilder, aSnap);
*aSnap = false;
r.IntersectRect(mClip, r);
return r;
return mClip.Intersect(r);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -2282,8 +2277,7 @@ bool nsDisplayClip::ComputeVisibility(nsDisplayListBuilder* aBuilder,
clipped.And(*aVisibleRegion, mClip);
nsRegion finalClipped(clipped);
nsRect allowExpansion;
allowExpansion.IntersectRect(mClip, aAllowVisibleRegionExpansion);
nsRect allowExpansion = mClip.Intersect(aAllowVisibleRegionExpansion);
bool anyVisible =
nsDisplayWrapList::ComputeVisibility(aBuilder, &finalClipped,
allowExpansion);
@ -3193,8 +3187,7 @@ bool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder,
// Our children may be made translucent or arbitrarily deformed so we should
// not allow them to subtract area from aVisibleRegion.
nsRegion childrenVisible(dirtyRect);
nsRect r;
r.IntersectRect(dirtyRect, mList.GetBounds(aBuilder));
nsRect r = dirtyRect.Intersect(mList.GetBounds(aBuilder));
mList.ComputeVisibilityForSublist(aBuilder, &childrenVisible, r, nsRect());
return true;
}