[TASK] Make more use of qRound()
This commit is contained in:
parent
8e3070a4b4
commit
2f426d4310
|
@ -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; y<k_max; y++) {
|
||||
histogramm->setPixel(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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue