From 2f426d4310d6c0fa73a9f3381ad08cee02ec77ef Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 10 Nov 2015 13:02:55 +0100 Subject: [PATCH] [TASK] Make more use of qRound() --- imageviewer-qt4.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 4fc8c19..be1cd0e 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -108,7 +108,6 @@ void ImageViewer::convertToMonochrome() { } } - /** * Draws a simple, black line. * @brief ImageViewer::drawBlackLine @@ -245,7 +244,7 @@ int ImageViewer::getAverageIntensity() { for(int i=0; i<256;i++) { sumIntensity += (i*grayscale_relative_histogramm[i]); } - return (int)sumIntensity; + return (int) qRound(sumIntensity); } /** @@ -287,7 +286,7 @@ void ImageViewer::updateHistogramm() { histogramm->fill(QColor::fromRgb(200,200,200)); int black = QColor::fromRgb(0,0,0).rgba(); for(int x=0; x<256; x++) { - int k_max = (int)((100*grayscale_relative_histogramm[x])/max); + int k_max = (int) qRound((100*grayscale_relative_histogramm[x])/max); for(int y=0; ysetPixel(x, (100-y)-1, black); } @@ -342,7 +341,7 @@ void ImageViewer::adjustContrast(int c) { } } updateImageDisplay(); - logFile << "[TODO!] Contrast adjusted to: " << old_l << " * " << alpha << " -> (" << h << ", " << s << ", " << new_l << ")" << std::endl; + logFile << "Contrast adjusted to: " << old_l << " * " << alpha << " -> (" << h << ", " << s << ", " << new_l << ")" << std::endl; renewLogging(); }