summaryrefslogtreecommitdiff
path: root/glcddrivers/driver.h
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2011-05-29 19:12:56 +0200
committermrwastl <mrwastl@users.sourceforge.net>2011-05-29 19:12:56 +0200
commitd95ac11c78ba8f86c06105f63036a95b6bb6d317 (patch)
tree58f0a38d79f172e32e4b92538a81240bacd1ec90 /glcddrivers/driver.h
parentb56b578398b7d9e9b47d8d880ae9778566a99c34 (diff)
downloadgraphlcd-base-d95ac11c78ba8f86c06105f63036a95b6bb6d317.tar.gz
graphlcd-base-d95ac11c78ba8f86c06105f63036a95b6bb6d317.tar.bz2
bug-fixes: wrong handling of {Default}(Fore|Back)groundColor fixed
Diffstat (limited to 'glcddrivers/driver.h')
-rw-r--r--glcddrivers/driver.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/glcddrivers/driver.h b/glcddrivers/driver.h
index 5b75c20..2ff32cb 100644
--- a/glcddrivers/driver.h
+++ b/glcddrivers/driver.h
@@ -49,7 +49,7 @@ protected:
virtual bool GetDriverFeature (const std::string & Feature, int & value) { return false; }
virtual GLCD::cColor GetDefaultBackgroundColor(void) { return GLCD::cColor(GLCD::cColor::Black); }
- GLCD::cColor GetDefaultForegroundColor(void) { return GLCD::cColor(GetBackgroundColor()).Invert(); }
+ GLCD::cColor GetDefaultForegroundColor(void) { return GLCD::cColor(GetDefaultBackgroundColor()).Invert(); }
public:
cDriver();
virtual ~cDriver() {}
@@ -72,8 +72,20 @@ public:
virtual bool SetFeature (const std::string & Feature, int value) { return false; }
- GLCD::cColor GetBackgroundColor(bool driverdefault=false) { return (driverdefault) ? GetDefaultBackgroundColor() : (GLCD::cColor)bgcol; }
- GLCD::cColor GetForegroundColor(bool driverdefault=false) { return (driverdefault) ? GetDefaultForegroundColor() : (GLCD::cColor)fgcol; }
+ GLCD::cColor GetBackgroundColor(bool driverdefault=false) {
+ return (
+ (driverdefault || bgcol == GLCD::cColor::ERRCOL || bgcol == GLCD::cColor::Transparent)
+ ? GetDefaultBackgroundColor()
+ : GLCD::cColor(bgcol)
+ );
+ }
+ GLCD::cColor GetForegroundColor(bool driverdefault=false) {
+ return (
+ (driverdefault || fgcol == GLCD::cColor::ERRCOL || fgcol == GLCD::cColor::Transparent)
+ ? GetDefaultForegroundColor()
+ : GLCD::cColor(fgcol)
+ );
+ }
// not to be overridden, override GetDriverFeature() instead
// the following feature names (case insensitive!) are guaranteed to give results: