mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Remove dead code from wrlib
This commit is contained in:
committed by
Carlos R. Mafra
parent
7d905787d2
commit
28cbda550a
@@ -40,7 +40,7 @@ cycle_bench(int start)
|
||||
|
||||
|
||||
#if 0
|
||||
// seems linux doesnt allow user progs to exec rdpcm..
|
||||
// seems linux doesnt allow user progs to exec rdpmc
|
||||
inline static void
|
||||
cache_bench(int start)
|
||||
{
|
||||
|
||||
@@ -629,7 +629,6 @@ RContext *RCreateContext(Display * dpy, int screen_number, RContextAttributes *
|
||||
context->drawable =
|
||||
XCreateWindow(dpy, RootWindow(dpy, screen_number), 1, 1,
|
||||
1, 1, 0, context->depth, CopyFromParent, context->visual, mask, &attr);
|
||||
/* XSetWindowColormap(dpy, context->drawable, attr.colormap); */
|
||||
}
|
||||
XFree(vinfo);
|
||||
}
|
||||
@@ -718,22 +717,6 @@ static Bool bestContext(Display * dpy, int screen_number, RContext * context)
|
||||
best = i;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (best == -1) { /* look for a DirectColor, 24-bit or more (pref 24) */
|
||||
rvinfo.class = DirectColor;
|
||||
if (vinfo)
|
||||
XFree((char *)vinfo);
|
||||
vinfo = XGetVisualInfo(dpy, flags, &rvinfo, &numvis);
|
||||
if (vinfo) {
|
||||
for (i = 0, best = -1; i < numvis; i++) {
|
||||
if (vinfo[i].depth == 24)
|
||||
best = i;
|
||||
else if (vinfo[i].depth > 24 && best < 0)
|
||||
best = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (best > -1) {
|
||||
context->visual = vinfo[best].visual;
|
||||
context->depth = vinfo[best].depth;
|
||||
@@ -747,7 +730,6 @@ static Bool bestContext(Display * dpy, int screen_number, RContext * context)
|
||||
1, 1, 1, 1, 0, context->depth,
|
||||
CopyFromParent, context->visual,
|
||||
CWBorderPixel | CWColormap | CWOverrideRedirect, &attr);
|
||||
/* XSetWindowColormap(dpy, context->drawable, context->cmap); */
|
||||
}
|
||||
if (vinfo)
|
||||
XFree((char *)vinfo);
|
||||
|
||||
@@ -588,17 +588,8 @@ static RXImage *image2PseudoColor(RContext * ctx, RImage * image)
|
||||
memset(nerr, 0, 4 * (image->width + 3));
|
||||
|
||||
/*#ifdef ASM_X86 */
|
||||
#if 0
|
||||
x86_PseudoColor_32_to_8(image->data, ximg->image->data,
|
||||
err + 4, nerr + 4,
|
||||
rtable,
|
||||
dr, dg, db, ctx->pixels, cpc,
|
||||
image->width, image->height,
|
||||
channels, ximg->image->bytes_per_line - image->width);
|
||||
#else
|
||||
convertPseudoColor_to_8(ximg, image, err + 4, nerr + 4,
|
||||
rtable, gtable, btable, dr, dg, db, ctx->pixels, cpc);
|
||||
#endif
|
||||
|
||||
free(err);
|
||||
free(nerr);
|
||||
|
||||
181
wrlib/convolve.c
181
wrlib/convolve.c
@@ -137,184 +137,3 @@ int RBlurImage(RImage * image)
|
||||
return True;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int REdgeDetectImage(RImage * image)
|
||||
{
|
||||
register int x, y, d1, d2, d3, d4, rsum;
|
||||
int w;
|
||||
unsigned char *r, *g, *b, *a;
|
||||
unsigned char *dr, *dg, *db, *da;
|
||||
unsigned char *pr = NULL, *pg = NULL, *pb = NULL, *pa = NULL;
|
||||
RImage *image2;
|
||||
|
||||
image2 = RCloneImage(image);
|
||||
|
||||
pr = alloca(image->width * sizeof(char));
|
||||
if (!pr)
|
||||
goto outofmem;
|
||||
|
||||
pg = alloca(image->width * sizeof(char));
|
||||
if (!pg)
|
||||
goto outofmem;
|
||||
|
||||
pb = alloca(image->width * sizeof(char));
|
||||
if (!pb)
|
||||
goto outofmem;
|
||||
|
||||
pa = alloca(image->width * sizeof(char));
|
||||
if (!pa)
|
||||
goto outofmem;
|
||||
|
||||
r = image->data[0];
|
||||
g = image->data[1];
|
||||
b = image->data[2];
|
||||
a = image->data[3];
|
||||
|
||||
dr = image2->data[0];
|
||||
dg = image2->data[1];
|
||||
db = image2->data[2];
|
||||
da = image2->data[3];
|
||||
|
||||
for (x = 0; x < image->width; x++) {
|
||||
*(dr++) = *(r++);
|
||||
*(dg++) = *(g++);
|
||||
*(db++) = *(b++);
|
||||
}
|
||||
|
||||
w = image->width;
|
||||
|
||||
for (y = 1; y < image->height - 1; y++) {
|
||||
dr[w - 1] = r[w - 1];
|
||||
dg[w - 1] = g[w - 1];
|
||||
db[w - 1] = b[w - 1];
|
||||
|
||||
*(dr++) = *(r++);
|
||||
*(dg++) = *(g++);
|
||||
*(db++) = *(b++);
|
||||
|
||||
for (x = 1; x < image->width - 1; x++) {
|
||||
d1 = r[w + 1] - r[-w - 1];
|
||||
d2 = r[1] - r[-1];
|
||||
d3 = r[-w + 1] - r[w - 1];
|
||||
d4 = r[-w] - r[w];
|
||||
|
||||
rsum = d1 + d2 + d3;
|
||||
if (rsum < 0)
|
||||
rsum = -rsum;
|
||||
d1 = d1 - d2 - d4; /* vertical gradient */
|
||||
if (d1 < 0)
|
||||
d1 = -d1;
|
||||
if (d1 > rsum)
|
||||
rsum = d1;
|
||||
rsum /= 3;
|
||||
|
||||
*(dr++) = rsum;
|
||||
|
||||
d1 = g[w + 1] - g[-w - 1];
|
||||
d2 = g[1] - g[-1];
|
||||
d3 = g[-w + 1] - g[w - 1];
|
||||
d4 = g[-w] - g[w];
|
||||
|
||||
rsum = d1 + d2 + d3;
|
||||
if (rsum < 0)
|
||||
rsum = -rsum;
|
||||
d1 = d1 - d2 - d4; /* vertical gradient */
|
||||
if (d1 < 0)
|
||||
d1 = -d1;
|
||||
if (d1 > rsum)
|
||||
rsum = d1;
|
||||
rsum /= 3;
|
||||
|
||||
*(dg++) = rsum;
|
||||
|
||||
d1 = b[w + 1] - b[-w - 1];
|
||||
d2 = b[1] - b[-1];
|
||||
d3 = b[-w + 1] - b[w - 1];
|
||||
d4 = b[-w] - b[w];
|
||||
|
||||
rsum = d1 + d2 + d3;
|
||||
if (rsum < 0)
|
||||
rsum = -rsum;
|
||||
d1 = d1 - d2 - d4; /* vertical gradient */
|
||||
if (d1 < 0)
|
||||
d1 = -d1;
|
||||
if (d1 > rsum)
|
||||
rsum = d1;
|
||||
rsum /= 3;
|
||||
|
||||
*(db++) = rsum;
|
||||
|
||||
r++;
|
||||
g++;
|
||||
b++;
|
||||
}
|
||||
r++;
|
||||
g++;
|
||||
b++;
|
||||
|
||||
dr++;
|
||||
dg++;
|
||||
db++;
|
||||
}
|
||||
{
|
||||
r = image->data[0];
|
||||
image2->data[0] = r;
|
||||
g = image->data[1];
|
||||
image2->data[1] = g;
|
||||
b = image->data[2];
|
||||
image2->data[2] = b;
|
||||
RReleaseImage(image2);
|
||||
}
|
||||
|
||||
#undef MASK
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
int RSmoothImage(RImage * image)
|
||||
{
|
||||
register int x, y;
|
||||
register int v, w;
|
||||
unsigned char *ptr;
|
||||
int ch = image->format == RRGBAFormat;
|
||||
|
||||
ptr = image->data;
|
||||
|
||||
w = image->width * ch;
|
||||
for (y = 0; y < image->height - 1; y++) {
|
||||
for (x = 0; x < image->width - 1; x++) {
|
||||
v = *ptr + 2 * *(ptr + ch) + 2 * *(ptr + w) + *(ptr + w + ch);
|
||||
*ptr = v / 6;
|
||||
v = *(ptr + 1) + 2 * *(ptr + 1 + ch) + 2 * *(ptr + 1 + w) + *(ptr + 1 + w + ch);
|
||||
*(ptr + 1) = v / 6;
|
||||
v = *(ptr + 2) + 2 * *(ptr + 2 + ch) + 2 * *(ptr + 2 + w) + *(ptr + 2 + w + ch);
|
||||
*(ptr + 2) = v / 6;
|
||||
|
||||
ptr += ch;
|
||||
}
|
||||
/* last column */
|
||||
v = 3 * *ptr + 3 * *(ptr + w);
|
||||
*ptr = v / 6;
|
||||
v = 3 * *(ptr + 1) + 3 * *(ptr + 1 + w);
|
||||
*(ptr + 1) = v / 6;
|
||||
v = 3 * *(ptr + 2) + 3 * *(ptr + 2 + w);
|
||||
*(ptr + 2) = v / 6;
|
||||
|
||||
ptr += ch;
|
||||
}
|
||||
|
||||
/* last line */
|
||||
for (x = 0; x < image->width - 1; x++) {
|
||||
v = 3 * *ptr + 3 * *(ptr + ch);
|
||||
*ptr = v / 6;
|
||||
v = 3 * *(ptr + 1) + 3 * *(ptr + 1 + ch);
|
||||
*(ptr + 1) = v / 6;
|
||||
v = 3 * *(ptr + 2) + 3 * *(ptr + 2 + ch);
|
||||
*(ptr + 2) = v / 6;
|
||||
|
||||
ptr += ch;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
#endif
|
||||
|
||||
108
wrlib/draw.c
108
wrlib/draw.c
@@ -372,114 +372,6 @@ static int genericLine(RImage * image, int x0, int y0, int x1, int y1, RColor *
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (mode == RALTER_PIXELS) {
|
||||
RColorOffset *cdelta = (RColorOffset *) cdata;
|
||||
register short r, g, b, a;
|
||||
|
||||
for (i = 0; i <= last; i++) {
|
||||
/* Change the pixel with offset */
|
||||
r = (short)*sr + cdelta->red;
|
||||
g = (short)*sg + cdelta->green;
|
||||
b = (short)*sb + cdelta->blue;
|
||||
if (r > 255)
|
||||
r = 255;
|
||||
else if (r < 0)
|
||||
r = 0;
|
||||
if (g > 255)
|
||||
g = 255;
|
||||
else if (g < 0)
|
||||
g = 0;
|
||||
if (b > 255)
|
||||
b = 255;
|
||||
else if (b < 0)
|
||||
b = 0;
|
||||
*sr = (unsigned char)r;
|
||||
*sg = (unsigned char)g;
|
||||
*sb = (unsigned char)b;
|
||||
if (image->data[3]) {
|
||||
a = (short)*sa + cdelta->alpha;
|
||||
if (a > 255)
|
||||
a = 255;
|
||||
else if (a < 0)
|
||||
a = 0;
|
||||
*sa = (unsigned char)a;
|
||||
}
|
||||
|
||||
/* Compute error for NeXT Step */
|
||||
err += dv2;
|
||||
if (err >= du) {
|
||||
sr += vofs;
|
||||
sg += vofs;
|
||||
sb += vofs;
|
||||
sa += vofs;
|
||||
err -= du2;
|
||||
}
|
||||
sr += uofs;
|
||||
sg += uofs;
|
||||
sb += uofs;
|
||||
sa += uofs;
|
||||
}
|
||||
} else {
|
||||
RColor *color = (RColor *) cdata;
|
||||
|
||||
if (color->alpha == 255) {
|
||||
for (i = 0; i <= last; i++) {
|
||||
/* Draw the pixel */
|
||||
*sr = color->red;
|
||||
*sg = color->green;
|
||||
*sb = color->blue;
|
||||
if (image->data[3])
|
||||
*sa = 255;
|
||||
|
||||
/* Compute error for NeXT Step */
|
||||
err += dv2;
|
||||
if (err >= du) {
|
||||
sr += vofs;
|
||||
sg += vofs;
|
||||
sb += vofs;
|
||||
sa += vofs;
|
||||
err -= du2;
|
||||
}
|
||||
sr += uofs;
|
||||
sg += uofs;
|
||||
sb += uofs;
|
||||
sa += uofs;
|
||||
}
|
||||
} else {
|
||||
register short alpha, nalpha, r, g, b;
|
||||
|
||||
alpha = color->alpha;
|
||||
nalpha = 255 - alpha;
|
||||
r = color->red;
|
||||
g = color->green;
|
||||
b = color->blue;
|
||||
|
||||
for (i = 0; i <= last; i++) {
|
||||
/* Draw the pixel */
|
||||
*sr = (((int)*sr * nalpha) + (r * alpha)) / 256;
|
||||
*sg = (((int)*sg * nalpha) + (g * alpha)) / 256;
|
||||
*sb = (((int)*sb * nalpha) + (b * alpha)) / 256;
|
||||
if (image->data[3])
|
||||
*sa = alpha + ((int)*sa * nalpha) / 256;
|
||||
|
||||
/* Compute error for NeXT Step */
|
||||
err += dv2;
|
||||
if (err >= du) {
|
||||
sr += vofs;
|
||||
sg += vofs;
|
||||
sb += vofs;
|
||||
sa += vofs;
|
||||
err -= du2;
|
||||
}
|
||||
sr += uofs;
|
||||
sg += uofs;
|
||||
sb += uofs;
|
||||
sa += uofs;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,19 +133,6 @@ RImage *RScaleImage(RImage * image, unsigned new_width, unsigned new_height)
|
||||
/*
|
||||
* filter function definitions
|
||||
*/
|
||||
#if 0
|
||||
#define filter_support (1.0)
|
||||
|
||||
static double filter(double t)
|
||||
{
|
||||
/* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
|
||||
if (t < 0.0)
|
||||
t = -t;
|
||||
if (t < 1.0)
|
||||
return ((2.0 * t - 3.0) * t * t + 1.0);
|
||||
return (0.0);
|
||||
}
|
||||
#endif
|
||||
#define box_support (0.5)
|
||||
|
||||
static double box_filter(double t)
|
||||
|
||||
Reference in New Issue
Block a user