]> Dogcows Code - chaz/openbox/blobdiff - otk/pseudorendercontrol.cc
more efficient/nicer way to get the XColor values
[chaz/openbox] / otk / pseudorendercontrol.cc
index 1d55ee6473e64532223ea31c7a280702e1b5f1d8..c30e77f9b32c0609caae6bd7abd9976978f35ca8 100644 (file)
@@ -23,26 +23,37 @@ PseudoRenderControl::PseudoRenderControl(int screen)
   : RenderControl(screen)
 {
   printf("Initializing PseudoColor RenderControl\n");
+  const ScreenInfo *info = display->screenInfo(_screen);
+  int depth = info->depth();
+
+  _cpc = 4; // XXX THIS SHOULD BE A USER OPTION
+  _ncolors = _cpc * _cpc * _cpc;
+
+  if (_cpc < 2 || _ncolors > 1 << depth) {
+    fprintf(stderr,
+            _("PseudoRenderControl: Invalid colormap size. Using maximum size
+available.\n"));
+    _cpc = 1 << (depth/3);
+    _ncolors = 1 << depth; // _cpc * _cpc * _cpc
+  }
+
+  if (!(_colors = new XColor[_ncolors])) {
+    fprintf(stderr,
+            _("PseudoRenderControl: error allocating colormap\n"));
+    ::exit(1);
+  }
+
+  
 }
 
 PseudoRenderControl::~PseudoRenderControl()
 {
   printf("Destroying PseudoColor RenderControl\n");
-}
-
-void PseudoRenderControl::drawBackground(Surface& sf,
-                                      const RenderTexture &texture) const
-{
-  assert(_screen == sf._screen);
-  assert(_screen == texture.color().screen());
 
-  // in psuedo color, gradients aren't even worth while! just draw a solid!
-  //if (texture.gradient() == RenderTexture::Solid) {
-  drawSolidBackground(sf, texture);
+  delete _colors;
 }
 
-void PseudoRenderControl::drawImage(Surface &sf, int w, int h,
-                                    unsigned long *data) const
+void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const
 {
 }
 
This page took 0.023178 seconds and 4 git commands to generate.