From 069fd15c796da20582a71bdcf38bc85a5cca2660 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 26 Jul 2013 17:17:05 +0200 Subject: [PATCH] cache shaded meter-background regardless of color previously, shaded patterns were assumed to have different colors as well. --- libs/gtkmm2ext/fastmeter.cc | 4 ++-- 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 > 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 dim; boost::tuple cols; + bool sh; }; typedef std::map > PatternBgMap; -- 2.30.2