Bug 1207944 (part 8) - Change nsDisplayBackgroundColor::mColor from gfxRGBA to gfx::Color. r=jwatt.

This avoids an unnecessary gfxRBGA-to-Color conversion in one SetColor() call.
This commit is contained in:
Nicholas Nethercote 2015-09-24 00:46:32 -07:00
parent a20b860f96
commit f7c77481c4
2 changed files with 8 additions and 7 deletions

View File

@ -2989,7 +2989,7 @@ void
nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
if (mColor == NS_RGBA(0, 0, 0, 0)) {
if (mColor == Color()) {
return;
}
@ -3043,7 +3043,7 @@ nsDisplayBackgroundColor::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool
nsDisplayBackgroundColor::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor)
{
*aColor = NS_RGBA_FROM_GFXRGBA(mColor);
*aColor = mColor.ToABGR();
return true;
}

View File

@ -2647,13 +2647,15 @@ protected:
class nsDisplayBackgroundColor : public nsDisplayItem
{
typedef mozilla::gfx::Color Color;
public:
nsDisplayBackgroundColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsStyleBackground* aBackgroundStyle,
nscolor aColor)
: nsDisplayItem(aBuilder, aFrame)
, mBackgroundStyle(aBackgroundStyle)
, mColor(gfxRGBA(aColor))
, mColor(Color::FromABGR(aColor))
{ }
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override;
@ -2677,8 +2679,7 @@ public:
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
{
return new nsDisplaySolidColorGeometry(this, aBuilder,
NS_RGBA_FROM_GFXRGBA(mColor));
return new nsDisplaySolidColorGeometry(this, aBuilder, mColor.ToABGR());
}
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
@ -2686,7 +2687,7 @@ public:
nsRegion* aInvalidRegion) override
{
const nsDisplaySolidColorGeometry* geometry = static_cast<const nsDisplaySolidColorGeometry*>(aGeometry);
if (NS_RGBA_FROM_GFXRGBA(mColor) != geometry->mColor) {
if (mColor.ToABGR() != geometry->mColor) {
bool dummy;
aInvalidRegion->Or(geometry->mBounds, GetBounds(aBuilder, &dummy));
return;
@ -2699,7 +2700,7 @@ public:
protected:
const nsStyleBackground* mBackgroundStyle;
gfxRGBA mColor;
mozilla::gfx::Color mColor;
};
class nsDisplayClearBackground : public nsDisplayItem