summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-27 17:08:40 +0000
committerDana Jansens <danakj@orodu.net>2003-04-27 17:08:40 +0000
commita081582e3a4c27aede31c170337aed6b5a5309cc (patch)
treef3e87d5ec7330dd1740eebf0a0cbdee8be947fb4 /render
parent02c7f2e8afbfe5ebc589415a87a2ac156c9ef5af (diff)
fix window icon rendering, was using incorrect size.
Diffstat (limited to 'render')
-rw-r--r--render/image.c12
-rw-r--r--render/image.h3
-rw-r--r--render/render.c26
3 files changed, 25 insertions, 16 deletions
diff --git a/render/image.c b/render/image.c
index 5bd3285b..bdc51eed 100644
--- a/render/image.c
+++ b/render/image.c
@@ -2,14 +2,20 @@
#include "../kernel/geom.h"
#include "image.h"
-void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position)
+void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position,
+ Rect *surarea)
{
unsigned long *draw = rgba->data;
int c, sfw, sfh;
- unsigned int i, e, bgi;
+ unsigned int i, e;
sfw = position->width;
sfh = position->height;
+ /* it would be nice if this worked, but this function is well broken in these
+ cercumstances. */
+ g_assert(position->width == surarea->width &&
+ position->height == surarea->height);
+
g_assert(rgba->data != NULL);
if ((rgba->width != sfw || rgba->height != sfh) &&
@@ -42,7 +48,7 @@ void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position)
draw = rgba->cache;
/* apply the alpha channel */
- for (i = 0, c = 0, e = sfw*sfh; i < e; ++i, ++bgi) {
+ for (i = 0, c = 0, e = sfw*sfh; i < e; ++i) {
unsigned char alpha = draw[i] >> 24;
unsigned char r = draw[i] >> 16;
unsigned char g = draw[i] >> 8;
diff --git a/render/image.h b/render/image.h
index b29a7304..84f61d77 100644
--- a/render/image.h
+++ b/render/image.h
@@ -4,6 +4,7 @@
#include "render.h"
#include "../kernel/geom.h"
-void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position);
+void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position,
+ Rect *surarea);
#endif
diff --git a/render/render.c b/render/render.c
index cd4607bb..a1412741 100644
--- a/render/render.c
+++ b/render/render.c
@@ -233,20 +233,22 @@ void x_paint(Window win, Appearance *l)
for (i = 0; i < l->textures; i++) {
tarea = l->texture[i].position;
- if (l->surface.data.planar.relief != Flat) {
- switch (l->surface.data.planar.bevel) {
- case Bevel1:
+ if (l->surface.data.planar.grad != Background_ParentRelative) {
+ if (l->surface.data.planar.relief != Flat) {
+ switch (l->surface.data.planar.bevel) {
+ case Bevel1:
+ tarea.x += 1; tarea.y += 1;
+ tarea.width -= 2; tarea.height -= 2;
+ break;
+ case Bevel2:
+ tarea.x += 2; tarea.y += 2;
+ tarea.width -= 4; tarea.height -= 4;
+ break;
+ }
+ } else if (l->surface.data.planar.border) {
tarea.x += 1; tarea.y += 1;
tarea.width -= 2; tarea.height -= 2;
- break;
- case Bevel2:
- tarea.x += 2; tarea.y += 2;
- tarea.width -= 4; tarea.height -= 4;
- break;
}
- } else if (l->surface.data.planar.border) {
- tarea.x += 1; tarea.y += 1;
- tarea.width -= 2; tarea.height -= 2;
}
switch (l->texture[i].type) {
@@ -279,7 +281,7 @@ void x_paint(Window win, Appearance *l)
case RGBA:
image_draw(l->surface.data.planar.pixel_data,
&l->texture[i].data.rgba,
- &tarea);
+ &tarea, &l->area);
break;
}
}