all repos — openbox @ afb8a28120b21569934202968283e65a173c3bd8

openbox fork - make it a bit more like ryudo

support pseudocolor and greyscale displays by, using solid colors instead of gradients
Dana Jansens danakj@orodu.net
commit

afb8a28120b21569934202968283e65a173c3bd8

parent

e6bfddf849009bef7bbb75be5147b4a533fa1ad2

M otk/pseudorendercontrol.ccotk/pseudorendercontrol.cc

@@ -24,22 +24,12 @@

PseudoRenderControl::PseudoRenderControl(int screen) : RenderControl(screen) { - const ScreenInfo *info = display->screenInfo(_screen); - printf("Initializing PseudoColor RenderControl\n"); - } PseudoRenderControl::~PseudoRenderControl() { printf("Destroying PseudoColor RenderControl\n"); - - -} - -void PseudoRenderControl::drawGradientBackground( - Surface &sf, const RenderTexture &texture) const -{ } void PseudoRenderControl::drawBackground(Surface& sf,

@@ -48,11 +38,9 @@ {

assert(_screen == sf._screen); assert(_screen == texture.color().screen()); - if (texture.gradient() == RenderTexture::Solid) { - drawSolidBackground(sf, texture); - } else { - drawGradientBackground(sf, texture); - } + // in psuedo color, gradients aren't even worth while! just draw a solid! + //if (texture.gradient() == RenderTexture::Solid) { + drawSolidBackground(sf, texture); } }
M otk/pseudorendercontrol.hhotk/pseudorendercontrol.hh

@@ -23,9 +23,6 @@

class PseudoRenderControl : public RenderControl { private: - virtual void drawGradientBackground(Surface &sf, - const RenderTexture &texture) const; - public: PseudoRenderControl(int screen); virtual ~PseudoRenderControl();
M otk/rendercontrol.ccotk/rendercontrol.cc

@@ -38,7 +38,7 @@ case StaticColor:

return new PseudoRenderControl(screen); case GrayScale: case StaticGray: -// return new GrayRenderControl(screen); + return new PseudoRenderControl(screen); default: printf(_("RenderControl: Unsupported visual %d specified. Aborting.\n"), vclass);
M otk/surface.ccotk/surface.cc

@@ -57,9 +57,11 @@ const ScreenInfo *info = display->screenInfo(_screen);

_pixmap = XCreatePixmap(**display, info->rootWindow(), _size.x(), _size.y(), info->depth()); + assert(_pixmap != None); _xftdraw = XftDrawCreate(**display, _pixmap, info->visual(), info->colormap()); + assert(_xftdraw); } void Surface::destroyObjects()
M otk/truerendercontrol.ccotk/truerendercontrol.cc

@@ -53,53 +53,6 @@

TrueRenderControl::~TrueRenderControl() { printf("Destroying TrueColor RenderControl\n"); - - -} - - -static inline void renderPixel(XImage *im, unsigned char *dp, - unsigned long pixel) -{ - unsigned int bpp = im->bits_per_pixel + (im->byte_order == MSBFirst ? 1 : 0); - - switch (bpp) { - case 8: // 8bpp - *dp++ = pixel; - break; - case 16: // 16bpp LSB - *dp++ = pixel; - *dp++ = pixel >> 8; - break; - case 17: // 16bpp MSB - *dp++ = pixel >> 8; - *dp++ = pixel; - break; - case 24: // 24bpp LSB - *dp++ = pixel; - *dp++ = pixel >> 8; - *dp++ = pixel >> 16; - break; - case 25: // 24bpp MSB - *dp++ = pixel >> 16; - *dp++ = pixel >> 8; - *dp++ = pixel; - break; - case 32: // 32bpp LSB - *dp++ = pixel; - *dp++ = pixel >> 8; - *dp++ = pixel >> 16; - *dp++ = pixel >> 24; - break; - case 33: // 32bpp MSB - *dp++ = pixel >> 24; - *dp++ = pixel >> 16; - *dp++ = pixel >> 8; - *dp++ = pixel; - break; - default: - assert(false); // wtf? - } } void TrueRenderControl::drawGradientBackground(

@@ -244,8 +197,8 @@ }

} void TrueRenderControl::crossDiagonalGradient(Surface &sf, - const RenderTexture &texture, - pixel32 *data) const + const RenderTexture &texture, + pixel32 *data) const { pixel32 current; float drx, dgx, dbx, dry, dgy, dby;

@@ -274,12 +227,13 @@ *data = current;

} } } + void TrueRenderControl::reduceDepth(XImage *im, pixel32 *data) const { // since pixel32 is the largest possible pixel size, we can share the array int r, g, b; int x,y; - pixel16 *p = (pixel16 *)data; + pixel16 *p = (pixel16*) data; switch (im->bits_per_pixel) { case 32: if ((_red_offset != default_red_shift) ||

@@ -291,7 +245,8 @@ for (x = 0; x < im->width; x++) {

r = (data[x] >> default_red_shift) & 0xFF; g = (data[x] >> default_green_shift) & 0xFF; b = (data[x] >> default_blue_shift) & 0xFF; - data[x] = (r << _red_offset) + (g << _green_offset) + (b << _blue_offset); + data[x] = (r << _red_offset) + (g << _green_offset) + + (b << _blue_offset); } data += im->width; }

@@ -350,17 +305,17 @@ b = (b >> 1) + (b >> 2);

*down = (r << default_red_shift) + (g << default_green_shift) + (b << default_blue_shift); } + void TrueRenderControl::drawBackground(Surface& sf, const RenderTexture &texture) const { assert(_screen == sf._screen); assert(_screen == texture.color().screen()); - if (texture.gradient() == RenderTexture::Solid) { + if (texture.gradient() == RenderTexture::Solid) drawSolidBackground(sf, texture); - } else { + else drawGradientBackground(sf, texture); - } } }