#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) &&
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;
#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
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) {
case RGBA:
image_draw(l->surface.data.planar.pixel_data,
&l->texture[i].data.rgba,
- &tarea);
+ &tarea, &l->area);
break;
}
}