Other minor fixes for histogram panel

- When loading an image, raw histogram data were incorrectly not set (but provided)
- Fixes incorrect curve scaling in raw histogram mode (was incorrectly scaled using luma and chroma data)
This commit is contained in:
Pandagrapher 2022-11-03 12:37:43 +01:00
parent a0c3ef931c
commit 8e0fa1148b

View File

@ -1147,9 +1147,7 @@ void HistogramArea::update(
chist = histChroma; chist = histChroma;
break; break;
case ScopeType::HISTOGRAM_RAW: case ScopeType::HISTOGRAM_RAW:
rhistRaw = histRedRaw; // Raw histogram data are always provided (refer below)
ghistRaw = histGreenRaw;
bhistRaw = histBlueRaw;
break; break;
case ScopeType::PARADE: case ScopeType::PARADE:
case ScopeType::WAVEFORM: { case ScopeType::WAVEFORM: {
@ -1175,6 +1173,11 @@ void HistogramArea::update(
case ScopeType::NONE: case ScopeType::NONE:
break; break;
} }
// Raw histogram data are always provided
rhistRaw = histRedRaw;
ghistRaw = histGreenRaw;
bhistRaw = histBlueRaw;
LUT_valid = true; LUT_valid = true;
} else { } else {
LUT_valid = false; LUT_valid = false;
@ -1278,11 +1281,11 @@ void HistogramArea::updateDrawingArea (const ::Cairo::RefPtr< Cairo::Context> &c
const int scale = (rawMode ? 8 : 1); const int scale = (rawMode ? 8 : 1);
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
if (needLuma) { if (needLuma && !rawMode) {
lhisttemp[i] = lhist[i]; lhisttemp[i] = lhist[i];
} }
if (needChroma) { if (needChroma && !rawMode) {
chisttemp[i] = chist[i]; chisttemp[i] = chist[i];
} }
@ -1305,11 +1308,11 @@ void HistogramArea::updateDrawingArea (const ::Cairo::RefPtr< Cairo::Context> &c
unsigned int histheight = 0; unsigned int histheight = 0;
for (int i = 1; i < 255; i++) { for (int i = 1; i < 255; i++) {
if (needLuma && lhisttemp[i] > histheight) { if (needLuma && !rawMode && lhisttemp[i] > histheight) {
histheight = lhisttemp[i]; histheight = lhisttemp[i];
} }
if (needChroma && chisttemp[i] > histheight) { if (needChroma && !rawMode && chisttemp[i] > histheight) {
histheight = chisttemp[i]; histheight = chisttemp[i];
} }