]> Dogcows Code - chaz/openbox/blobdiff - otk/rendercolor.hh
increment the count 1 right off the start for the cache
[chaz/openbox] / otk / rendercolor.hh
index fbfe2aef6e69a3eba6cc0768a1a6032091018cfa..4eeb8158a0d20c0bade832f73c5d6011ef9e3510 100644 (file)
@@ -11,6 +11,20 @@ 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) {}
+  };
+
+private:
   struct CacheItem {
     GC gc;
     int count;
@@ -22,21 +36,26 @@ class RenderColor {
   unsigned char _red;
   unsigned char _green;
   unsigned char _blue;
+  unsigned long _pixel;
 
   GC _gc;
 
+  void create();
+  
 public:
   static void initialize();
   static void destroy();
   
   RenderColor(int screen, unsigned char red,
              unsigned char green, unsigned char blue);
+  RenderColor(int screen, RGB rgb);
   virtual ~RenderColor();
 
   inline int screen() const { return _screen; }
   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; }
 };
 
This page took 0.023456 seconds and 4 git commands to generate.