all repos — openbox @ 50292dbd75763a192eee748cc6c0b3e15505e7fe

openbox fork - make it a bit more like ryudo

a "osx" gradient, it is like horizontal but mirrors in the center
Mikael Magnusson mikachu@comhem.se
commit

50292dbd75763a192eee748cc6c0b3e15505e7fe

parent

6212b7c19bc43df2bfcb02ae074c791231ba8f94

3 files changed, 45 insertions(+), 1 deletions(-)

jump to
M render/gradient.crender/gradient.c

@@ -27,6 +27,7 @@ static void gradient_solid(RrAppearance *l, gint w, gint h);

static void gradient_split(RrAppearance *a, gint w, gint h); static void gradient_vertical(RrSurface *sf, gint w, gint h); static void gradient_horizontal(RrSurface *sf, gint w, gint h); +static void gradient_osx(RrSurface *sf, gint w, gint h); static void gradient_diagonal(RrSurface *sf, gint w, gint h); static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h); static void gradient_pyramid(RrSurface *sf, gint inw, gint inh);

@@ -50,6 +51,9 @@ gradient_vertical(&a->surface, w, h);

break; case RR_SURFACE_HORIZONTAL: gradient_horizontal(&a->surface, w, h); + break; + case RR_SURFACE_OSX: + gradient_osx(&a->surface, w, h); break; case RR_SURFACE_DIAGONAL: gradient_diagonal(&a->surface, w, h);

@@ -434,6 +438,43 @@ VARS(x);

SETUP(x, sf->primary, sf->secondary, w); for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */ + current = COLOR(x); + datav = data; + for (y = h - 1; y >= 0; --y) { /* 0 -> h */ + *datav = current; + datav += w; + } + ++data; + + NEXT(x); + } + current = COLOR(x); + for (y = h - 1; y >= 0; --y) /* 0 -> h */ + *(data + y * w) = current; +} + +static void gradient_osx(RrSurface *sf, gint w, gint h) +{ + gint x, y; + RrPixel32 *data = sf->pixel_data, *datav; + RrPixel32 current; + + VARS(x); + SETUP(x, sf->primary, sf->secondary, w/2); + + for (x = w - 1; x > w/2-1; --x) { /* 0 -> w-1 */ + current = COLOR(x); + datav = data; + for (y = h - 1; y >= 0; --y) { /* 0 -> h */ + *datav = current; + datav += w; + } + ++data; + + NEXT(x); + } + SETUP(x, sf->secondary, sf->primary, w/2); + for (x = w/2 - 1; x > 0; --x) { /* 0 -> w-1 */ current = COLOR(x); datav = data; for (y = h - 1; y >= 0; --y) { /* 0 -> h */
M render/render.hrender/render.h

@@ -66,7 +66,8 @@ RR_SURFACE_HORIZONTAL,

RR_SURFACE_VERTICAL, RR_SURFACE_DIAGONAL, RR_SURFACE_CROSS_DIAGONAL, - RR_SURFACE_PYRAMID + RR_SURFACE_PYRAMID, + RR_SURFACE_OSX } RrSurfaceColorType; typedef enum {
M render/theme.crender/theme.c

@@ -1196,6 +1196,8 @@ if (strstr(tex, "crossdiagonal") != NULL)

*grad = RR_SURFACE_CROSS_DIAGONAL; else if (strstr(tex, "pyramid") != NULL) *grad = RR_SURFACE_PYRAMID; + else if (strstr(tex, "osx") != NULL) + *grad = RR_SURFACE_OSX; else if (strstr(tex, "horizontal") != NULL) *grad = RR_SURFACE_HORIZONTAL; else if (strstr(tex, "vertical") != NULL)