more namespacing with Rr*

This commit is contained in:
Dana Jansens 2003-06-21 02:26:50 +00:00
parent 4541959b8c
commit c100b72c5d
11 changed files with 94 additions and 94 deletions

View file

@ -1340,10 +1340,10 @@ void client_update_icons(Client *self)
++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);
}

View file

@ -11,7 +11,7 @@
#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

View file

@ -75,14 +75,14 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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));
@ -95,11 +95,11 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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))
@ -114,9 +114,9 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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;
@ -182,7 +182,7 @@ void increase_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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) {
@ -192,10 +192,10 @@ void increase_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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;
@ -213,10 +213,10 @@ void increase_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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;
@ -229,7 +229,7 @@ void increase_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
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 */
}

View file

@ -7,20 +7,6 @@
#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;

View file

@ -1,4 +1,6 @@
#include "font.h"
#include "color.h"
#include "mask.h"
#include "theme.h"
#include "kernel/geom.h"
#include "kernel/gettext.h"

View file

@ -43,9 +43,9 @@ void gradient_render(RrSurface *sf, int w, int 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;
@ -104,9 +104,9 @@ void gradient_vertical(RrSurface *sf, int w, int h)
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;
}
@ -133,9 +133,9 @@ void gradient_horizontal(RrSurface *sf, int w, int h)
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;
}
@ -171,9 +171,9 @@ void gradient_diagonal(RrSurface *sf, int w, int h)
((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;
}
}
@ -209,9 +209,9 @@ void gradient_crossdiagonal(RrSurface *sf, int w, int h)
((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;
}
}
@ -229,26 +229,26 @@ void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
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)
@ -290,9 +290,9 @@ void gradient_solid(RrAppearance *l, int x, int y, int w, int h)
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++)
@ -422,9 +422,9 @@ void gradient_pyramid(RrSurface *sf, int inw, int inh)
((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;
@ -470,9 +470,9 @@ void gradient_rectangle(RrSurface *sf, int inw, int inh)
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;
@ -518,9 +518,9 @@ void gradient_pipecross(RrSurface *sf, int inw, int inh)
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;

View file

@ -1,4 +1,4 @@
#include "../kernel/geom.h"
#include "kernel/geom.h"
#include "image.h"
#include "color.h"
@ -46,10 +46,10 @@ void image_draw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area)
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;
@ -57,17 +57,17 @@ void image_draw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area)
}
/* 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);
}
}
}

View file

@ -4,6 +4,6 @@
#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

View file

@ -236,7 +236,7 @@ static void RrPixel32_to_pixmap(RrAppearance *l, gint x, gint y, gint w, gint h)
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
*/
@ -344,7 +344,7 @@ gboolean RrPixmapToRGBA(const RrInstance *inst,
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;
}

View file

@ -132,6 +132,20 @@ struct _RrAppearance {
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);

View file

@ -2,8 +2,6 @@
#define __theme_h
#include "render.h"
#include "color.h"
#include "mask.h"
typedef struct _RrTheme RrTheme;