diff options
author | Robin Gareus <robin@gareus.org> | 2014-09-01 22:02:51 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-09-01 22:02:51 +0200 |
commit | 9f0caacc5cb47597f0452d62396b2bdb907f72c1 (patch) | |
tree | 619164d1404d506a2eb1811cc8a399266b7aa459 /libs/gtkmm2ext/gtkmm2ext/pixfader.h | |
parent | 158037bba2a14f5782b7916040736c27f0112b52 (diff) |
rework pixfader:
* re-introduce static pattern cache
(cairo's cache is not nearly large enough for A3 + plugins)
* only use cairo_clip on rectangles (not arbitrary paths
-> major performance boost
* re-add fader pixel reserve
* fix mouse + scroll interaction
* fix unity line display (1px wider, brighten by 150%)
* cache text size
* fix various other issues and consistent whitespace
This reverts large parts of commit d439e93b1e71e84452bf52ddc69ff0be6aa04ef5.
Diffstat (limited to 'libs/gtkmm2ext/gtkmm2ext/pixfader.h')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/pixfader.h | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/pixfader.h b/libs/gtkmm2ext/gtkmm2ext/pixfader.h index d603b94405..bc08f9bca9 100644 --- a/libs/gtkmm2ext/gtkmm2ext/pixfader.h +++ b/libs/gtkmm2ext/gtkmm2ext/pixfader.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,9 +71,52 @@ class LIBGTKMM2EXT_API PixFader : public Gtk::DrawingArea private: int span, girth; int _orien; - - cairo_pattern_t* fg_gradient; - cairo_pattern_t* bg_gradient; + cairo_pattern_t* pattern; + + struct FaderImage { + cairo_pattern_t* pattern; + double fr; + double fg; + double fb; + double br; + double bg; + double bb; + int width; + int height; + + FaderImage (cairo_pattern_t* p, + double afr, double afg, double afb, + double abr, double abg, double abb, + int w, int h) + : pattern (p) + , fr (afr) + , fg (afg) + , fb (afb) + , br (abr) + , bg (abg) + , bb (abb) + , width (w) + , height (h) + {} + + bool matches (double afr, double afg, double afb, + double abr, double abg, double abb, + int w, int h) { + return width == w && + height == h && + afr == fr && + afg == fg && + afb == fb && + abr == br && + abg == bg && + abb == bb; + } + }; + + static std::list<FaderImage*> _patterns; + static cairo_pattern_t* find_pattern (double afr, double afg, double afb, + double abr, double abg, double abb, + int w, int h); bool _hovering; @@ -86,12 +129,13 @@ class LIBGTKMM2EXT_API PixFader : public Gtk::DrawingArea int unity_loc; void adjustment_changed (); - float display_span (); + int display_span (); void set_adjustment_from_event (GdkEventButton *); void update_unity_position (); sigc::connection _parent_style_change; Widget * _current_parent; + void create_patterns(); }; |