diff options
author | Robin Gareus <robin@gareus.org> | 2013-07-26 17:17:05 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-07-26 17:17:05 +0200 |
commit | 069fd15c796da20582a71bdcf38bc85a5cca2660 (patch) | |
tree | 85208e5850a16c2986c7d12ca203caad564b8c60 | |
parent | cd35040535d8eefb021a853ffe17a60a2f5740da (diff) |
cache shaded meter-background regardless of color
previously, shaded patterns were assumed to have different colors as well.
-rw-r--r-- | libs/gtkmm2ext/fastmeter.cc | 4 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/fastmeter.h | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc index e7efaa81b9..143bbe2b1c 100644 --- a/libs/gtkmm2ext/fastmeter.cc +++ b/libs/gtkmm2ext/fastmeter.cc @@ -357,7 +357,7 @@ FastMeter::request_vertical_background( height = min(height, max_pattern_metric_size); height += 2; - const PatternBgMapKey key (width, height, bgc[0], bgc[1]); + const PatternBgMapKey key (width, height, bgc[0], bgc[1], shade); PatternBgMap::iterator i; if ((i = vb_pattern_cache.find (key)) != vb_pattern_cache.end()) { return i->second; @@ -405,7 +405,7 @@ FastMeter::request_horizontal_background( width = min(width, max_pattern_metric_size); width += 2; - const PatternBgMapKey key (width, height, bgc[0], bgc[1]); + const PatternBgMapKey key (width, height, bgc[0], bgc[1], shade); PatternBgMap::iterator i; if ((i = hb_pattern_cache.find (key)) != hb_pattern_cache.end()) { return i->second; diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h index 602bea1b38..8070748963 100644 --- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h +++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h @@ -147,15 +147,17 @@ private: typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map; struct PatternBgMapKey { - PatternBgMapKey (int w, int h, int c0, int c1) + PatternBgMapKey (int w, int h, int c0, int c1, bool shade) : dim(w, h) , cols(c0, c1) + , sh(shade) {} inline bool operator<(const PatternBgMapKey& rhs) const { - return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols); + return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols) || (dim == rhs.dim && cols == rhs.cols && (sh && !rhs.sh)); } boost::tuple<int, int> dim; boost::tuple<int, int> cols; + bool sh; }; typedef std::map<PatternBgMapKey, Cairo::RefPtr<Cairo::Pattern> > PatternBgMap; |