]> Dogcows Code - chaz/openbox/commitdiff
start of pseudocolor init
authorDana Jansens <danakj@orodu.net>
Wed, 12 Feb 2003 01:12:34 +0000 (01:12 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 12 Feb 2003 01:12:34 +0000 (01:12 +0000)
otk/pseudorendercontrol.cc

index f6162cec7df6f6c28fcf0d790ee6458048356607..b3ee06c36de907c81611d2fa8a8afc3ba7ef0fad 100644 (file)
@@ -23,13 +23,34 @@ 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");
+
+  delete _colors;
 }
 
 void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const
This page took 0.025451 seconds and 4 git commands to generate.