Bug 1414154 - Remove gfxContext::Set/GetFontSmoothingBackgroundColor and TextRunDrawParams::fontSmoothingBGColor. r?lsalzman
MozReview-Commit-ID: BXZP3maOJRi
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -746,29 +746,16 @@ gfxContext::GetPattern()
} else if (state.sourceSurface) {
NS_ASSERTION(false, "Ugh, this isn't good.");
} else {
pat = new gfxPattern(state.color);
}
return pat.forget();
}
-void
-gfxContext::SetFontSmoothingBackgroundColor(const Color& aColor)
-{
- CURRENTSTATE_CHANGED()
- CurrentState().fontSmoothingBackgroundColor = aColor;
-}
-
-Color
-gfxContext::GetFontSmoothingBackgroundColor()
-{
- return CurrentState().fontSmoothingBackgroundColor;
-}
-
// masking
void
gfxContext::Mask(SourceSurface* aSurface, Float aAlpha, const Matrix& aTransform)
{
Matrix old = mTransform;
Matrix mat = aTransform * mTransform;
ChangeTransform(mat);
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -277,23 +277,16 @@ public:
void SetSource(gfxASurface *surface, const gfxPoint& offset = gfxPoint(0.0, 0.0));
/**
* Uses a pattern for drawing.
*/
void SetPattern(gfxPattern *pattern);
/**
- * Set the color that text drawn on top of transparent pixels should be
- * anti-aliased into.
- */
- void SetFontSmoothingBackgroundColor(const mozilla::gfx::Color& aColor);
- mozilla::gfx::Color GetFontSmoothingBackgroundColor();
-
- /**
* Get the source pattern (solid color, normal pattern, surface, etc)
*/
already_AddRefed<gfxPattern> GetPattern();
/**
** Painting
**/
/**
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -2293,17 +2293,16 @@ protected:
// are dependent on the specific font, so they are set per GlyphRun.
struct MOZ_STACK_CLASS TextRunDrawParams {
RefPtr<mozilla::gfx::DrawTarget> dt;
gfxContext *context;
gfxFont::Spacing *spacing;
gfxTextRunDrawCallbacks *callbacks;
mozilla::SVGContextPaint *runContextPaint;
- mozilla::gfx::Color fontSmoothingBGColor;
mozilla::gfx::Float direction;
double devPerApp;
nscolor textStrokeColor;
gfxPattern *textStrokePattern;
const mozilla::gfx::StrokeOptions *strokeOpts;
const mozilla::gfx::DrawOptions *drawOpts;
DrawMode drawMode;
bool isVerticalRun;
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -674,18 +674,16 @@ gfxTextRun::Draw(Range aRange, gfx::Poin
params.textStrokePattern = aParams.textStrokePattern;
params.drawOpts = aParams.drawOpts;
params.drawMode = aParams.drawMode;
params.callbacks = aParams.callbacks;
params.runContextPaint = aParams.contextPaint;
params.paintSVGGlyphs = !aParams.callbacks ||
aParams.callbacks->mShouldPaintSVGGlyphs;
params.dt = aParams.context->GetDrawTarget();
- params.fontSmoothingBGColor =
- aParams.context->GetFontSmoothingBackgroundColor();
GlyphRunIterator iter(this, aRange);
gfxFloat advance = 0.0;
while (iter.NextRun()) {
gfxFont *font = iter.GetGlyphRun()->mFont;
uint32_t start = iter.GetStringStart();
uint32_t end = iter.GetStringEnd();
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -7087,20 +7087,17 @@ nsTextFrame::PaintText(const PaintTextPa
params.textStyle = &textPaintStyle;
params.textColor = foregroundColor;
params.textStrokeColor = textStrokeColor;
params.textStrokeWidth = textPaintStyle.GetWebkitTextStrokeWidth();
params.clipEdges = &clipEdges;
params.drawSoftHyphen = (GetStateBits() & TEXT_HYPHEN_BREAK) != 0;
params.contextPaint = aParams.contextPaint;
params.callbacks = aParams.callbacks;
- aParams.context->SetFontSmoothingBackgroundColor(
- Color::FromABGR(StyleFont()->mFont.fontSmoothingBackgroundColor));
DrawText(range, textBaselinePt, params);
- aParams.context->SetFontSmoothingBackgroundColor(Color());
}
static void
DrawTextRun(const gfxTextRun* aTextRun,
const gfx::Point& aTextBaselinePt,
gfxTextRun::Range aRange,
const nsTextFrame::DrawTextRunParams& aParams)
{
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -521,18 +521,16 @@ nsTextBoxFrame::DrawText(gfxContext&
PresContext()->PresShell()->CreateReferenceRenderingContext();
DrawTarget* refDrawTarget = refContext->GetDrawTarget();
CalculateUnderline(refDrawTarget, *fontMet);
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
ColorPattern color(ToDeviceColor(c));
aRenderingContext.SetColor(Color::FromABGR(c));
- aRenderingContext.SetFontSmoothingBackgroundColor(
- Color::FromABGR(StyleFont()->mFont.fontSmoothingBackgroundColor));
nsresult rv = NS_ERROR_FAILURE;
if (mState & NS_FRAME_IS_BIDI) {
presContext->SetBidiEnabled();
nsBidiLevel level = nsBidiPresUtils::BidiLevelFromStyle(StyleContext());
if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
// We let the RenderText function calculate the mnemonic's
@@ -594,18 +592,16 @@ nsTextBoxFrame::DrawText(gfxContext&
fontMet->GetStrikeout(offset, size);
params.color = strikeColor;
params.lineSize.height = presContext->AppUnitsToGfxUnits(size);
params.offset = presContext->AppUnitsToGfxUnits(offset);
params.decoration = NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
params.style = strikeStyle;
nsCSSRendering::PaintDecorationLine(this, *drawTarget, params);
}
-
- aRenderingContext.SetFontSmoothingBackgroundColor(Color());
}
void
nsTextBoxFrame::CalculateUnderline(DrawTarget* aDrawTarget,
nsFontMetrics& aFontMetrics)
{
if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
// Calculate all fields of mAccessKeyInfo which
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -3056,20 +3056,16 @@ nsTreeBodyFrame::PaintRow(int32_t
// Paint our borders and background for our row rect.
nsITheme* theme = nullptr;
auto appearance = rowContext->StyleDisplay()->mAppearance;
if (appearance) {
theme = aPresContext->GetTheme();
}
- // Save the current font smoothing background color in case we change it.
- Color originalColor(aRenderingContext.GetFontSmoothingBackgroundColor());
- aRenderingContext.SetFontSmoothingBackgroundColor(
- ToDeviceColor(rowContext->StyleFont()->mFont.fontSmoothingBackgroundColor));
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, appearance)) {
nsRect dirty;
dirty.IntersectRect(rowRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this, appearance, rowRect,
dirty);
} else {
result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
rowRect, aDirtyRect);
@@ -3169,21 +3165,16 @@ nsTreeBodyFrame::PaintRow(int32_t
nscoord dummy;
if (dirtyRect.IntersectRect(aDirtyRect, checkRect))
result &= PaintCell(aRowIndex, currCol, cellRect, aPresContext,
aRenderingContext, aDirtyRect, dummy, aPt,
aBuilder);
}
}
}
- // If we've changed the font smoothing background color for this row, restore
- // the color to the original one.
- if (originalColor != aRenderingContext.GetFontSmoothingBackgroundColor()) {
- aRenderingContext.SetFontSmoothingBackgroundColor(originalColor);
- }
return result;
}
DrawResult
nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
const nsRect& aSeparatorRect,
nsPresContext* aPresContext,