summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-06-05 18:01:10 +0000
committerDana Jansens <danakj@orodu.net>2007-06-05 18:01:10 +0000
commit4548d40c0d04f17ffd188666a1e2655566784c50 (patch)
tree6139932a293d2e2fff468de3da4c506a555ba4c4 /render
parentcea865698391bba733d763686f20d54032a940c8 (diff)
combine the parent and child textures in fun ways when a parentrelative texture with a bevel is placed right overtop of another texture with a bevel
Diffstat (limited to 'render')
-rw-r--r--render/gradient.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/render/gradient.c b/render/gradient.c
index 94d04d25..3d81d5d6 100644
--- a/render/gradient.c
+++ b/render/gradient.c
@@ -205,20 +205,41 @@ static void gradient_parentrelative(RrAppearance *a, gint w, gint h)
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;
+ /* This is a little hack. When a texture is parentrelative, and the same
+ area as the parent, and has a bevel, it will draw its bevel on top
+ of the parent's, amplifying it. So instead, rerender the child with
+ the parent's settings, but the child's bevel and interlace */
+ if (a->surface.relief != RR_RELIEF_FLAT &&
+ !a->surface.parentx && !a->surface.parenty &&
+ sw == w && sh == h)
+ {
+ RrSurface old = a->surface;
+ a->surface = a->surface.parent->surface;
+ a->surface.relief = old.relief;
+ a->surface.bevel = old.bevel;
+ a->surface.pixel_data = old.pixel_data;
+ if (old.interlaced) {
+ a->surface.interlaced = TRUE;
+ a->surface.interlace_color = old.interlace_color;
+ }
+ RrRender(a, w, h);
+ a->surface = old;
+ } else {
+ 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.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;
+ 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));
+ for (i = 0; i < partial_h; i++, source += sw, dest += w) {
+ memcpy(dest, source, partial_w * sizeof(RrPixel32));
+ }
}
}