diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 176b0c4..f0587e1 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -390,13 +390,13 @@ void ImageViewer::pieceLinearHistogrammAdaption() { used_space += source_histogramm[source_cursor]; source_cursor++; } + // If there is no more space, just put it to the last value used. :/ + // Otherwise, we don't know what to do with some pixels. + if(source_histogramm[source_cursor] > (free_total_space - used_space)) { + histogramm_map[source_cursor] = i; + } } - for(int i=0; i<256; i++) { - logFile << i << ": " << histogramm_map[i] << std::endl; - } - renewLogging(); - // Apply the map for each pixel. int h, s, l; for(int x=0; xgetImage()->width(); x++) {