Improve performance of histogram/waveform updates

Only perform calculations for the currently shown scope.
Cache the waveform so it can be reused when the scope is resized.
Increase speed of waveform rendering.
This commit is contained in:
Lawrence Lee
2020-07-26 13:27:17 -07:00
parent 99b7a557c9
commit 6df69b3786
7 changed files with 228 additions and 69 deletions

View File

@@ -1640,31 +1640,13 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
}
if (hListener) {
updateLRGBHistograms();
updateWaveforms();
hListener->histogramChanged(
histRed,
histGreen,
histBlue,
histLuma,
histToneCurve,
histLCurve,
histCCurve,
/*histCLurve,
* histLLCurve,*/
histLCAM,
histCCAM,
histRedRaw,
histGreenRaw,
histBlueRaw,
histChroma,
histLRETI,
waveformScale,
waveformWidth,
waveformRed.get(),
waveformGreen.get(),
waveformBlue.get()
);
if (hListener->updateHistogram()) {
updateLRGBHistograms();
}
if (hListener->updateWaveform()) {
updateWaveforms();
}
notifyHistogramChanged();
}
}
@@ -1765,6 +1747,33 @@ void ImProcCoordinator::setScale(int prevscale)
}
void ImProcCoordinator::notifyHistogramChanged()
{
if (hListener) {
hListener->histogramChanged(
histRed,
histGreen,
histBlue,
histLuma,
histToneCurve,
histLCurve,
histCCurve,
histLCAM,
histCCAM,
histRedRaw,
histGreenRaw,
histBlueRaw,
histChroma,
histLRETI,
waveformScale,
waveformWidth,
waveformRed.get(),
waveformGreen.get(),
waveformBlue.get()
);
}
}
void ImProcCoordinator::updateLRGBHistograms()
{
@@ -2305,4 +2314,20 @@ void ImProcCoordinator::setHighQualComputed()
highQualityComputed = true;
}
void ImProcCoordinator::updateWaveform()
{
if (hListener) {
updateWaveforms();
notifyHistogramChanged();
}
}
void ImProcCoordinator::updateHistogram()
{
if (hListener) {
updateLRGBHistograms();
notifyHistogramChanged();
}
}
}