Hidpi support for histogram panel
Other fixes: - Reduce number of queue_draw function calls (and so optimize panel redraw) - Code cleanup
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -35,20 +35,6 @@
|
|||||||
#include "../rtengine/LUT.h"
|
#include "../rtengine/LUT.h"
|
||||||
#include "../rtengine/noncopyable.h"
|
#include "../rtengine/noncopyable.h"
|
||||||
|
|
||||||
class HistogramArea;
|
|
||||||
|
|
||||||
struct HistogramAreaIdleHelper {
|
|
||||||
HistogramArea* harea;
|
|
||||||
bool destroyed;
|
|
||||||
int pending;
|
|
||||||
};
|
|
||||||
|
|
||||||
class HistogramRGBArea;
|
|
||||||
struct HistogramRGBAreaIdleHelper {
|
|
||||||
HistogramRGBArea* harea;
|
|
||||||
bool destroyed;
|
|
||||||
int pending;
|
|
||||||
};
|
|
||||||
|
|
||||||
class HistogramScaling
|
class HistogramScaling
|
||||||
{
|
{
|
||||||
@@ -58,38 +44,39 @@ public:
|
|||||||
double log (double vsize, double val);
|
double log (double vsize, double val);
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistogramRGBArea : public Gtk::DrawingArea, public BackBuffer, protected HistogramScaling, public rtengine::NonCopyable
|
class HistogramRGBArea : public Gtk::DrawingArea, protected HistogramScaling, public rtengine::NonCopyable
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
typedef const double (*TMatrix)[3];
|
|
||||||
|
|
||||||
IdleRegister idle_register;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int val;
|
// Saved pointer parameters
|
||||||
int r;
|
int r;
|
||||||
int g;
|
int g;
|
||||||
int b;
|
int b;
|
||||||
|
float lab_L;
|
||||||
|
float lab_a;
|
||||||
|
float lab_b;
|
||||||
|
bool pointerValid;
|
||||||
|
|
||||||
bool valid;
|
// Drawing options
|
||||||
|
|
||||||
bool needRed;
|
bool needRed;
|
||||||
bool needGreen;
|
bool needGreen;
|
||||||
bool needBlue;
|
bool needBlue;
|
||||||
bool needLuma;
|
bool needLuma;
|
||||||
bool needChroma;
|
bool needChroma;
|
||||||
bool showMode;
|
Options::ScopeType scopeType;
|
||||||
bool barDisplayed;
|
int scaleMode;
|
||||||
|
bool showBar;
|
||||||
|
|
||||||
Gtk::Grid* parent;
|
const double padding = 5.0;
|
||||||
|
|
||||||
double padding = 5.0;
|
// Internal drawing functions
|
||||||
|
void updateDrawingArea (const ::Cairo::RefPtr< Cairo::Context> &cc);
|
||||||
|
virtual void drawBar(const Cairo::RefPtr<Cairo::Context> &cc, const double value, const double max_value, const int winw, const int winh) = 0;
|
||||||
|
|
||||||
HistogramRGBAreaIdleHelper* harih;
|
// GtkDrawingArea override functions
|
||||||
|
void on_realize() override;
|
||||||
/** Draw an indicator bar for the value. */
|
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override;
|
||||||
virtual void drawBar(Cairo::RefPtr<Cairo::Context> cc, double value, double max_value, int winw, int winh, double scale) = 0;
|
|
||||||
|
|
||||||
|
// Widget size management functions
|
||||||
void getPreferredThickness(int& min_thickness, int& natural_length) const;
|
void getPreferredThickness(int& min_thickness, int& natural_length) const;
|
||||||
void getPreferredLength(int& min_length, int& natural_length) const;
|
void getPreferredLength(int& min_length, int& natural_length) const;
|
||||||
void getPreferredThicknessForLength(int length, int& min_thickness, int& natural_length) const;
|
void getPreferredThicknessForLength(int length, int& min_thickness, int& natural_length) const;
|
||||||
@@ -99,29 +86,23 @@ public:
|
|||||||
HistogramRGBArea();
|
HistogramRGBArea();
|
||||||
~HistogramRGBArea() override;
|
~HistogramRGBArea() override;
|
||||||
|
|
||||||
void updateBackBuffer (int r, int g, int b, const Glib::ustring &profile = "", const Glib::ustring &profileW = "");
|
// Update pointer values: returns true if widget needs redrawing
|
||||||
bool getShow ();
|
bool updatePointer (const int new_r, const int new_g, const int new_b, const Glib::ustring &new_profile = "", const Glib::ustring &new_profileW = "");
|
||||||
void setShow(bool show);
|
// Update internal parameters from options
|
||||||
void setParent (Gtk::Grid* p)
|
void updateFromOptions ();
|
||||||
{
|
|
||||||
parent = p;
|
|
||||||
};
|
|
||||||
|
|
||||||
void update (int val, int rh, int gh, int bh);
|
// Event management functions
|
||||||
void updateOptions (bool r, bool g, bool b, bool l, bool c, bool show);
|
|
||||||
|
|
||||||
void on_realize() override;
|
|
||||||
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override;
|
|
||||||
bool on_button_press_event (GdkEventButton* event) override;
|
bool on_button_press_event (GdkEventButton* event) override;
|
||||||
void factorChanged (double newFactor);
|
void factorChanged (double newFactor);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistogramRGBAreaHori final : public HistogramRGBArea
|
class HistogramRGBAreaHori final : public HistogramRGBArea
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void drawBar(Cairo::RefPtr<Cairo::Context> cc, double value, double max_value, int winw, int winh, double scale) override;
|
// Internal drawing function
|
||||||
|
void drawBar(const Cairo::RefPtr<Cairo::Context> &cc, const double value, const double max_value, const int winw, const int winh) override;
|
||||||
|
|
||||||
|
// Widget size management functions
|
||||||
Gtk::SizeRequestMode get_request_mode_vfunc () const override;
|
Gtk::SizeRequestMode get_request_mode_vfunc () const override;
|
||||||
void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const override;
|
void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const override;
|
||||||
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const override;
|
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const override;
|
||||||
@@ -132,8 +113,10 @@ private:
|
|||||||
class HistogramRGBAreaVert final : public HistogramRGBArea
|
class HistogramRGBAreaVert final : public HistogramRGBArea
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void drawBar(Cairo::RefPtr<Cairo::Context> cc, double value, double max_value, int winw, int winh, double scale) override;
|
// Internal drawing function
|
||||||
|
void drawBar(const Cairo::RefPtr<Cairo::Context> &cc, const double value, const double max_value, const int winw, const int winh) override;
|
||||||
|
|
||||||
|
// Widget size management functions
|
||||||
Gtk::SizeRequestMode get_request_mode_vfunc () const override;
|
Gtk::SizeRequestMode get_request_mode_vfunc () const override;
|
||||||
void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const override;
|
void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const override;
|
||||||
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const override;
|
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const override;
|
||||||
@@ -148,7 +131,7 @@ public:
|
|||||||
virtual void toggleButtonMode() = 0;
|
virtual void toggleButtonMode() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistogramArea final : public Gtk::DrawingArea, public BackBuffer, private HistogramScaling, public rtengine::NonCopyable
|
class HistogramArea final : public Gtk::DrawingArea, private HistogramScaling, public rtengine::NonCopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef sigc::signal<void, double> type_signal_factor_changed;
|
typedef sigc::signal<void, double> type_signal_factor_changed;
|
||||||
@@ -161,8 +144,9 @@ private:
|
|||||||
type_signal_factor_changed sigFactorChanged;
|
type_signal_factor_changed sigFactorChanged;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// Histogram parameters
|
||||||
LUTu rhist, ghist, bhist, lhist, chist;
|
LUTu rhist, ghist, bhist, lhist, chist;
|
||||||
LUTu rhistRaw, ghistRaw, bhistRaw, lhistRaw; //lhistRaw is unused?
|
LUTu rhistRaw, ghistRaw, bhistRaw;
|
||||||
int vectorscope_scale;
|
int vectorscope_scale;
|
||||||
array2D<int> vect_hc, vect_hs;
|
array2D<int> vect_hc, vect_hs;
|
||||||
std::vector<unsigned char> vect_hc_buffer, vect_hs_buffer;
|
std::vector<unsigned char> vect_hc_buffer, vect_hs_buffer;
|
||||||
@@ -177,36 +161,44 @@ protected:
|
|||||||
std::vector<unsigned char> wave_buffer;
|
std::vector<unsigned char> wave_buffer;
|
||||||
std::vector<unsigned char> wave_buffer_luma;
|
std::vector<unsigned char> wave_buffer_luma;
|
||||||
bool wave_buffer_dirty, wave_buffer_luma_dirty;
|
bool wave_buffer_dirty, wave_buffer_luma_dirty;
|
||||||
|
bool LUT_valid;
|
||||||
|
|
||||||
bool valid;
|
// Intensity of waveform and vectorscope trace
|
||||||
|
float trace_brightness;
|
||||||
|
SignalBrightnessChanged signal_brightness_changed;
|
||||||
|
|
||||||
|
// Saved pointer parameters
|
||||||
|
int pointer_red;
|
||||||
|
int pointer_green;
|
||||||
|
int pointer_blue;
|
||||||
|
float pointer_a;
|
||||||
|
float pointer_b;
|
||||||
|
bool pointer_valid;
|
||||||
|
|
||||||
|
// Drawing options
|
||||||
|
bool needRed;
|
||||||
|
bool needGreen;
|
||||||
|
bool needBlue;
|
||||||
|
bool needLuma;
|
||||||
|
bool needChroma;
|
||||||
|
bool needPointer;
|
||||||
|
Options::ScopeType scopeType;
|
||||||
int drawMode;
|
int drawMode;
|
||||||
DrawModeListener *myDrawModeListener;
|
DrawModeListener *myDrawModeListener;
|
||||||
Options::ScopeType scopeType;
|
|
||||||
int oldwidth, oldheight;
|
|
||||||
/// Intensity of waveform and vectorscope trace.
|
|
||||||
float trace_brightness;
|
|
||||||
|
|
||||||
bool needRed, needGreen, needBlue, needLuma, needChroma;
|
// Motion event management
|
||||||
bool isPressed;
|
bool isPressed;
|
||||||
double movingPosition;
|
double movingPosition;
|
||||||
bool needPointer;
|
|
||||||
|
|
||||||
double padding = 5.0;
|
double padding = 5.0;
|
||||||
|
|
||||||
HistogramAreaIdleHelper* haih;
|
|
||||||
|
|
||||||
int pointer_red, pointer_green, pointer_blue;
|
|
||||||
float pointer_a, pointer_b;
|
|
||||||
|
|
||||||
SignalBrightnessChanged signal_brightness_changed;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit HistogramArea(DrawModeListener *fml = nullptr);
|
explicit HistogramArea(DrawModeListener *fml = nullptr);
|
||||||
~HistogramArea() override;
|
~HistogramArea() override;
|
||||||
|
|
||||||
void updateBackBuffer ();
|
// Update pointer values: returns true if widget needs redrawing
|
||||||
/// Update pointer values. Returns true if widget needs redrawing.
|
bool updatePointer(const int r, const int g, const int b, const Glib::ustring &profile = "", const Glib::ustring &profileW = "");
|
||||||
bool updatePointer(int r, int g, int b, const Glib::ustring &profile = "", const Glib::ustring &profileW = "");
|
// Update histogram data
|
||||||
void update(
|
void update(
|
||||||
const LUTu& histRed,
|
const LUTu& histRed,
|
||||||
const LUTu& histGreen,
|
const LUTu& histGreen,
|
||||||
@@ -225,25 +217,36 @@ public:
|
|||||||
const array2D<int>& waveformBlue,
|
const array2D<int>& waveformBlue,
|
||||||
const array2D<int>& waveformLuma
|
const array2D<int>& waveformLuma
|
||||||
);
|
);
|
||||||
void updateOptions (bool r, bool g, bool b, bool l, bool c, int mode, Options::ScopeType type, bool pointer);
|
// Update internal parameters from options
|
||||||
bool updatePending();
|
void updateFromOptions();
|
||||||
void on_realize() override;
|
|
||||||
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override;
|
// Event management functions
|
||||||
bool on_button_press_event (GdkEventButton* event) override;
|
bool on_button_press_event (GdkEventButton* event) override;
|
||||||
bool on_button_release_event (GdkEventButton* event) override;
|
bool on_button_release_event (GdkEventButton* event) override;
|
||||||
bool on_motion_notify_event (GdkEventMotion* event) override;
|
bool on_motion_notify_event (GdkEventMotion* event) override;
|
||||||
|
|
||||||
|
// Brightness management functions (nominal = 1)
|
||||||
float getBrightness(void);
|
float getBrightness(void);
|
||||||
/** Set the trace brightness, with 1 being normal. */
|
|
||||||
void setBrightness(float brightness);
|
void setBrightness(float brightness);
|
||||||
SignalBrightnessChanged getBrighnessChangedSignal(void);
|
SignalBrightnessChanged getBrighnessChangedSignal(void);
|
||||||
|
|
||||||
|
// Factor management function
|
||||||
type_signal_factor_changed signal_factor_changed();
|
type_signal_factor_changed signal_factor_changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawCurve(Cairo::RefPtr<Cairo::Context> &cr, const LUTu & data, double scale, int hsize, int vsize);
|
// GtkDrawingArea override functions
|
||||||
void drawMarks(Cairo::RefPtr<Cairo::Context> &cr, const LUTu & data, double scale, int hsize, int & ui, int & oi);
|
void on_realize() override;
|
||||||
void drawParade(Cairo::RefPtr<Cairo::Context> &cr, int hsize, int vsize);
|
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override;
|
||||||
void drawVectorscope(Cairo::RefPtr<Cairo::Context> &cr, int hsize, int vsize);
|
|
||||||
void drawWaveform(Cairo::RefPtr<Cairo::Context> &cr, int hsize, int vsize);
|
// Internal drawing functions
|
||||||
|
void updateDrawingArea (const ::Cairo::RefPtr< Cairo::Context> &cr);
|
||||||
|
void drawCurve(const Cairo::RefPtr<Cairo::Context> &cr, const LUTu & data, const double scale, const int hsize, const int vsize);
|
||||||
|
void drawMarks(const Cairo::RefPtr<Cairo::Context> &cr, const LUTu & data, const double scale, const int wsize, int & ui, int & oi);
|
||||||
|
void drawParade(const Cairo::RefPtr<Cairo::Context> &cr, const int hsize, const int vsize);
|
||||||
|
void drawVectorscope(const Cairo::RefPtr<Cairo::Context> &cr, const int hsize, const int vsize);
|
||||||
|
void drawWaveform(const Cairo::RefPtr<Cairo::Context> &cr, const int hsize, const int vsize);
|
||||||
|
|
||||||
|
// Widget size management functions
|
||||||
Gtk::SizeRequestMode get_request_mode_vfunc () const override;
|
Gtk::SizeRequestMode get_request_mode_vfunc () const override;
|
||||||
void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const override;
|
void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const override;
|
||||||
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const override;
|
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const override;
|
||||||
@@ -311,10 +314,9 @@ protected:
|
|||||||
|
|
||||||
sigc::connection brightness_changed_connection;
|
sigc::connection brightness_changed_connection;
|
||||||
sigc::connection rconn;
|
sigc::connection rconn;
|
||||||
|
|
||||||
void setHistInvalid ();
|
void setHistInvalid ();
|
||||||
void showRGBBar();
|
void showRGBBar();
|
||||||
void updateHistAreaOptions();
|
|
||||||
void updateHistRGBAreaOptions();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -345,9 +347,6 @@ public:
|
|||||||
// pointermotionlistener interface
|
// pointermotionlistener interface
|
||||||
void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false) override;
|
void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false) override;
|
||||||
|
|
||||||
// TODO should be protected
|
|
||||||
void setHistRGBInvalid ();
|
|
||||||
|
|
||||||
void reorder (Gtk::PositionType position);
|
void reorder (Gtk::PositionType position);
|
||||||
void red_toggled ();
|
void red_toggled ();
|
||||||
void green_toggled ();
|
void green_toggled ();
|
||||||
|
Reference in New Issue
Block a user