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; ++y;
} }
self->icons[j].data[t] = self->icons[j].data[t] =
(((data[i] >> 24) & 0xff) << default_alpha_offset) + (((data[i] >> 24) & 0xff) << RrDefaultAlphaOffset) +
(((data[i] >> 16) & 0xff) << default_red_offset) + (((data[i] >> 16) & 0xff) << RrDefaultRedOffset) +
(((data[i] >> 8) & 0xff) << default_green_offset) + (((data[i] >> 8) & 0xff) << RrDefaultGreenOffset) +
(((data[i] >> 0) & 0xff) << default_blue_offset); (((data[i] >> 0) & 0xff) << RrDefaultBlueOffset);
} }
g_assert(i <= num); g_assert(i <= num);
} }

View file

@ -11,7 +11,7 @@
#include "focus.h" #include "focus.h"
#include "dispatch.h" #include "dispatch.h"
#include "extensions.h" #include "extensions.h"
#include "../render/render.h" #include "render/render.h"
#ifdef USE_LIBSN #ifdef USE_LIBSN
# define SN_API_NOT_YET_FROZEN # 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; unsigned char *p8 = (unsigned char *)im->data;
switch (im->bits_per_pixel) { switch (im->bits_per_pixel) {
case 32: case 32:
if ((RrRedOffset(inst) != default_red_offset) || if ((RrRedOffset(inst) != RrDefaultRedOffset) ||
(RrBlueOffset(inst) != default_blue_offset) || (RrBlueOffset(inst) != RrDefaultBlueOffset) ||
(RrGreenOffset(inst) != default_green_offset)) { (RrGreenOffset(inst) != RrDefaultGreenOffset)) {
for (y = 0; y < im->height; y++) { for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) { for (x = 0; x < im->width; x++) {
r = (data[x] >> default_red_offset) & 0xFF; r = (data[x] >> RrDefaultRedOffset) & 0xFF;
g = (data[x] >> default_green_offset) & 0xFF; g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
b = (data[x] >> default_blue_offset) & 0xFF; b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
p32[x] = (r << RrRedShift(inst)) p32[x] = (r << RrRedShift(inst))
+ (g << RrGreenShift(inst)) + (g << RrGreenShift(inst))
+ (b << RrBlueShift(inst)); + (b << RrBlueShift(inst));
@ -95,11 +95,11 @@ void reduce_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
case 16: case 16:
for (y = 0; y < im->height; y++) { for (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) { for (x = 0; x < im->width; x++) {
r = (data[x] >> default_red_offset) & 0xFF; r = (data[x] >> RrDefaultRedOffset) & 0xFF;
r = r >> RrRedShift(inst); r = r >> RrRedShift(inst);
g = (data[x] >> default_green_offset) & 0xFF; g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
g = g >> RrGreenShift(inst); g = g >> RrGreenShift(inst);
b = (data[x] >> default_blue_offset) & 0xFF; b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
b = b >> RrBlueShift(inst); b = b >> RrBlueShift(inst);
p16[x] = (r << RrRedOffset(inst)) p16[x] = (r << RrRedOffset(inst))
+ (g << RrGreenOffset(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 (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) { for (x = 0; x < im->width; x++) {
p8[x] = pickColor(inst, p8[x] = pickColor(inst,
data[x] >> default_red_offset, data[x] >> RrDefaultRedOffset,
data[x] >> default_green_offset, data[x] >> RrDefaultGreenOffset,
data[x] >> default_blue_offset)->pixel; data[x] >> RrDefaultBlueOffset)->pixel;
} }
data += im->width; data += im->width;
p8 += im->bytes_per_line; p8 += im->bytes_per_line;
@ -182,7 +182,7 @@ void increase_depth(const RrInstance *inst, RrPixel32 *data, XImage *im)
RrPixel16 *p16 = (RrPixel16 *) im->data; RrPixel16 *p16 = (RrPixel16 *) im->data;
unsigned char *p8 = (unsigned char *)im->data; unsigned char *p8 = (unsigned char *)im->data;
if (im->byte_order != render_endian) if (im->byte_order != RrEndian)
swap_byte_order(im); swap_byte_order(im);
switch (im->bits_per_pixel) { 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; r = (p32[x] >> RrRedOffset(inst)) & 0xff;
g = (p32[x] >> RrGreenOffset(inst)) & 0xff; g = (p32[x] >> RrGreenOffset(inst)) & 0xff;
b = (p32[x] >> RrBlueOffset(inst)) & 0xff; b = (p32[x] >> RrBlueOffset(inst)) & 0xff;
data[x] = (r << default_red_offset) data[x] = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset) + (b << RrDefaultBlueOffset)
+ (0xff << default_alpha_offset); + (0xff << RrDefaultAlphaOffset);
} }
data += im->width; data += im->width;
p32 += im->bytes_per_line/4; 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)) >> b = (p16[x] & RrBlueMask(inst)) >>
RrBlueOffset(inst) << RrBlueOffset(inst) <<
RrBlueShift(inst); RrBlueShift(inst);
data[x] = (r << default_red_offset) data[x] = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset) + (b << RrDefaultBlueOffset)
+ (0xff << default_alpha_offset); + (0xff << RrDefaultAlphaOffset);
} }
data += im->width; data += im->width;
p16 += im->bytes_per_line/2; 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 (y = 0; y < im->height; y++) {
for (x = 0; x < im->width; x++) { for (x = 0; x < im->width; x++) {
if (!(((p8[x / 8]) >> (x % 8)) & 0x1)) if (!(((p8[x / 8]) >> (x % 8)) & 0x1))
data[x] = 0xff << default_alpha_offset; /* black */ data[x] = 0xff << RrDefaultAlphaOffset; /* black */
else else
data[x] = 0xffffffff; /* white */ data[x] = 0xffffffff; /* white */
} }

View file

@ -7,20 +7,6 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <glib.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 { struct _RrColor {
const RrInstance *inst; const RrInstance *inst;

View file

@ -1,4 +1,6 @@
#include "font.h" #include "font.h"
#include "color.h"
#include "mask.h"
#include "theme.h" #include "theme.h"
#include "kernel/geom.h" #include "kernel/geom.h"
#include "kernel/gettext.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; r = sf->border_color->r;
g = sf->border_color->g; g = sf->border_color->g;
b = sf->border_color->b; b = sf->border_color->b;
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
for (off = 0, x = 0; x < w; ++x, off++) { for (off = 0, x = 0; x < w; ++x, off++) {
*(data + off) = current; *(data + off) = current;
*(data + off + ((h-1) * w)) = 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); r = sf->primary->r + (int)(dr * y);
g = sf->primary->g + (int)(dg * y); g = sf->primary->g + (int)(dg * y);
b = sf->primary->b + (int)(db * y); b = sf->primary->b + (int)(db * y);
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
for (x = 0; x < w; ++x, ++data) for (x = 0; x < w; ++x, ++data)
*data = current; *data = current;
} }
@ -133,9 +133,9 @@ void gradient_horizontal(RrSurface *sf, int w, int h)
r = sf->primary->r + (int)(dr * x); r = sf->primary->r + (int)(dr * x);
g = sf->primary->g + (int)(dg * x); g = sf->primary->g + (int)(dg * x);
b = sf->primary->b + (int)(db * x); b = sf->primary->b + (int)(db * x);
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
for (y = 0; y < h; ++y) for (y = 0; y < h; ++y)
*(data + y*w) = current; *(data + y*w) = current;
} }
@ -171,9 +171,9 @@ void gradient_diagonal(RrSurface *sf, int w, int h)
((int)(dgx * x) + (int)(dgy * y))/2; ((int)(dgx * x) + (int)(dgy * y))/2;
b = sf->primary->b + b = sf->primary->b +
((int)(dbx * x) + (int)(dby * y))/2; ((int)(dbx * x) + (int)(dby * y))/2;
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
*data = current; *data = current;
} }
} }
@ -209,9 +209,9 @@ void gradient_crossdiagonal(RrSurface *sf, int w, int h)
((int)(dgx * (x-1)) + (int)(dgy * y))/2; ((int)(dgx * (x-1)) + (int)(dgy * y))/2;
b = sf->primary->b + b = sf->primary->b +
((int)(dbx * (x-1)) + (int)(dby * y))/2; ((int)(dbx * (x-1)) + (int)(dby * y))/2;
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
*data = current; *data = current;
} }
} }
@ -229,26 +229,26 @@ void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
up = y; up = y;
down = x; down = x;
} }
r = (*up >> default_red_offset) & 0xFF; r = (*up >> RrDefaultRedOffset) & 0xFF;
r += r >> 1; r += r >> 1;
g = (*up >> default_green_offset) & 0xFF; g = (*up >> RrDefaultGreenOffset) & 0xFF;
g += g >> 1; g += g >> 1;
b = (*up >> default_blue_offset) & 0xFF; b = (*up >> RrDefaultBlueOffset) & 0xFF;
b += b >> 1; b += b >> 1;
if (r > 0xFF) r = 0xFF; if (r > 0xFF) r = 0xFF;
if (g > 0xFF) g = 0xFF; if (g > 0xFF) g = 0xFF;
if (b > 0xFF) b = 0xFF; if (b > 0xFF) b = 0xFF;
*up = (r << default_red_offset) + (g << default_green_offset) *up = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
r = (*down >> default_red_offset) & 0xFF; r = (*down >> RrDefaultRedOffset) & 0xFF;
r = (r >> 1) + (r >> 2); r = (r >> 1) + (r >> 2);
g = (*down >> default_green_offset) & 0xFF; g = (*down >> RrDefaultGreenOffset) & 0xFF;
g = (g >> 1) + (g >> 2); g = (g >> 1) + (g >> 2);
b = (*down >> default_blue_offset) & 0xFF; b = (*down >> RrDefaultBlueOffset) & 0xFF;
b = (b >> 1) + (b >> 2); b = (b >> 1) + (b >> 2);
*down = (r << default_red_offset) + (g << default_green_offset) *down = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
} }
static void create_bevel_colors(RrAppearance *l) 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) if (sp->primary->gc == None)
color_allocate_gc(sp->primary); color_allocate_gc(sp->primary);
pix = (sp->primary->r << default_red_offset) pix = (sp->primary->r << RrDefaultRedOffset)
+ (sp->primary->g << default_green_offset) + (sp->primary->g << RrDefaultGreenOffset)
+ (sp->primary->b << default_blue_offset); + (sp->primary->b << RrDefaultBlueOffset);
for (a = 0; a < w; a++) for (a = 0; a < w; a++)
for (b = 0; b < h; b++) 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; ((int)(dgx * x) + (int)(dgy * y))/2;
b = sf->primary->b + b = sf->primary->b +
((int)(dbx * x) + (int)(dby * y))/2; ((int)(dbx * x) + (int)(dby * y))/2;
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
*(data+x) = current; *(data+x) = current;
*(data+inw-x) = current; *(data+inw-x) = current;
*(end-x) = current; *(end-x) = current;
@ -470,9 +470,9 @@ void gradient_rectangle(RrSurface *sf, int inw, int inh)
g = sf->primary->g + (dgy * x); g = sf->primary->g + (dgy * x);
b = sf->primary->b + (dby * x); b = sf->primary->b + (dby * x);
} }
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
*(data+x) = current; *(data+x) = current;
*(data+inw-x) = current; *(data+inw-x) = current;
*(end-x) = current; *(end-x) = current;
@ -518,9 +518,9 @@ void gradient_pipecross(RrSurface *sf, int inw, int inh)
g = sf->primary->g + (dgy * x); g = sf->primary->g + (dgy * x);
b = sf->primary->b + (dby * x); b = sf->primary->b + (dby * x);
} }
current = (r << default_red_offset) current = (r << RrDefaultRedOffset)
+ (g << default_green_offset) + (g << RrDefaultGreenOffset)
+ (b << default_blue_offset); + (b << RrDefaultBlueOffset);
*(data+x) = current; *(data+x) = current;
*(data+inw-x) = current; *(data+inw-x) = current;
*(end-x) = current; *(end-x) = current;

