]> Dogcows Code - chaz/openbox/blobdiff - render/color.c
include stdlib for exit()
[chaz/openbox] / render / color.c
index ee4ee30ed22488389dc9b3bae46a034d888ed6d8..46f81161e1defaf86e43602538e1a0c13757ccaa 100644 (file)
@@ -4,10 +4,7 @@
 #include "render.h"
 #include "color.h"
 
-XColor *pseudo_colors;
-int pseudo_bpc;
-
-void color_allocate_gc(RrColor *in)
+void RrColorAllocateGC(RrColor *in)
 {
     XGCValues gcv;
 
@@ -66,7 +63,7 @@ void RrColorFree(RrColor *c)
     }
 }
 
-void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
+void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
 {
     int r, g, b;
     int x,y;
@@ -78,14 +75,18 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
         if ((RrRedOffset(inst) != RrDefaultRedOffset) ||
             (RrBlueOffset(inst) != RrDefaultBlueOffset) ||
             (RrGreenOffset(inst) != RrDefaultGreenOffset)) {
+            g_message("CONVERSION %d->%d %d->%d %d->%d",
+                      RrDefaultRedOffset, RrRedOffset(inst),
+                      RrDefaultBlueOffset, RrGreenOffset(inst),
+                      RrDefaultGreenOffset, RrBlueOffset(inst));
             for (y = 0; y < im->height; y++) {
                 for (x = 0; x < im->width; x++) {
                     r = (data[x] >> RrDefaultRedOffset) & 0xFF;
                     g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
                     b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
-                    p32[x] = (r << RrRedShift(inst))
-                           + (g << RrGreenShift(inst))
-                           + (b << RrBlueShift(inst));
+                    p32[x] = (r << RrRedOffset(inst))
+                           + (g << RrGreenOffset(inst))
+                           + (b << RrBlueOffset(inst));
                 }
                 data += im->width;
                 p32 += im->width;
@@ -113,10 +114,10 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
         g_assert(RrVisual(inst)->class != TrueColor);
         for (y = 0; y < im->height; y++) {
             for (x = 0; x < im->width; x++) {
-                p8[x] = pickColor(inst,
-                                  data[x] >> RrDefaultRedOffset,
-                                  data[x] >> RrDefaultGreenOffset,
-                                  data[x] >> RrDefaultBlueOffset)->pixel;
+                p8[x] = RrPickColor(inst,
+                                    data[x] >> RrDefaultRedOffset,
+                                    data[x] >> RrDefaultGreenOffset,
+                                    data[x] >> RrDefaultBlueOffset)->pixel;
         }
         data += im->width;
         p8 += im->bytes_per_line;
@@ -128,13 +129,13 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
     }
 }
 
-XColor *pickColor(const RrInstance *inst, gint r, gint g, gint b) 
+XColor *RrPickColor(const RrInstance *inst, gint r, gint g, gint b) 
 {
-  r = (r & 0xff) >> (8-pseudo_bpc);
-  g = (g & 0xff) >> (8-pseudo_bpc);
-  b = (b & 0xff) >> (8-pseudo_bpc);
-  return &RrPseudoColors(inst)[(r << (2*pseudo_bpc)) +
-                               (g << (1*pseudo_bpc)) +
+  r = (r & 0xff) >> (8-RrPseudoBPC(inst));
+  g = (g & 0xff) >> (8-RrPseudoBPC(inst));
+  b = (b & 0xff) >> (8-RrPseudoBPC(inst));
+  return &RrPseudoColors(inst)[(r << (2*RrPseudoBPC(inst))) +
+                               (g << (1*RrPseudoBPC(inst))) +
                                b];
 }
 
@@ -174,7 +175,7 @@ static void swap_byte_order(XImage *im)
         im->byte_order = LSBFirst;
 }
 
-void increase_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
+void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
 {
     int r, g, b;
     int x,y;
This page took 0.022963 seconds and 4 git commands to generate.