Provide a simple helper class for basic colour map usage.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4309 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/ColourMap.h b/common/rfb/ColourMap.h
index da6cb12..22d6789 100644
--- a/common/rfb/ColourMap.h
+++ b/common/rfb/ColourMap.h
@@ -1,4 +1,5 @@
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
+ * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
  * 
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,5 +31,20 @@
   public:
     virtual void lookup(int index, int* r, int* g, int* b)=0;
   };
+
+  class SimpleColourMap : public ColourMap {
+  public:
+    SimpleColourMap(int size = 256) { table = new Colour[size]; };
+    ~SimpleColourMap() { delete [] table; };
+
+    void lookup(int index, int* r, int* g, int* b)
+    { *r = table[index].r; *g = table[index].g; *b = table[index].b; };
+
+    void set(int index, int r, int g, int b)
+    { table[index].r = r; table[index].g = g; table[index].b = b; };
+
+  protected:
+    Colour *table;
+  };
 }
 #endif