Bug 1309804 - Part 2. Split invalid region computation into nsDisplayMask & nsDisplayFilter. r=mstange

MozReview-Commit-ID: IOL7S2Y6Hhm

--HG--
extra : rebase_source : 3579f5280dbbbf8273b82b12a1b6454b712db46c
This commit is contained in:
cku 2016-10-13 15:36:48 +08:00
parent 2ecc9f55dc
commit e4e5d0010d
4 changed files with 66 additions and 16 deletions

View File

@ -6804,11 +6804,6 @@ nsDisplaySVGEffects::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
// nothing in the filter input.
aInvalidRegion->Or(bounds, geometry->mBounds);
}
if (aBuilder->ShouldSyncDecodeImages() &&
geometry->ShouldInvalidateToSyncDecodeImages()) {
aInvalidRegion->Or(*aInvalidRegion, bounds);
}
}
bool nsDisplaySVGEffects::ValidateSVGFrame()
@ -7050,6 +7045,24 @@ bool nsDisplayMask::ComputeVisibility(nsDisplayListBuilder* aBuilder,
return true;
}
void
nsDisplayMask::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion)
{
nsDisplaySVGEffects::ComputeInvalidationRegion(aBuilder, aGeometry,
aInvalidRegion);
const nsDisplayMaskGeometry* geometry =
static_cast<const nsDisplayMaskGeometry*>(aGeometry);
bool snap;
nsRect bounds = GetBounds(aBuilder, &snap);
if (aBuilder->ShouldSyncDecodeImages() &&
geometry->ShouldInvalidateToSyncDecodeImages()) {
aInvalidRegion->Or(*aInvalidRegion, bounds);
}
}
void
nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx,
@ -7230,10 +7243,8 @@ nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder,
aManager,
mHandleOpacity);
image::DrawResult result =
nsSVGIntegrationUtils::PaintFilter(params);
nsDisplayMaskGeometry::UpdateDrawResult(this, result);
image::DrawResult result = nsSVGIntegrationUtils::PaintFilter(params);
nsDisplayFilterGeometry::UpdateDrawResult(this, result);
}
#ifdef MOZ_DUMP_PAINTING

View File

@ -3861,10 +3861,6 @@ public:
gfxRect BBoxInUserSpace() const;
gfxPoint UserSpaceOffset() const;
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
{
return new nsDisplayMaskGeometry(this, aBuilder);
}
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) override;
@ -3902,6 +3898,14 @@ public:
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) override;
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
{
return new nsDisplayMaskGeometry(this, aBuilder);
}
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) override;
#ifdef MOZ_DUMP_PAINTING
void PrintEffects(nsACString& aTo);
#endif
@ -3939,6 +3943,11 @@ public:
}
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) override;
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
{
return new nsDisplayFilterGeometry(this, aBuilder);
}
#ifdef MOZ_DUMP_PAINTING
void PrintEffects(nsACString& aTo);
#endif

View File

@ -113,7 +113,7 @@ nsDisplaySolidColorRegionGeometry::MoveBy(const nsPoint& aOffset)
mRegion.MoveBy(aOffset);
}
nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplaySVGEffects* aItem, nsDisplayListBuilder* aBuilder)
nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder)
: nsDisplayItemGeometry(aItem, aBuilder)
, nsImageGeometryMixin(aItem, aBuilder)
, mBBox(aItem->BBoxInUserSpace())
@ -128,6 +128,21 @@ nsDisplayMaskGeometry::MoveBy(const nsPoint& aOffset)
mFrameOffsetToReferenceFrame += aOffset;
}
nsDisplayFilterGeometry::nsDisplayFilterGeometry(nsDisplayFilter* aItem, nsDisplayListBuilder* aBuilder)
: nsDisplayItemGeometry(aItem, aBuilder)
, nsImageGeometryMixin(aItem, aBuilder)
, mBBox(aItem->BBoxInUserSpace())
, mUserSpaceOffset(aItem->UserSpaceOffset())
, mFrameOffsetToReferenceFrame(aItem->ToReferenceFrame())
{}
void
nsDisplayFilterGeometry::MoveBy(const nsPoint& aOffset)
{
mBounds.MoveBy(aOffset);
mFrameOffsetToReferenceFrame += aOffset;
}
nsCharClipGeometry::nsCharClipGeometry(nsCharClipDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
: nsDisplayItemGenericGeometry(aItem, aBuilder)
, mVisIStartEdge(aItem->mVisIStartEdge)

View File

@ -17,9 +17,10 @@ class nsDisplayBackgroundImage;
class nsCharClipDisplayItem;
class nsDisplayItem;
class nsDisplayListBuilder;
class nsDisplaySVGEffects;
class nsDisplayTableItem;
class nsDisplayThemedBackground;
class nsDisplayMask;
class nsDisplayFilter;
namespace mozilla {
namespace gfx {
@ -269,7 +270,21 @@ class nsDisplayMaskGeometry : public nsDisplayItemGeometry
, public nsImageGeometryMixin<nsDisplayMaskGeometry>
{
public:
nsDisplayMaskGeometry(nsDisplaySVGEffects* aItem, nsDisplayListBuilder* aBuilder);
nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder);
virtual void MoveBy(const nsPoint& aOffset) override;
gfxRect mBBox;
gfxPoint mUserSpaceOffset;
nsPoint mFrameOffsetToReferenceFrame;
};
class nsDisplayFilterGeometry : public nsDisplayItemGeometry
, public nsImageGeometryMixin<nsDisplayMaskGeometry>
{
public:
nsDisplayFilterGeometry(nsDisplayFilter* aItem,
nsDisplayListBuilder* aBuilder);
virtual void MoveBy(const nsPoint& aOffset) override;