Bug 1408612 followup - Change a few more doubles to floats in the gfxFont drawing code paths. r=jrmuizel

This commit is contained in:
Jonathan Kew 2017-10-26 21:00:22 +01:00
parent 5eae3d23c8
commit c9060d927c
2 changed files with 8 additions and 8 deletions

View File

@ -1568,7 +1568,7 @@ gfxFont::HasFeatureSet(uint32_t aFeature, bool& aFeatureOn)
* processing here. * processing here.
*/ */
#define ToDeviceUnits(aAppUnits, aDevUnitsPerAppUnit) \ #define ToDeviceUnits(aAppUnits, aDevUnitsPerAppUnit) \
(double(aAppUnits)*double(aDevUnitsPerAppUnit)) (aAppUnits * gfx::Float(aDevUnitsPerAppUnit))
static AntialiasMode Get2DAAMode(gfxFont::AntialiasOption aAAOption) { static AntialiasMode Get2DAAMode(gfxFont::AntialiasOption aAAOption) {
switch (aAAOption) { switch (aAAOption) {
@ -1863,7 +1863,7 @@ private:
// when a non-identity transform exists. Use an offset factor so that // when a non-identity transform exists. Use an offset factor so that
// the second draw occurs at a constant offset in device pixels. // the second draw occurs at a constant offset in device pixels.
double gfx::Float
gfxFont::CalcXScale(DrawTarget* aDrawTarget) gfxFont::CalcXScale(DrawTarget* aDrawTarget)
{ {
// determine magnitude of a 1px x offset in device space // determine magnitude of a 1px x offset in device space
@ -1873,7 +1873,7 @@ gfxFont::CalcXScale(DrawTarget* aDrawTarget)
return 1.0; return 1.0;
} }
double m = sqrt(t.width * t.width + t.height * t.height); gfx::Float m = sqrtf(t.width * t.width + t.height * t.height);
NS_ASSERTION(m != 0.0, "degenerate transform while synthetic bolding"); NS_ASSERTION(m != 0.0, "degenerate transform while synthetic bolding");
if (m == 0.0) { if (m == 0.0) {
@ -2216,7 +2216,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
// Synthetic-bold strikes are each offset one device pixel in run direction. // Synthetic-bold strikes are each offset one device pixel in run direction.
// (these values are only needed if IsSyntheticBold() is true) // (these values are only needed if IsSyntheticBold() is true)
if (IsSyntheticBold()) { if (IsSyntheticBold()) {
double xscale = CalcXScale(aRunParams.context->GetDrawTarget()); gfx::Float xscale = CalcXScale(aRunParams.context->GetDrawTarget());
fontParams.synBoldOnePixelOffset = aRunParams.direction * xscale; fontParams.synBoldOnePixelOffset = aRunParams.direction * xscale;
if (xscale != 0.0) { if (xscale != 0.0) {
// use as many strikes as needed for the the increased advance // use as many strikes as needed for the the increased advance

View File

@ -2284,7 +2284,7 @@ protected:
// the second draw occurs at a constant offset in device pixels. // the second draw occurs at a constant offset in device pixels.
// This helper calculates the scale factor we need to apply to the // This helper calculates the scale factor we need to apply to the
// synthetic-bold offset. // synthetic-bold offset.
static double CalcXScale(DrawTarget* aDrawTarget); static mozilla::gfx::Float CalcXScale(DrawTarget* aDrawTarget);
}; };
// proportion of ascent used for x-height, if unable to read value from font // proportion of ascent used for x-height, if unable to read value from font
@ -2301,8 +2301,8 @@ struct MOZ_STACK_CLASS TextRunDrawParams {
gfxTextRunDrawCallbacks *callbacks; gfxTextRunDrawCallbacks *callbacks;
mozilla::SVGContextPaint *runContextPaint; mozilla::SVGContextPaint *runContextPaint;
mozilla::gfx::Color fontSmoothingBGColor; mozilla::gfx::Color fontSmoothingBGColor;
gfxFloat direction; mozilla::gfx::Float direction;
double devPerApp; mozilla::gfx::Float devPerApp;
nscolor textStrokeColor; nscolor textStrokeColor;
gfxPattern *textStrokePattern; gfxPattern *textStrokePattern;
const mozilla::gfx::StrokeOptions *strokeOpts; const mozilla::gfx::StrokeOptions *strokeOpts;
@ -2319,7 +2319,7 @@ struct MOZ_STACK_CLASS FontDrawParams {
mozilla::SVGContextPaint *contextPaint; mozilla::SVGContextPaint *contextPaint;
mozilla::gfx::Matrix *passedInvMatrix; mozilla::gfx::Matrix *passedInvMatrix;
mozilla::gfx::Matrix matInv; mozilla::gfx::Matrix matInv;
double synBoldOnePixelOffset; mozilla::gfx::Float synBoldOnePixelOffset;
int32_t extraStrikes; int32_t extraStrikes;
mozilla::gfx::DrawOptions drawOptions; mozilla::gfx::DrawOptions drawOptions;
bool isVerticalFont; bool isVerticalFont;