1
0
Fork 0

Fix a bunch of float <-> double conversion warnings

This commit is contained in:
Thomas Goyne 2014-07-16 18:02:33 -07:00
parent ec407bbd7f
commit 51b92390b6
5 changed files with 14 additions and 14 deletions

View File

@ -58,7 +58,7 @@ AudioColorScheme::AudioColorScheme(int prec, std::string const& scheme_name, int
for (size_t i = 0; i <= factor; ++i)
{
float t = (float)i / factor;
auto t = (double)i / factor;
hsl_to_rgb(
mid<int>(0, h_base + t * h_scale, 255),
mid<int>(0, s_base + t * s_scale, 255),

View File

@ -178,7 +178,7 @@ void AudioSpectrumRenderer::FillBlock(size_t block_index, float *block)
fftw_execute(dft_plan);
float scale_factor = 9 / sqrt(2 * (float)(2<<derivation_size));
double scale_factor = 9 / sqrt(2 << (derivation_size + 1));
fftw_complex *o = dft_output;
for (size_t si = 1<<derivation_size; si > 0; --si)
@ -253,7 +253,7 @@ void AudioSpectrumRenderer::Render(wxBitmap &bmp, int start, AudioRenderingStyle
{
assert(px >= imgdata);
assert(px < imgdata + imgheight*stride);
float ideal = (float)(y+1.)/imgheight * (maxband-minband) + minband;
auto ideal = (double)(y+1.)/imgheight * (maxband-minband) + minband;
float sample1 = power[(int)floor(ideal)+minband];
float sample2 = power[(int)ceil(ideal)+minband];
float frac = ideal - floor(ideal);

View File

@ -92,8 +92,8 @@ void hsl_to_rgb(int H, int S, int L, unsigned char *R, unsigned char *G, unsigne
l = L / 255.f;
float temp2;
if (l < .5) {
temp2 = l * (1. + s);
if (l < .5f) {
temp2 = l * (1.f + s);
} else {
temp2 = l + s - l*s;
}
@ -257,7 +257,7 @@ void rgb_to_hsl(int R, int G, int B, unsigned char *H, unsigned char *S, unsigne
h = 0;
s = 0;
} else {
if (l < 0.5) {
if (l < .5f) {
s = (maxrgb - minrgb) / (maxrgb + minrgb);
} else {
s = (maxrgb - minrgb) / (2.f - maxrgb - minrgb);

View File

@ -131,12 +131,12 @@ void OpenGLWrapper::DrawRectangle(Vector2D p1, Vector2D p2) const {
buf.Set(3, Vector2D(p1, p2));
// Fill
if (fill_a != 0.0) {
if (fill_a != 0.f) {
SetModeFill();
buf.Draw(GL_QUADS, false);
}
// Outline
if (line_a != 0.0) {
if (line_a != 0.f) {
SetModeLine();
buf.Draw(GL_LINE_LOOP);
}
@ -149,12 +149,12 @@ void OpenGLWrapper::DrawTriangle(Vector2D p1, Vector2D p2, Vector2D p3) const {
buf.Set(2, p3);
// Fill
if (fill_a != 0.0) {
if (fill_a != 0.f) {
SetModeFill();
buf.Draw(GL_TRIANGLES, false);
}
// Outline
if (line_a != 0.0) {
if (line_a != 0.f) {
SetModeLine();
buf.Draw(GL_LINE_LOOP);
}
@ -183,7 +183,7 @@ void OpenGLWrapper::DrawRing(Vector2D center, float r1, float r2, float ar, floa
Vector2D scale_inner = Vector2D(ar, 1) * r1;
Vector2D scale_outer = Vector2D(ar, 1) * r2;
if (fill_a != 0.0) {
if (fill_a != 0.f) {
SetModeFill();
// Annulus
@ -210,7 +210,7 @@ void OpenGLWrapper::DrawRing(Vector2D center, float r1, float r2, float ar, floa
cur_angle = arc_start;
}
if (line_a == 0.0) return;
if (line_a == 0.f) return;
// Outer
steps++;

View File

@ -282,13 +282,13 @@ void VideoDisplay::PositionVideo() {
double videoAr = arType == AspectRatio::Default ? double(vidW) / vidH : con->videoController->GetAspectRatioValue();
// Window is wider than video, blackbox left/right
if (displayAr - videoAr > 0.01f) {
if (displayAr - videoAr > 0.01) {
int delta = viewport_width - videoAr * viewport_height;
viewport_left = delta / 2;
viewport_width -= delta;
}
// Video is wider than window, blackbox top/bottom
else if (videoAr - displayAr > 0.01f) {
else if (videoAr - displayAr > 0.01) {
int delta = viewport_height - viewport_width / videoAr;
viewport_top = viewport_bottom = delta / 2;
viewport_height -= delta;