Bug 1170688 - Move initialization of text-run parameters until *after* the draw target has been updated; r=jfkthame

This fixes a regression when painting semi-transparent synthetic bold text. When
we do that we update the draw target but refactoring in bug 1037340 part
2 caused us to store the draw target before it was updated.
This commit is contained in:
Brian Birtles 2015-06-22 11:45:39 +09:00
parent 1c2e2bc307
commit e87639d412

View File

@ -600,21 +600,6 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode,
return;
}
// Set up parameters that will be constant across all glyph runs we need
// to draw, regardless of the font used.
TextRunDrawParams params;
params.context = aContext;
params.devPerApp = 1.0 / double(GetAppUnitsPerDevUnit());
params.isVerticalRun = IsVertical();
params.isRTL = IsRightToLeft();
params.direction = direction;
params.drawMode = aDrawMode;
params.callbacks = aCallbacks;
params.runContextPaint = aContextPaint;
params.paintSVGGlyphs = !aCallbacks || aCallbacks->mShouldPaintSVGGlyphs;
params.dt = aContext->GetDrawTarget();
params.fontSmoothingBGColor = aContext->GetFontSmoothingBackgroundColor();
// synthetic bolding draws glyphs twice ==> colors with opacity won't draw
// correctly unless first drawn without alpha
BufferAlphaColor syntheticBoldBuffer(aContext);
@ -634,6 +619,21 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode,
GetAppUnitsPerDevUnit());
}
// Set up parameters that will be constant across all glyph runs we need
// to draw, regardless of the font used.
TextRunDrawParams params;
params.context = aContext;
params.devPerApp = 1.0 / double(GetAppUnitsPerDevUnit());
params.isVerticalRun = IsVertical();
params.isRTL = IsRightToLeft();
params.direction = direction;
params.drawMode = aDrawMode;
params.callbacks = aCallbacks;
params.runContextPaint = aContextPaint;
params.paintSVGGlyphs = !aCallbacks || aCallbacks->mShouldPaintSVGGlyphs;
params.dt = aContext->GetDrawTarget();
params.fontSmoothingBGColor = aContext->GetFontSmoothingBackgroundColor();
GlyphRunIterator iter(this, aStart, aLength);
gfxFloat advance = 0.0;