View file

@ -1,4 +1,4 @@
#include "../kernel/geom.h" #include "kernel/geom.h"
#include "image.h" #include "image.h"
#include "color.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) { for (i = 0, c = 0, t = area->x, e = sfw*sfh; i < e; ++i, ++t) {
guchar alpha, r, g, b, bgr, bgg, bgb; guchar alpha, r, g, b, bgr, bgg, bgb;
alpha = draw[i] >> default_alpha_offset; alpha = draw[i] >> RrDefaultAlphaOffset;
r = draw[i] >> default_red_offset; r = draw[i] >> RrDefaultRedOffset;
g = draw[i] >> default_green_offset; g = draw[i] >> RrDefaultGreenOffset;
b = draw[i] >> default_blue_offset; b = draw[i] >> RrDefaultBlueOffset;
if (c >= sfw) { if (c >= sfw) {
c = 0; c = 0;
@ -57,17 +57,17 @@ void image_draw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area)
} }
/* background color */ /* background color */
bgr = target[t] >> default_red_offset; bgr = target[t] >> RrDefaultRedOffset;
bgg = target[t] >> default_green_offset; bgg = target[t] >> RrDefaultGreenOffset;
bgb = target[t] >> default_blue_offset; bgb = target[t] >> RrDefaultBlueOffset;
r = bgr + (((r - bgr) * alpha) >> 8); r = bgr + (((r - bgr) * alpha) >> 8);
g = bgg + (((g - bgg) * alpha) >> 8); g = bgg + (((g - bgg) * alpha) >> 8);
b = bgb + (((b - bgb) * alpha) >> 8); b = bgb + (((b - bgb) * alpha) >> 8);
target[t] = (r << default_red_offset) target[t] = (r << RrDefaultRedOffset)
| (g << default_green_offset) | (g << RrDefaultGreenOffset)
| (b << default_blue_offset); | (b << RrDefaultBlueOffset);
} }
} }
} }

View file

@ -4,6 +4,6 @@
#include "render.h" #include "render.h"
#include "../kernel/geom.h" #include "../kernel/geom.h"
void image_draw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area); void RrImageDraw(RrPixel32 *target, RrTextureRGBA *rgba, Rect *area);
#endif #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; in = l->surface.RrPixel_data;
out = l->pixmap; out = l->pixmap;
im->byte_order = render_endian; im->byte_order = RrEndian;
/* this malloc is a complete waste of time on normal 32bpp /* this malloc is a complete waste of time on normal 32bpp
as reduce_depth just sets im->data = data and returns 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 (i = 0, y = 0; y < ph; ++y) {
for (x = 0; x < pw; ++x, ++i) { for (x = 0; x < pw; ++x, ++i) {
if (!((((unsigned)xm->data[di + x / 8]) >> (x % 8)) & 0x1)) 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; di += xm->bytes_per_line;
} }

View file

@ -132,6 +132,20 @@ struct _RrAppearance {
gint w, h; 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); RrInstance* RrInstanceNew (Display *display, gint screen);
void RrInstanceFree (RrInstance *inst); void RrInstanceFree (RrInstance *inst);

View file

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