++y;
}
self->icons[j].data[t] =
- (((data[i] >> 24) & 0xff) << default_alpha_offset) +
- (((data[i] >> 16) & 0xff) << default_red_offset) +
- (((data[i] >> 8) & 0xff) << default_green_offset) +
- (((data[i] >> 0) & 0xff) << default_blue_offset);
+ (((data[i] >> 24) & 0xff) << RrDefaultAlphaOffset) +
+ (((data[i] >> 16) & 0xff) << RrDefaultRedOffset) +
+ (((data[i] >> 8) & 0xff) << RrDefaultGreenOffset) +
+ (((data[i] >> 0) & 0xff) << RrDefaultBlueOffset);
}
g_assert(i <= num);
}
#include "focus.h"
#include "dispatch.h"
#include "extensions.h"
-#include "../render/render.h"
+#include "render/render.h"
#ifdef USE_LIBSN
# define SN_API_NOT_YET_FROZEN
unsigned char *p8 = (unsigned char *)im->data;
switch (im->bits_per_pixel) {
case 32:
- if ((RrRedOffset(inst) != default_red_offset) ||
- (RrBlueOffset(inst) != default_blue_offset) ||
- (RrGreenOffset(inst) != default_green_offset)) {
+ if ((RrRedOffset(inst) != RrDefaultRedOffset) ||
+ (RrBlueOffset(inst) != RrDefaultBlueOffset) ||
+ (RrGreenOffset(inst) != RrDefaultGreenOffset)) {
for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) {
- r = (data[x] >> default_red_offset) & 0xFF;
- g = (data[x] >> default_green_offset) & 0xFF;
- b = (data[x] >> default_blue_offset) & 0xFF;
+ 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));
case 16:
for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) {
- r = (data[x] >> default_red_offset) & 0xFF;
+ r = (data[x] >> RrDefaultRedOffset) & 0xFF;
r = r >> RrRedShift(inst);
- g = (data[x] >> default_green_offset) & 0xFF;
+ g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
g = g >> RrGreenShift(inst);
- b = (data[x] >> default_blue_offset) & 0xFF;
+ b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
b = b >> RrBlueShift(inst);
p16[x] = (r << RrRedOffset(inst))
+ (g << RrGreenOffset(inst))
for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) {
p8[x] = pickColor(inst,
- data[x] >> default_red_offset,
- data[x] >> default_green_offset,
- data[x] >> default_blue_offset)->pixel;
+ data[x] >> RrDefaultRedOffset,
+ data[x] >> RrDefaultGreenOffset,
+ data[x] >> RrDefaultBlueOffset)->pixel;
}
data += im->width;
p8 += im->bytes_per_line;
RrPixel16 *p16 = (RrPixel16 *) im->data;
unsigned char *p8 = (unsigned char *)im->data;
- if (im->byte_order != render_endian)
+ if (im->byte_order != RrEndian)
swap_byte_order(im);
switch (im->bits_per_pixel) {
r = (p32[x] >> RrRedOffset(inst)) & 0xff;
g = (p32[x] >> RrGreenOffset(inst)) & 0xff;
b = (p32[x] >> RrBlueOffset(inst)) & 0xff;
- data[x] = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset)
- + (0xff << default_alpha_offset);
+ data[x] = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset)
+ + (0xff << RrDefaultAlphaOffset);
}
data += im->width;
p32 += im->bytes_per_line/4;
b = (p16[x] & RrBlueMask(inst)) >>
RrBlueOffset(inst) <<
RrBlueShift(inst);
- data[x] = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset)
- + (0xff << default_alpha_offset);
+ data[x] = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset)
+ + (0xff << RrDefaultAlphaOffset);
}
data += im->width;
p16 += im->bytes_per_line/2;
for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) {
if (!(((p8[x / 8]) >> (x % 8)) & 0x1))
- data[x] = 0xff << default_alpha_offset; /* black */
+ data[x] = 0xff << RrDefaultAlphaOffset; /* black */
else
data[x] = 0xffffffff; /* white */
}
#include <X11/Xutil.h>
#include <glib.h>
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-#define default_red_offset 0
-#define default_green_offset 8
-#define default_blue_offset 16
-#define default_alpha_offset 24
-#define render_endian MSBFirst
-#else
-#define default_alpha_offset 24
-#define default_red_offset 16
-#define default_green_offset 8
-#define default_blue_offset 0
-#define render_endian LSBFirst
-#endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
-
struct _RrColor {
const RrInstance *inst;
#include "font.h"
+#include "color.h"
+#include "mask.h"
#include "theme.h"
#include "kernel/geom.h"
#include "kernel/gettext.h"
r = sf->border_color->r;
g = sf->border_color->g;
b = sf->border_color->b;
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
for (off = 0, x = 0; x < w; ++x, off++) {
*(data + off) = current;
*(data + off + ((h-1) * w)) = current;
r = sf->primary->r + (int)(dr * y);
g = sf->primary->g + (int)(dg * y);
b = sf->primary->b + (int)(db * y);
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
for (x = 0; x < w; ++x, ++data)
*data = current;
}
r = sf->primary->r + (int)(dr * x);
g = sf->primary->g + (int)(dg * x);
b = sf->primary->b + (int)(db * x);
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
for (y = 0; y < h; ++y)
*(data + y*w) = current;
}
((int)(dgx * x) + (int)(dgy * y))/2;
b = sf->primary->b +
((int)(dbx * x) + (int)(dby * y))/2;
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
*data = current;
}
}
((int)(dgx * (x-1)) + (int)(dgy * y))/2;
b = sf->primary->b +
((int)(dbx * (x-1)) + (int)(dby * y))/2;
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
*data = current;
}
}
up = y;
down = x;
}
- r = (*up >> default_red_offset) & 0xFF;
+ r = (*up >> RrDefaultRedOffset) & 0xFF;
r += r >> 1;
- g = (*up >> default_green_offset) & 0xFF;
+ g = (*up >> RrDefaultGreenOffset) & 0xFF;
g += g >> 1;
- b = (*up >> default_blue_offset) & 0xFF;
+ b = (*up >> RrDefaultBlueOffset) & 0xFF;
b += b >> 1;
if (r > 0xFF) r = 0xFF;
if (g > 0xFF) g = 0xFF;
if (b > 0xFF) b = 0xFF;
- *up = (r << default_red_offset) + (g << default_green_offset)
- + (b << default_blue_offset);
+ *up = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
- r = (*down >> default_red_offset) & 0xFF;
+ r = (*down >> RrDefaultRedOffset) & 0xFF;
r = (r >> 1) + (r >> 2);
- g = (*down >> default_green_offset) & 0xFF;
+ g = (*down >> RrDefaultGreenOffset) & 0xFF;
g = (g >> 1) + (g >> 2);
- b = (*down >> default_blue_offset) & 0xFF;
+ b = (*down >> RrDefaultBlueOffset) & 0xFF;
b = (b >> 1) + (b >> 2);
- *down = (r << default_red_offset) + (g << default_green_offset)
- + (b << default_blue_offset);
+ *down = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
}
static void create_bevel_colors(RrAppearance *l)
if (sp->primary->gc == None)
color_allocate_gc(sp->primary);
- pix = (sp->primary->r << default_red_offset)
- + (sp->primary->g << default_green_offset)
- + (sp->primary->b << default_blue_offset);
+ pix = (sp->primary->r << RrDefaultRedOffset)
+ + (sp->primary->g << RrDefaultGreenOffset)
+ + (sp->primary->b << RrDefaultBlueOffset);
for (a = 0; a < w; a++)
for (b = 0; b < h; b++)
((int)(dgx * x) + (int)(dgy * y))/2;
b = sf->primary->b +
((int)(dbx * x) + (int)(dby * y))/2;
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
*(data+x) = current;
*(data+inw-x) = current;
*(end-x) = current;
g = sf->primary->g + (dgy * x);
b = sf->primary->b + (dby * x);
}
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
*(data+x) = current;
*(data+inw-x) = current;
*(end-x) = current;
g = sf->primary->g + (dgy * x);
b = sf->primary->b + (dby * x);
}
- current = (r << default_red_offset)
- + (g << default_green_offset)
- + (b << default_blue_offset);
+ current = (r << RrDefaultRedOffset)
+ + (g << RrDefaultGreenOffset)
+ + (b << RrDefaultBlueOffset);
*(data+x) = current;
*(data+inw-x) = current;
*(end-x) = current;
-#include "../kernel/geom.h"
+#include "kernel/geom.h"
#include "image.h"
#include "color.h"
for (i = 0, c = 0, t = area->x, e = sfw*sfh; i < e; ++i, ++t) {
guchar alpha, r, g, b, bgr, bgg, bgb;
- alpha = draw[i] >> default_alpha_offset;
- r = draw[i] >> default_red_offset;
- g = draw[i] >> default_green_offset;
- b = draw[i] >> default_blue_offset;
+ alpha = draw[i] >> RrDefaultAlphaOffset;
+ r = draw[i] >> RrDefaultRedOffset;
+ g = draw[i] >> RrDefaultGreenOffset;
+ b = draw[i] >> RrDefaultBlueOffset;
if (c >= sfw) {
c = 0;
}
/* background color */
- bgr = target[t] >> default_red_offset;
- bgg = target[t] >> default_green_offset;
- bgb = target[t] >> default_blue_offset;
+ bgr = target[t] >> RrDefaultRedOffset;
+ bgg = target[t] >> RrDefaultGreenOffset;
+ bgb = target[t] >> RrDefaultBlueOffset;
r = bgr + (((r - bgr) * alpha) >> 8);
g = bgg + (((g - bgg) * alpha) >> 8);
b = bgb + (((b - bgb) * alpha) >> 8);
- target[t] = (r << default_red_offset)
- | (g << default_green_offset)
- | (b << default_blue_offset);
+ target[t] = (r << RrDefaultRedOffset)
+ | (g << RrDefaultGreenOffset)
+ | (b << RrDefaultBlueOffset);
}
}
}
#include "render.h"
#include "../kernel/geom.h"
-void image_draw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area);
+void RrImageDraw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area);
#endif
in = l->surface.RrPixel_data;
out = l->pixmap;
- im->byte_order = render_endian;
+ im->byte_order = RrEndian;
/* this malloc is a complete waste of time on normal 32bpp
as reduce_depth just sets im->data = data and returns
*/
for (i = 0, y = 0; y < ph; ++y) {
for (x = 0; x < pw; ++x, ++i) {
if (!((((unsigned)xm->data[di + x / 8]) >> (x % 8)) & 0x1))
- (*data)[i] &= ~(0xff << default_alpha_offset);
+ (*data)[i] &= ~(0xff << RrDefaultAlphaOffset);
}
di += xm->bytes_per_line;
}
gint w, h;
};
+#if (G_BYTE_ORDER == G_BIG_ENDIAN)
+#define RrDefaultRedOffset 0
+#define RrDefaultGreenOffset 8
+#define RrDefaultBlueOffset 16
+#define RrDefaultAlphaOffset 24
+#define RrEndian MSBFirst
+#else
+#define RrDefaultAlphaOffset 24
+#define RrDefaultRedOffset 16
+#define RrDefaultGreenOffset 8
+#define RrDefaultBlueOffset 0
+#define RrEndian LSBFirst
+#endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
+
RrInstance* RrInstanceNew (Display *display, gint screen);
void RrInstanceFree (RrInstance *inst);
#define __theme_h
#include "render.h"
-#include "color.h"
-#include "mask.h"
typedef struct _RrTheme RrTheme;