allow effects on parentrelative textures, ie bevels and interlaces and borders
This commit is contained in:
parent
4dec70d627
commit
3a89939c2d
3 changed files with 59 additions and 51 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
|
static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
|
||||||
|
static void gradient_parentrelative(RrAppearance *a, gint w, gint h);
|
||||||
static void gradient_solid(RrAppearance *l, gint w, gint h);
|
static void gradient_solid(RrAppearance *l, gint w, gint h);
|
||||||
static void gradient_splitvertical(RrAppearance *a, gint w, gint h);
|
static void gradient_splitvertical(RrAppearance *a, gint w, gint h);
|
||||||
static void gradient_vertical(RrSurface *sf, gint w, gint h);
|
static void gradient_vertical(RrSurface *sf, gint w, gint h);
|
||||||
|
@ -36,11 +37,14 @@ static void gradient_pyramid(RrSurface *sf, gint inw, gint inh);
|
||||||
void RrRender(RrAppearance *a, gint w, gint h)
|
void RrRender(RrAppearance *a, gint w, gint h)
|
||||||
{
|
{
|
||||||
RrPixel32 *data = a->surface.pixel_data;
|
RrPixel32 *data = a->surface.pixel_data;
|
||||||
RrPixel32 current;
|
RrPixel32 current, *source, *dest;
|
||||||
guint r,g,b;
|
guint r,g,b;
|
||||||
gint off, x;
|
gint off, x, sw, sh, partial_w, partial_h, i;
|
||||||
|
|
||||||
switch (a->surface.grad) {
|
switch (a->surface.grad) {
|
||||||
|
case RR_SURFACE_PARENTREL:
|
||||||
|
gradient_parentrelative(a, w, h);
|
||||||
|
break;
|
||||||
case RR_SURFACE_SOLID:
|
case RR_SURFACE_SOLID:
|
||||||
gradient_solid(a, w, h);
|
gradient_solid(a, w, h);
|
||||||
break;
|
break;
|
||||||
|
@ -190,6 +194,34 @@ static void create_bevel_colors(RrAppearance *l)
|
||||||
l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
|
l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gradient_parentrelative(RrAppearance *a, gint w, gint h)
|
||||||
|
{
|
||||||
|
RrPixel32 *source, *dest;
|
||||||
|
gint sw, sh, partial_w, partial_h, i;
|
||||||
|
|
||||||
|
g_assert (a->surface.parent);
|
||||||
|
g_assert (a->surface.parent->w);
|
||||||
|
|
||||||
|
sw = a->surface.parent->w;
|
||||||
|
sh = a->surface.parent->h;
|
||||||
|
|
||||||
|
source = (a->surface.parent->surface.pixel_data +
|
||||||
|
a->surface.parentx + sw * a->surface.parenty);
|
||||||
|
dest = a->surface.pixel_data;
|
||||||
|
|
||||||
|
if (a->surface.parentx + w > sw) {
|
||||||
|
partial_w = sw - a->surface.parentx;
|
||||||
|
} else partial_w = w;
|
||||||
|
|
||||||
|
if (a->surface.parenty + h > sh) {
|
||||||
|
partial_h = sh - a->surface.parenty;
|
||||||
|
} else partial_h = h;
|
||||||
|
|
||||||
|
for (i = 0; i < partial_h; i++, source += sw, dest += w) {
|
||||||
|
memcpy(dest, source, partial_w * sizeof(RrPixel32));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void gradient_solid(RrAppearance *l, gint w, gint h)
|
static void gradient_solid(RrAppearance *l, gint w, gint h)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
|
@ -40,8 +40,7 @@ static void pixel_data_to_pixmap(RrAppearance *l,
|
||||||
|
|
||||||
Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
|
Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
|
||||||
{
|
{
|
||||||
gint i, transferred = 0, sw, sh, partial_w, partial_h, force_transfer = 0;
|
gint i, transferred = 0, force_transfer = 0;
|
||||||
RrPixel32 *source, *dest;
|
|
||||||
Pixmap oldp = None;
|
Pixmap oldp = None;
|
||||||
RrRect tarea; /* area in which to draw textures */
|
RrRect tarea; /* area in which to draw textures */
|
||||||
gboolean resized;
|
gboolean resized;
|
||||||
|
@ -82,29 +81,6 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
|
||||||
a->surface.pixel_data = g_new(RrPixel32, w * h);
|
a->surface.pixel_data = g_new(RrPixel32, w * h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->surface.grad == RR_SURFACE_PARENTREL) {
|
|
||||||
g_assert (a->surface.parent);
|
|
||||||
g_assert (a->surface.parent->w);
|
|
||||||
|
|
||||||
sw = a->surface.parent->w;
|
|
||||||
sh = a->surface.parent->h;
|
|
||||||
|
|
||||||
source = (a->surface.parent->surface.pixel_data +
|
|
||||||
a->surface.parentx + sw * a->surface.parenty);
|
|
||||||
dest = a->surface.pixel_data;
|
|
||||||
|
|
||||||
if (a->surface.parentx + w > sw) {
|
|
||||||
partial_w = sw - a->surface.parentx;
|
|
||||||
} else partial_w = w;
|
|
||||||
|
|
||||||
if (a->surface.parenty + h > sh) {
|
|
||||||
partial_h = sh - a->surface.parenty;
|
|
||||||
} else partial_h = h;
|
|
||||||
|
|
||||||
for (i = 0; i < partial_h; i++, source += sw, dest += w) {
|
|
||||||
memcpy(dest, source, partial_w * sizeof(RrPixel32));
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
RrRender(a, w, h);
|
RrRender(a, w, h);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -1472,10 +1472,11 @@ static void parse_style(gchar *tex, RrSurfaceColorType *grad,
|
||||||
} else {
|
} else {
|
||||||
*grad = RR_SURFACE_SOLID;
|
*grad = RR_SURFACE_SOLID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strstr(tex, "sunken") != NULL)
|
if (strstr(tex, "sunken") != NULL)
|
||||||
*relief = RR_RELIEF_SUNKEN;
|
*relief = RR_RELIEF_SUNKEN;
|
||||||
else if (strstr(tex, "flat") != NULL)
|
else if ((strstr(tex, "flat") != NULL) || (*grad == RR_SURFACE_PARENTREL))
|
||||||
*relief = RR_RELIEF_FLAT;
|
*relief = RR_RELIEF_FLAT;
|
||||||
else
|
else
|
||||||
*relief = RR_RELIEF_RAISED;
|
*relief = RR_RELIEF_RAISED;
|
||||||
|
@ -1495,7 +1496,6 @@ static void parse_style(gchar *tex, RrSurfaceColorType *grad,
|
||||||
*interlaced = TRUE;
|
*interlaced = TRUE;
|
||||||
else
|
else
|
||||||
*interlaced = FALSE;
|
*interlaced = FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlNodePtr find_node(xmlNodePtr n, const gchar *names[])
|
static xmlNodePtr find_node(xmlNodePtr n, const gchar *names[])
|
||||||
|
|
Loading…
Reference in a new issue