mirror of https://github.com/odrling/Aegisub
Fix a bunch of float <-> double conversion warnings
This commit is contained in:
parent
ec407bbd7f
commit
51b92390b6
|
@ -58,7 +58,7 @@ AudioColorScheme::AudioColorScheme(int prec, std::string const& scheme_name, int
|
||||||
|
|
||||||
for (size_t i = 0; i <= factor; ++i)
|
for (size_t i = 0; i <= factor; ++i)
|
||||||
{
|
{
|
||||||
float t = (float)i / factor;
|
auto t = (double)i / factor;
|
||||||
hsl_to_rgb(
|
hsl_to_rgb(
|
||||||
mid<int>(0, h_base + t * h_scale, 255),
|
mid<int>(0, h_base + t * h_scale, 255),
|
||||||
mid<int>(0, s_base + t * s_scale, 255),
|
mid<int>(0, s_base + t * s_scale, 255),
|
||||||
|
|
|
@ -178,7 +178,7 @@ void AudioSpectrumRenderer::FillBlock(size_t block_index, float *block)
|
||||||
|
|
||||||
fftw_execute(dft_plan);
|
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;
|
fftw_complex *o = dft_output;
|
||||||
for (size_t si = 1<<derivation_size; si > 0; --si)
|
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);
|
||||||
assert(px < imgdata + imgheight*stride);
|
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 sample1 = power[(int)floor(ideal)+minband];
|
||||||
float sample2 = power[(int)ceil(ideal)+minband];
|
float sample2 = power[(int)ceil(ideal)+minband];
|
||||||
float frac = ideal - floor(ideal);
|
float frac = ideal - floor(ideal);
|
||||||
|
|
|
@ -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;
|
l = L / 255.f;
|
||||||
|
|
||||||
float temp2;
|
float temp2;
|
||||||
if (l < .5) {
|
if (l < .5f) {
|
||||||
temp2 = l * (1. + s);
|
temp2 = l * (1.f + s);
|
||||||
} else {
|
} else {
|
||||||
temp2 = l + s - l*s;
|
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;
|
h = 0;
|
||||||
s = 0;
|
s = 0;
|
||||||
} else {
|
} else {
|
||||||
if (l < 0.5) {
|
if (l < .5f) {
|
||||||
s = (maxrgb - minrgb) / (maxrgb + minrgb);
|
s = (maxrgb - minrgb) / (maxrgb + minrgb);
|
||||||
} else {
|
} else {
|
||||||
s = (maxrgb - minrgb) / (2.f - maxrgb - minrgb);
|
s = (maxrgb - minrgb) / (2.f - maxrgb - minrgb);
|
||||||
|
|
|
@ -131,12 +131,12 @@ void OpenGLWrapper::DrawRectangle(Vector2D p1, Vector2D p2) const {
|
||||||
buf.Set(3, Vector2D(p1, p2));
|
buf.Set(3, Vector2D(p1, p2));
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
if (fill_a != 0.0) {
|
if (fill_a != 0.f) {
|
||||||
SetModeFill();
|
SetModeFill();
|
||||||
buf.Draw(GL_QUADS, false);
|
buf.Draw(GL_QUADS, false);
|
||||||
}
|
}
|
||||||
// Outline
|
// Outline
|
||||||
if (line_a != 0.0) {
|
if (line_a != 0.f) {
|
||||||
SetModeLine();
|
SetModeLine();
|
||||||
buf.Draw(GL_LINE_LOOP);
|
buf.Draw(GL_LINE_LOOP);
|
||||||
}
|
}
|
||||||
|
@ -149,12 +149,12 @@ void OpenGLWrapper::DrawTriangle(Vector2D p1, Vector2D p2, Vector2D p3) const {
|
||||||
buf.Set(2, p3);
|
buf.Set(2, p3);
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
if (fill_a != 0.0) {
|
if (fill_a != 0.f) {
|
||||||
SetModeFill();
|
SetModeFill();
|
||||||
buf.Draw(GL_TRIANGLES, false);
|
buf.Draw(GL_TRIANGLES, false);
|
||||||
}
|
}
|
||||||
// Outline
|
// Outline
|
||||||
if (line_a != 0.0) {
|
if (line_a != 0.f) {
|
||||||
SetModeLine();
|
SetModeLine();
|
||||||
buf.Draw(GL_LINE_LOOP);
|
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_inner = Vector2D(ar, 1) * r1;
|
||||||
Vector2D scale_outer = Vector2D(ar, 1) * r2;
|
Vector2D scale_outer = Vector2D(ar, 1) * r2;
|
||||||
|
|
||||||
if (fill_a != 0.0) {
|
if (fill_a != 0.f) {
|
||||||
SetModeFill();
|
SetModeFill();
|
||||||
|
|
||||||
// Annulus
|
// Annulus
|
||||||
|
@ -210,7 +210,7 @@ void OpenGLWrapper::DrawRing(Vector2D center, float r1, float r2, float ar, floa
|
||||||
cur_angle = arc_start;
|
cur_angle = arc_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_a == 0.0) return;
|
if (line_a == 0.f) return;
|
||||||
|
|
||||||
// Outer
|
// Outer
|
||||||
steps++;
|
steps++;
|
||||||
|
|
|
@ -282,13 +282,13 @@ void VideoDisplay::PositionVideo() {
|
||||||
double videoAr = arType == AspectRatio::Default ? double(vidW) / vidH : con->videoController->GetAspectRatioValue();
|
double videoAr = arType == AspectRatio::Default ? double(vidW) / vidH : con->videoController->GetAspectRatioValue();
|
||||||
|
|
||||||
// Window is wider than video, blackbox left/right
|
// 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;
|
int delta = viewport_width - videoAr * viewport_height;
|
||||||
viewport_left = delta / 2;
|
viewport_left = delta / 2;
|
||||||
viewport_width -= delta;
|
viewport_width -= delta;
|
||||||
}
|
}
|
||||||
// Video is wider than window, blackbox top/bottom
|
// 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;
|
int delta = viewport_height - viewport_width / videoAr;
|
||||||
viewport_top = viewport_bottom = delta / 2;
|
viewport_top = viewport_bottom = delta / 2;
|
||||||
viewport_height -= delta;
|
viewport_height -= delta;
|
||||||
|
|
Loading…
Reference in New Issue