removed unused code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-03-26 13:41:46 +00:00
parent 50e2329458
commit 3066991c06
3 changed files with 2 additions and 161 deletions

View file

@ -28,8 +28,8 @@ LDFLAGS = -lX11 -lm -lXt -lXmu -lsocket -lnsl
DEPEND = .depends
OBJS= alpha.o hsv.o screenhack.o yarandom.o uibasic.o resources.o visual.o\
usleep.o lcd.o lcd-x11.o
OBJS= alpha.o screenhack.o yarandom.o uibasic.o resources.o visual.o\
lcd.o lcd-x11.o
SRCS = $(OBJS:%.o=%.c)
HDRS = $(OBJS:%.o=%.h)

View file

@ -135,81 +135,3 @@ initialize_transparency_colormap (Display *dpy, Colormap cmap,
XFree ((XPointer) all_colors);
}
Bool
allocate_alpha_colors (Screen *screen, Visual *visual, Colormap cmap,
int *nplanesP, Bool additive_p,
unsigned long **plane_masks,
unsigned long *base_pixelP)
{
Display *dpy = DisplayOfScreen (screen);
XColor *colors;
int nplanes = *nplanesP;
int i;
if (!has_writable_cells (screen, visual))
cmap = 0;
if (!cmap) /* A TrueColor visual, or similar. */
{
int depth = visual_depth (screen, visual);
unsigned long masks;
XVisualInfo vi_in, *vi_out;
/* Find out which bits the R, G, and B components actually occupy
on this visual. */
vi_in.screen = screen_number (screen);
vi_in.visualid = XVisualIDFromVisual (visual);
vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask,
&vi_in, &i);
if (! vi_out) abort ();
masks = vi_out[0].red_mask | vi_out[0].green_mask | vi_out[0].blue_mask;
XFree ((char *) vi_out);
if (nplanes > depth)
nplanes = depth;
*nplanesP = nplanes;
*base_pixelP = 0;
*plane_masks = (unsigned long *) calloc(sizeof(unsigned long), nplanes);
/* Pick the planar values randomly, but constrain them to fall within
the bit positions of the R, G, and B fields. */
for (i = 0; i < nplanes; i++)
(*plane_masks)[i] = random() & masks;
}
else /* A PseudoColor visual, or similar. */
{
if (nplanes > 31) nplanes = 31;
*plane_masks = (unsigned long *) malloc(sizeof(unsigned long) * nplanes);
nplanes = allocate_color_planes (dpy, cmap, nplanes, *plane_masks,
base_pixelP);
*nplanesP = nplanes;
if (nplanes <= 1)
{
free(*plane_masks);
*plane_masks = 0;
return False;
}
colors = (XColor *) calloc (nplanes, sizeof (XColor));
for (i = 0; i < nplanes; i++)
{
/* pick the base colors. If we are in subtractive mode, pick higher
intensities. */
hsv_to_rgb (random () % 360,
frand (1.0),
frand (0.5) + (additive_p ? 0.2 : 0.5),
&colors[i].red,
&colors[i].green,
&colors[i].blue);
}
initialize_transparency_colormap (dpy, cmap, nplanes,
*base_pixelP, *plane_masks, colors,
additive_p);
XFree ((XPointer) colors);
}
return True;
}

View file

@ -1,81 +0,0 @@
/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
/* This file contains some utility routines for randomly picking the colors
to hack the screen with.
*/
#include "utils.h"
#include "hsv.h"
void
hsv_to_rgb (int h, double s, double v,
unsigned short *r, unsigned short *g, unsigned short *b)
{
double H, S, V, R, G, B;
double p1, p2, p3;
double f;
int i;
if (s < 0) s = 0;
if (v < 0) v = 0;
if (s > 1) s = 1;
if (v > 1) v = 1;
S = s; V = v;
H = (h % 360) / 60.0;
i = H;
f = H - i;
p1 = V * (1 - S);
p2 = V * (1 - (S * f));
p3 = V * (1 - (S * (1 - f)));
if (i == 0) { R = V; G = p3; B = p1; }
else if (i == 1) { R = p2; G = V; B = p1; }
else if (i == 2) { R = p1; G = V; B = p3; }
else if (i == 3) { R = p1; G = p2; B = V; }
else if (i == 4) { R = p3; G = p1; B = V; }
else { R = V; G = p1; B = p2; }
*r = R * 65535;
*g = G * 65535;
*b = B * 65535;
}
void
rgb_to_hsv (unsigned short r, unsigned short g, unsigned short b,
int *h, double *s, double *v)
{
double R, G, B, H, S, V;
double cmax, cmin;
double cmm;
int imax;
R = ((double) r) / 65535.0;
G = ((double) g) / 65535.0;
B = ((double) b) / 65535.0;
cmax = R; cmin = G; imax = 1;
if ( cmax < G ) { cmax = G; cmin = R; imax = 2; }
if ( cmax < B ) { cmax = B; imax = 3; }
if ( cmin > B ) { cmin = B; }
cmm = cmax - cmin;
V = cmax;
if (cmm == 0)
S = H = 0;
else
{
S = cmm / cmax;
if (imax == 1) H = (G - B) / cmm;
else if (imax == 2) H = 2.0 + (B - R) / cmm;
else /*if (imax == 3)*/ H = 4.0 + (R - G) / cmm;
if (H < 0) H += 6.0;
}
*h = (H * 60.0);
*s = S;
*v = V;
}