Should fix coverity issue 191811 - and a little extra

This commit is contained in:
Roel Baars
2018-09-20 07:58:54 +02:00
committed by GitHub
parent c36533704a
commit 401f6fa8e4

View File

@@ -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;
}
}