Avoid -Wdouble-promotion warnings

This commit is contained in:
Paul Cornett
2020-10-14 11:07:55 -07:00
parent 97655e5b21
commit b5a554b9a6
44 changed files with 208 additions and 201 deletions

View File

@@ -691,11 +691,11 @@ bool wxRichTextFormattingDialog::ConvertFromString(const wxString& str, int& ret
}
else if (unit == wxTEXT_ATTR_UNITS_TENTHS_MM)
{
float value = 0.0;
float value = 0;
wxSscanf(str.c_str(), wxT("%f"), &value);
// Convert from cm
// Do this in two steps, since using one step causes strange rounding error for VS 2010 at least.
float v = (value * 100.0);
float v = value * 100;
ret = (int) (v);
return true;
}
@@ -706,9 +706,9 @@ bool wxRichTextFormattingDialog::ConvertFromString(const wxString& str, int& ret
}
else if (unit == wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT)
{
float value = 0.0;
float value = 0;
wxSscanf(str.c_str(), wxT("%f"), &value);
float v = (value * 100.0);
float v = value * 100;
ret = (int) (v);
}
else if (unit == wxTEXT_ATTR_UNITS_POINTS)

View File

@@ -331,7 +331,7 @@ void wxRichTextPrintout::CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& he
// This scales the DC so that the printout roughly represents the
// the screen scaling.
float scale = (float)((float)ppiPrinterX/(float)ppiScreenX);
const double scale = double(ppiPrinterX) / ppiScreenX;
// Now we have to check in case our real page size is reduced
// (e.g. because we're drawing to a print preview memory DC)
@@ -342,13 +342,13 @@ void wxRichTextPrintout::CalculateScaling(wxDC* dc, wxRect& textRect, wxRect& he
// If printer pageWidth == current DC width, then this doesn't
// change. But w might be the preview bitmap width, so scale down.
float previewScale = (float)(w/(float)pageWidth);
float overallScale = scale * previewScale;
const double previewScale = double(w) / pageWidth;
const double overallScale = scale * previewScale;
// The dimensions used for indentation etc. have to be unscaled
// during printing to be correct when scaling is applied.
// Also, correct the conversions in wxRTC using DC instead of print DC.
m_richTextBuffer->SetScale(scale * float(dc->GetPPI().x)/float(ppiPrinterX));
m_richTextBuffer->SetScale(scale * dc->GetPPI().x / ppiPrinterX);
// Calculate margins
int marginLeft = wxRichTextObject::ConvertTenthsMMToPixels(ppiPrinterX, m_marginLeft);