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.
*/
#define ToDeviceUnits(aAppUnits, aDevUnitsPerAppUnit) \
(double(aAppUnits)*double(aDevUnitsPerAppUnit))
(aAppUnits * gfx::Float(aDevUnitsPerAppUnit))
static AntialiasMode Get2DAAMode(gfxFont::AntialiasOption aAAOption) {
switch (aAAOption) {
@ -1863,7 +1863,7 @@ private:
// when a non-identity transform exists. Use an offset factor so that
// the second draw occurs at a constant offset in device pixels.
double
gfx::Float
gfxFont::CalcXScale(DrawTarget* aDrawTarget)
{
// determine magnitude of a 1px x offset in device space
@ -1873,7 +1873,7 @@ gfxFont::CalcXScale(DrawTarget* aDrawTarget)
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");
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.
// (these values are only needed if IsSyntheticBold() is true)
if (IsSyntheticBold()) {
double xscale = CalcXScale(aRunParams.context->GetDrawTarget());
gfx::Float xscale = CalcXScale(aRunParams.context->GetDrawTarget());
fontParams.synBoldOnePixelOffset = aRunParams.direction * xscale;
if (xscale != 0.0) {
// 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.
// This helper calculates the scale factor we need to apply to the
// 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
@ -2301,8 +2301,8 @@ struct MOZ_STACK_CLASS TextRunDrawParams {
gfxTextRunDrawCallbacks *callbacks;
mozilla::SVGContextPaint *runContextPaint;
mozilla::gfx::Color fontSmoothingBGColor;
gfxFloat direction;
double devPerApp;
mozilla::gfx::Float direction;
mozilla::gfx::Float devPerApp;
nscolor textStrokeColor;
gfxPattern *textStrokePattern;
const mozilla::gfx::StrokeOptions *strokeOpts;
@ -2319,7 +2319,7 @@ struct MOZ_STACK_CLASS FontDrawParams {
mozilla::SVGContextPaint *contextPaint;
mozilla::gfx::Matrix *passedInvMatrix;
mozilla::gfx::Matrix matInv;
double synBoldOnePixelOffset;
mozilla::gfx::Float synBoldOnePixelOffset;
int32_t extraStrikes;
mozilla::gfx::DrawOptions drawOptions;
bool isVerticalFont;