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

@@ -159,6 +159,8 @@ protected:
int waveform_scale;
int waveform_width;
std::unique_ptr<int[][256]> rwave, gwave, bwave;
std::unique_ptr<unsigned char[]> wave_buffer;
bool wave_buffer_dirty;
bool valid;
int drawMode;
@@ -214,6 +216,14 @@ private:
void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const override;
};
class HistogramPanelListener
{
public:
enum ScopeType {HISTOGRAM, WAVEFORM, NONE};
virtual void scopeTypeChanged(ScopeType new_type) = 0;
};
class HistogramPanel final : public Gtk::Grid, public PointerMotionListener, public DrawModeListener, public rtengine::NonCopyable
{
@@ -255,9 +265,12 @@ protected:
Gtk::Image *mode1Image;
Gtk::Image *mode2Image;
HistogramPanelListener* panel_listener;
sigc::connection rconn;
void setHistInvalid ();
void showRGBBar();
void updateHistAreaOptions();
public:
@@ -304,4 +317,6 @@ public:
// drawModeListener interface
void toggleButtonMode () override;
void setPanelListener(HistogramPanelListener* listener);
};