X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Frendercolor.hh;h=5076167f3d9d565ddd43d73fdff1b19b09a0a197;hb=bfea000a7407e51b5659590415e410a47f6f046b;hp=6000646acd94c3bf6f703bf7f255f819109bcc4f;hpb=c487295c75094be3858b76b23fc9863ec9d46b59;p=chaz%2Fopenbox diff --git a/otk/rendercolor.hh b/otk/rendercolor.hh index 6000646a..5076167f 100644 --- a/otk/rendercolor.hh +++ b/otk/rendercolor.hh @@ -10,23 +10,25 @@ extern "C" { namespace otk { +struct RGB { + int r; + int g; + int b; + RGB(int red, int green, int blue) : r(red), g(green), b(blue) {} + // color is in ARGB format + RGB(unsigned long color) + : r((color >> 16) & 0xff), + g((color >> 8) & 0xff), + b((color) & 0xff) {} +}; + class RenderColor { - struct RGB { - int r; - int g; - int b; - RGB(int red, int green, int blue) : r(red), g(green), b(blue) {} - // color is in ARGB format - RGB(unsigned long color) - : r((color >> 16) & 0xff), - g((color >> 8) & 0xff), - b((color) & 0xff) {} - }; - +private: struct CacheItem { GC gc; + unsigned long pixel; int count; - CacheItem(GC g) : gc(g), count(0) {} + CacheItem(GC g, unsigned long p) : gc(g), pixel(p), count(0) {} }; static std::map *_cache; @@ -35,6 +37,7 @@ class RenderColor { unsigned char _green; unsigned char _blue; + unsigned long _pixel; GC _gc; void create(); @@ -52,7 +55,8 @@ public: inline unsigned char red() const { return _red; } inline unsigned char green() const { return _green; } inline unsigned char blue() const { return _blue; } - inline GC gc() const { return _gc; } + unsigned long pixel() const { return _pixel; } + GC gc() const { return _gc; } }; }