#include "image.h"
#include "kernel/openbox.h"
-#ifndef HAVE_STDLIB_H
+#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
int y = l->area.y;
int w = l->area.width;
int h = l->area.height;
+ Rect tarea; /* area in which to draw textures */
if (w <= 0 || h <= 0 || x+w <= 0 || y+h <= 0) return;
else gradient_render(&l->surface, w, h);
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:
+ 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 Text:
if (!transferred) {
render_visual, render_colormap);
}
font_draw(l->xftdraw, &l->texture[i].data.text,
- &l->texture[i].position);
+ &tarea);
break;
case Bitmask:
if (!transferred) {
if (l->texture[i].data.mask.color->gc == None)
color_allocate_gc(l->texture[i].data.mask.color);
mask_draw(l->pixmap, &l->texture[i].data.mask,
- &l->texture[i].position);
+ &tarea);
break;
case RGBA:
image_draw(l->surface.data.planar.pixel_data,
&l->texture[i].data.rgba,
- &l->texture[i].position);
+ &tarea);
break;
}
}
void appearance_free(Appearance *a)
{
- PlanarSurface *p;
- if (a->pixmap != None) XFreePixmap(ob_display, a->pixmap);
- if (a->xftdraw != NULL) XftDrawDestroy(a->xftdraw);
- if (a->textures)
- g_free(a->texture);
- if (a->surface.type == Surface_Planar) {
- p = &a->surface.data.planar;
- if (p->primary != NULL) color_free(p->primary);
- if (p->secondary != NULL) color_free(p->secondary);
- if (p->border_color != NULL) color_free(p->border_color);
- if (p->pixel_data != NULL) g_free(p->pixel_data);
+ if (a) {
+ PlanarSurface *p;
+ if (a->pixmap != None) XFreePixmap(ob_display, a->pixmap);
+ if (a->xftdraw != NULL) XftDrawDestroy(a->xftdraw);
+ if (a->textures)
+ g_free(a->texture);
+ if (a->surface.type == Surface_Planar) {
+ p = &a->surface.data.planar;
+ if (p->primary != NULL) color_free(p->primary);
+ if (p->secondary != NULL) color_free(p->secondary);
+ if (p->border_color != NULL) color_free(p->border_color);
+ if (p->pixel_data != NULL) g_free(p->pixel_data);
+ }
+ g_free(a);
}
- g_free(a);
}
as reduce_depth just sets im->data = data and returns
*/
scratch = malloc(im->width * im->height * sizeof(pixel32));
- im->data = scratch;
+ im->data = (char*) scratch;
reduce_depth(in, im);
XPutImage(ob_display, out, DefaultGC(ob_display, ob_screen),
im, 0, 0, x, y, w, h);
switch (l->surface.type) {
case Surface_Planar:
- if (l->surface.data.planar.border ||
- l->surface.data.planar.bevel == Bevel1)
+ if (l->surface.data.planar.relief != Flat) {
+ switch (l->surface.data.planar.bevel) {
+ case Bevel1:
+ SIZE_SET(*s, 2, 2);
+ break;
+ case Bevel2:
+ SIZE_SET(*s, 4, 4);
+ break;
+ }
+ } else if (l->surface.data.planar.border)
SIZE_SET(*s, 2, 2);
- else if (l->surface.data.planar.bevel == Bevel2)
- SIZE_SET(*s, 4, 4);
for (i = 0; i < l->textures; ++i)
switch (l->texture[i].type) {
}
break;
}
- return s;
}