[TASK] Make more use of qRound()

This commit is contained in:
Jan Philipp Timme 2015-11-10 13:02:55 +01:00
parent 8e3070a4b4
commit 2f426d4310

View File

@ -108,7 +108,6 @@ void ImageViewer::convertToMonochrome() {
} }
} }
/** /**
* Draws a simple, black line. * Draws a simple, black line.
* @brief ImageViewer::drawBlackLine * @brief ImageViewer::drawBlackLine
@ -245,7 +244,7 @@ int ImageViewer::getAverageIntensity() {
for(int i=0; i<256;i++) { for(int i=0; i<256;i++) {
sumIntensity += (i*grayscale_relative_histogramm[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)); histogramm->fill(QColor::fromRgb(200,200,200));
int black = QColor::fromRgb(0,0,0).rgba(); int black = QColor::fromRgb(0,0,0).rgba();
for(int x=0; x<256; x++) { 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; y<k_max; y++) { for(int y=0; y<k_max; y++) {
histogramm->setPixel(x, (100-y)-1, black); histogramm->setPixel(x, (100-y)-1, black);
} }
@ -342,7 +341,7 @@ void ImageViewer::adjustContrast(int c) {
} }
} }
updateImageDisplay(); 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(); renewLogging();
} }