From 401f6fa8e43de95afa3fcc26d05ff3ae68e71358 Mon Sep 17 00:00:00 2001 From: Roel Baars <6567747+Thanatomanic@users.noreply.github.com> Date: Thu, 20 Sep 2018 07:58:54 +0200 Subject: [PATCH] Should fix coverity issue 191811 - and a little extra --- rtgui/histogrampanel.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 5293c6c00..e50a4a72a 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -820,14 +820,14 @@ void HistogramArea::updateBackBuffer () // draw vertical gridlines if (options.histogramDrawMode < 2) { for (int i = 1; i < nrOfVGridPartitions; i++) { - cr->move_to ((pow(2.0,i) - 1) / 255 * w + 0.5, 1.5); - cr->line_to ((pow(2.0,i) - 1) / 255 * w + 0.5, h - 2); + cr->move_to ((pow(2.0,i) - 1) / 255.0 * w + 0.5, 1.5); + cr->line_to ((pow(2.0,i) - 1) / 255.0 * w + 0.5, h - 2); cr->stroke (); } } else { for (int i = 1; i < nrOfVGridPartitions; i++) { - cr->move_to (HistogramScaling::log (255, pow(2.0,i) - 1) / 255 * w + 0.5, 1.5); - cr->line_to (HistogramScaling::log (255, pow(2.0,i) - 1) / 255 * w + 0.5, h - 2); + cr->move_to (HistogramScaling::log (255, pow(2.0,i) - 1) / 255.0 * w + 0.5, 1.5); + cr->line_to (HistogramScaling::log (255, pow(2.0,i) - 1) / 255.0 * w + 0.5, h - 2); cr->stroke (); } } @@ -835,14 +835,14 @@ void HistogramArea::updateBackBuffer () // draw horizontal gridlines if (options.histogramDrawMode == 0) { for (int i = 1; i < nrOfHGridPartitions; i++) { - cr->move_to (1.5, i * h / nrOfHGridPartitions + 0.5); - cr->line_to (w - 2, i * h / nrOfHGridPartitions + 0.5); + cr->move_to (1.5, i * (double)h / nrOfHGridPartitions + 0.5); + cr->line_to (w - 2, i * (double)h / nrOfHGridPartitions + 0.5); cr->stroke (); } } else { for (int i = 1; i < nrOfHGridPartitions; i++) { - cr->move_to (1.5, h - HistogramScaling::log (h, i * h / nrOfHGridPartitions) + 0.5); - cr->line_to (w - 2, h - HistogramScaling::log (h, i * h / nrOfHGridPartitions) + 0.5); + cr->move_to (1.5, h - HistogramScaling::log (h, i * (double)h / nrOfHGridPartitions) + 0.5); + cr->line_to (w - 2, h - HistogramScaling::log (h, i * (double)h / nrOfHGridPartitions) + 0.5); cr->stroke (); } } @@ -1086,4 +1086,4 @@ bool HistogramArea::on_motion_notify_event (GdkEventMotion* event) HistogramArea::type_signal_factor_changed HistogramArea::signal_factor_changed() { return sigFactorChanged; -} \ No newline at end of file +}