From 44323cef6d8ab07c63ba177f07e22e853db97ef1 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 22 Dec 2012 20:26:43 -0800 Subject: [PATCH] Use max_element rather than a loop --- aegisub/src/audio_renderer_spectrum.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/aegisub/src/audio_renderer_spectrum.cpp b/aegisub/src/audio_renderer_spectrum.cpp index fb6b5542d..b05f6ee59 100644 --- a/aegisub/src/audio_renderer_spectrum.cpp +++ b/aegisub/src/audio_renderer_spectrum.cpp @@ -294,9 +294,7 @@ void AudioSpectrumRenderer::Render(wxBitmap &bmp, int start, AudioRenderingStyle assert(px < imgdata + imgheight*stride); int sample1 = std::max(0, maxband * y/imgheight + minband); int sample2 = std::min((1< maxval) maxval = power[samp]; + float maxval = *std::max_element(&power[sample1], &power[sample2 + 1]); pal->map(maxval*amplitude_scale, px); px -= stride; }