Fix eight trivial "implicit conversion 'double' to 'int'" warnings. NFC.

pull/533/head
ruevs 2019-12-17 14:02:26 +02:00 committed by whitequark
parent 64c0f62b92
commit 16c5fa6889
4 changed files with 8 additions and 8 deletions

View File

@ -708,8 +708,8 @@ void OpenGl1Renderer::UpdateProjection() {
UnSelectPrimitive(); UnSelectPrimitive();
glViewport(0, 0, glViewport(0, 0,
camera.width * camera.pixelRatio, (GLsizei)(camera.width * camera.pixelRatio),
camera.height * camera.pixelRatio); (GLsizei)(camera.height * camera.pixelRatio));
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
@ -821,8 +821,8 @@ void OpenGl1Renderer::FinishFrame() {
} }
std::shared_ptr<Pixmap> OpenGl1Renderer::ReadFrame() { std::shared_ptr<Pixmap> OpenGl1Renderer::ReadFrame() {
int width = camera.width * camera.pixelRatio; int width = (int)(camera.width * camera.pixelRatio);
int height = camera.height * camera.pixelRatio; int height = (int)(camera.height * camera.pixelRatio);
std::shared_ptr<Pixmap> pixmap = std::shared_ptr<Pixmap> pixmap =
Pixmap::Create(Pixmap::Format::RGB, (size_t)width, (size_t)height); Pixmap::Create(Pixmap::Format::RGB, (size_t)width, (size_t)height);
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixmap->data[0]); glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixmap->data[0]);

View File

@ -361,7 +361,7 @@ std::string SolveSpaceUI::MmToStringSI(double v, int dim) {
} }
v /= pow((viewUnits == Unit::INCHES) ? 25.4 : 1000, dim); v /= pow((viewUnits == Unit::INCHES) ? 25.4 : 1000, dim);
int vdeg = floor((log10(fabs(v))) / dim); int vdeg = (int)((log10(fabs(v))) / dim);
std::string unit; std::string unit;
if(fabs(v) > 0.0) { if(fabs(v) > 0.0) {
int sdeg = 0; int sdeg = 0;
@ -371,7 +371,7 @@ std::string SolveSpaceUI::MmToStringSI(double v, int dim) {
: SelectSIPrefixMm(vdeg); : SelectSIPrefixMm(vdeg);
v /= pow(10.0, sdeg * dim); v /= pow(10.0, sdeg * dim);
} }
int pdeg = ceil(log10(fabs(v) + 1e-10)); int pdeg = (int)ceil(log10(fabs(v) + 1e-10));
return ssprintf("%#.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v, return ssprintf("%#.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v,
compact ? "" : " ", unit.c_str(), DimToString(dim)); compact ? "" : " ", unit.c_str(), DimToString(dim));
} }

View File

@ -646,7 +646,7 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
// for testing - hard code the axial distance, and number of sections. // for testing - hard code the axial distance, and number of sections.
// distance will need to be parameters in the future. // distance will need to be parameters in the future.
double dist = distf - dists; double dist = distf - dists;
int sections = fabs(anglef - angles) / (PI / 2) + 1; int sections = (int)(fabs(anglef - angles) / (PI / 2) + 1);
double wedge = (anglef - angles) / sections; double wedge = (anglef - angles) / sections;
if(CheckNormalAxisRelationship(sbls, pt, axis, anglef-angles, distf-dists)) { if(CheckNormalAxisRelationship(sbls, pt, axis, anglef-angles, distf-dists)) {

View File

@ -219,7 +219,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas,
{ {
if(hitCommand) *hitCommand = icon.command; if(hitCommand) *hitCommand = icon.command;
if(hitX) *hitX = x - boxhw; if(hitX) *hitX = x - boxhw;
if(hitY) *hitY = height - (y + boxhw); if(hitY) *hitY = (int)height - (y + boxhw);
} }
} }