Bug 1207944 (part 5) - Use SetColor(const Color&) when setting from a constructed gfxRGBA. r=jwatt.

In various places SetColor() gets passed a gfxRBGA that is constructed at the
call site. This patch changes these to construct a gfx::Color directly,
avoiding the subsequent conversion.
This commit is contained in:
Nicholas Nethercote 2015-09-23 23:42:58 -07:00
parent 043314a662
commit 5bead7803b
3 changed files with 6 additions and 7 deletions

View File

@ -584,7 +584,7 @@ BasicLayerManager::FlashWidgetUpdateArea(gfxContext *aContext)
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
aContext->SetColor(gfxRGBA(r, g, b, 0.2));
aContext->SetColor(Color(r, g, b, 0.2f));
aContext->Paint();
}
}
@ -1004,10 +1004,9 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
gfxRect destRect;
#ifdef DEBUG
if (aLayer->GetDebugColorIndex() != 0) {
gfxRGBA color((aLayer->GetDebugColorIndex() & 1) ? 1.0 : 0.0,
(aLayer->GetDebugColorIndex() & 2) ? 1.0 : 0.0,
(aLayer->GetDebugColorIndex() & 4) ? 1.0 : 0.0,
1.0);
Color color((aLayer->GetDebugColorIndex() & 1) ? 1.f : 0.f,
(aLayer->GetDebugColorIndex() & 2) ? 1.f : 0.f,
(aLayer->GetDebugColorIndex() & 4) ? 1.f : 0.f);
nsRefPtr<gfxContext> temp = new gfxContext(untransformedDT, Point(bounds.x, bounds.y));
temp->SetColor(color);

View File

@ -547,7 +547,7 @@ struct BufferAlphaColor {
aBounds.Width() / appsPerDevUnit,
aBounds.Height() / appsPerDevUnit), true);
mContext->Clip();
mContext->SetColor(gfxRGBA(aAlphaColor.r, aAlphaColor.g, aAlphaColor.b));
mContext->SetColor(Color(aAlphaColor.r, aAlphaColor.g, aAlphaColor.b));
mContext->PushGroup(gfxContentType::COLOR_ALPHA);
mAlpha = aAlphaColor.a;
}

View File

@ -1576,7 +1576,7 @@ FrameLayerBuilder::FlashPaint(gfxContext *aContext)
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
aContext->SetColor(gfxRGBA(r, g, b, 0.4));
aContext->SetColor(Color(r, g, b, 0.4f));
aContext->Paint();
}