X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Frendercolor.hh;h=da022a107e2176261da8ebc6715943cbc4a06fa0;hb=0ebf6a17547f75c1fa961acbf3fdd59c0e494d22;hp=c5835385ddcb8465f7cfaec14c59784090a16ee6;hpb=42fbe726d4433a6a46ce1555f1d208d2971438e3;p=chaz%2Fopenbox diff --git a/otk/rendercolor.hh b/otk/rendercolor.hh index c5835385..da022a10 100644 --- a/otk/rendercolor.hh +++ b/otk/rendercolor.hh @@ -10,20 +10,19 @@ extern "C" { namespace otk { -class RenderColor { -public: - 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) {} - }; +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 { private: struct CacheItem { GC gc; @@ -37,11 +36,13 @@ private: unsigned char _red; unsigned char _green; unsigned char _blue; - unsigned long _pixel; - GC _gc; + mutable unsigned long _pixel; + mutable GC _gc; + + mutable bool _allocated; - void create(); + void create() const; public: static void initialize(); @@ -56,8 +57,8 @@ public: inline unsigned char red() const { return _red; } inline unsigned char green() const { return _green; } inline unsigned char blue() const { return _blue; } - inline unsigned long pixel() const { return _pixel; } - inline GC gc() const { return _gc; } + unsigned long pixel() const; + GC gc() const; }; }