зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1085165 - Get rid of the nsRenderingContext::SetColor() method. r=mattwoodrow
--HG-- extra : rebase_source : dc4604e04cae84b8dcbd2d9890191713555c8c7a
This commit is contained in:
Родитель
884793d6d9
Коммит
251f92b10b
|
@ -81,19 +81,6 @@ nsRenderingContext::Init(nsDeviceContext* aContext,
|
|||
Init(aContext, new gfxContext(aDrawTarget));
|
||||
}
|
||||
|
||||
//
|
||||
// graphics state
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::SetColor(nscolor aColor)
|
||||
{
|
||||
/* This sets the color assuming the sRGB color space, since that's
|
||||
* what all CSS colors are defined to be in by the spec.
|
||||
*/
|
||||
mThebes->SetColor(gfxRGBA(aColor));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// text
|
||||
|
|
|
@ -47,10 +47,6 @@ public:
|
|||
return int32_t(mP2A);
|
||||
}
|
||||
|
||||
// Graphics state
|
||||
|
||||
void SetColor(nscolor aColor);
|
||||
|
||||
// Text
|
||||
|
||||
void SetFont(nsFontMetrics *aFontMetrics);
|
||||
|
|
|
@ -3616,8 +3616,6 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
|
|||
uint8_t aEndBevelSide,
|
||||
nscoord aEndBevelOffset)
|
||||
{
|
||||
aContext.SetColor (aBorderColor);
|
||||
|
||||
bool horizontal = ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide));
|
||||
nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel);
|
||||
uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE;
|
||||
|
@ -3633,6 +3631,8 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
|
|||
AntialiasMode oldMode = ctx->CurrentAntialiasMode();
|
||||
ctx->SetAntialiasMode(AntialiasMode::NONE);
|
||||
|
||||
ctx->SetColor(aBorderColor);
|
||||
|
||||
switch (aBorderStyle) {
|
||||
case NS_STYLE_BORDER_STYLE_NONE:
|
||||
case NS_STYLE_BORDER_STYLE_HIDDEN:
|
||||
|
@ -3691,7 +3691,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
|
|||
mozilla::css::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
|
||||
// FIXME: In theory, this should use the visited-dependent
|
||||
// background color, but I don't care.
|
||||
aContext.SetColor (
|
||||
ctx->SetColor(
|
||||
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
|
||||
nsRect rect(aBorder);
|
||||
nscoord half;
|
||||
|
@ -3726,7 +3726,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
|
|||
ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
|
||||
// FIXME: In theory, this should use the visited-dependent
|
||||
// background color, but I don't care.
|
||||
aContext.SetColor (
|
||||
ctx->SetColor(
|
||||
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
|
||||
if (horizontal) {
|
||||
rect.y = rect.y + half;
|
||||
|
|
|
@ -10109,9 +10109,9 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
|||
ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f)));
|
||||
drawTarget->FillRect(devPxRect, black);
|
||||
|
||||
aRenderingContext->SetColor(color2);
|
||||
aRenderingContext->ThebesContext()->SetColor(color2);
|
||||
aRenderingContext->DrawString(buf, strlen(buf), x+15,y+15);
|
||||
aRenderingContext->SetColor(color);
|
||||
aRenderingContext->ThebesContext()->SetColor(color);
|
||||
aRenderingContext->DrawString(buf, strlen(buf), x,y);
|
||||
|
||||
aRenderingContext->ThebesContext()->Restore();
|
||||
|
|
|
@ -212,7 +212,7 @@ nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, mVisibleRect,
|
||||
foregroundColor, PaintTextShadowCallback,
|
||||
(void*)this);
|
||||
aCtx->SetColor(foregroundColor);
|
||||
aCtx->ThebesContext()->SetColor(foregroundColor);
|
||||
PaintTextToContext(aCtx, nsPoint(0, 0));
|
||||
}
|
||||
|
||||
|
|
|
@ -319,7 +319,6 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
|||
nsRefPtr<nsFontMetrics> fm;
|
||||
ColorPattern color(ToDeviceColor(
|
||||
nsLayoutUtils::GetColor(this, eCSSProperty_color)));
|
||||
aRenderingContext.SetColor(nsLayoutUtils::GetColor(this, eCSSProperty_color));
|
||||
|
||||
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
|
||||
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
|
||||
|
@ -421,6 +420,9 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
|||
break;
|
||||
|
||||
default:
|
||||
aRenderingContext.ThebesContext()->SetColor(
|
||||
nsLayoutUtils::GetColor(this, eCSSProperty_color));
|
||||
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
GetFontSizeInflation());
|
||||
GetListItemText(text);
|
||||
|
|
|
@ -1076,7 +1076,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
|||
const nsRect& aRect)
|
||||
{
|
||||
// Set font and color
|
||||
aRenderingContext.SetColor(StyleColor()->mColor);
|
||||
aRenderingContext.ThebesContext()->SetColor(StyleColor()->mColor);
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(this));
|
||||
|
|
|
@ -383,7 +383,7 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext,
|
|||
gfx->Save();
|
||||
gfx->Clip(NSRectToRect(aRect, PresContext()->AppUnitsPerDevPixel(),
|
||||
*drawTarget));
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
aRenderingContext.ThebesContext()->SetColor(NS_RGB(0,0,0));
|
||||
nsLayoutUtils::DrawString(this, &aRenderingContext, str.get(), str.Length(), nsPoint(x, y + aAscent));
|
||||
gfx->Restore();
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext,
|
|||
}
|
||||
|
||||
nsRect rect(aPt, mRect.Size());
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
aRenderingContext.ThebesContext()->SetColor(NS_RGB(0,0,0));
|
||||
|
||||
// Get the FontMetrics to determine width.height of strings
|
||||
nsRefPtr<nsFontMetrics> fontMet;
|
||||
|
|
|
@ -106,7 +106,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
|||
ColorPattern red(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
|
||||
drawTarget->FillRect(rect, red);
|
||||
|
||||
aCtx->SetColor(NS_RGB(255,255,255));
|
||||
aCtx->ThebesContext()->SetColor(NS_RGB(255,255,255));
|
||||
nscoord ascent = aCtx->FontMetrics()->MaxAscent();
|
||||
NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
|
||||
aCtx->DrawString(errorMsg.get(), uint32_t(errorMsg.Length()),
|
||||
|
|
|
@ -774,7 +774,8 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
|
|||
// paint the frame with the current text color
|
||||
ColorPattern color(ToDeviceColor(
|
||||
mFrame->GetVisitedDependentColor(eCSSProperty_color)));
|
||||
aCtx->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color));
|
||||
aCtx->ThebesContext()->SetColor(
|
||||
mFrame->GetVisitedDependentColor(eCSSProperty_color));
|
||||
|
||||
DrawTarget* drawTarget = aCtx->GetDrawTarget();
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
|
|||
gfxRect rect = presContext->AppUnitsToGfxUnits(mRect + ToReferenceFrame());
|
||||
|
||||
// paint with the current text color
|
||||
aCtx->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color));
|
||||
aCtx->ThebesContext()->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color));
|
||||
|
||||
// draw the slash as a parallelogram
|
||||
gfxContext *gfxCtx = aCtx->ThebesContext();
|
||||
|
|
|
@ -507,7 +507,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
|||
|
||||
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
|
||||
ColorPattern color(ToDeviceColor(c));
|
||||
aRenderingContext.SetColor(c);
|
||||
aRenderingContext.ThebesContext()->SetColor(c);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -3618,7 +3618,6 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
|
|||
|
||||
// Set our color.
|
||||
ColorPattern color(ToDeviceColor(textContext->StyleColor()->mColor));
|
||||
aRenderingContext.SetColor(textContext->StyleColor()->mColor);
|
||||
|
||||
// Draw decorations.
|
||||
uint8_t decorations = textContext->StyleTextReset()->mTextDecorationLine;
|
||||
|
@ -3652,6 +3651,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
|
|||
ctx->PushGroup(gfxContentType::COLOR_ALPHA);
|
||||
}
|
||||
|
||||
ctx->SetColor(textContext->StyleColor()->mColor);
|
||||
nsLayoutUtils::DrawString(this, &aRenderingContext, text.get(), text.Length(),
|
||||
textRect.TopLeft() + nsPoint(0, baseline), cellContext);
|
||||
|
||||
|
@ -3757,9 +3757,6 @@ nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
|
|||
// Adjust the rect for its border and padding.
|
||||
AdjustForBorderPadding(meterContext, meterRect);
|
||||
|
||||
// Set our color.
|
||||
aRenderingContext.SetColor(meterContext->StyleColor()->mColor);
|
||||
|
||||
// Now obtain the value for our cell.
|
||||
nsAutoString value;
|
||||
mView->GetCellValue(aRowIndex, aColumn, value);
|
||||
|
|
Загрузка…
Ссылка в новой задаче