X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Frender.c;h=8cc443546a969366100b4d6992b23f3600619bb1;hb=07a52aeaff0d8f429d9a740f49a85f22d51cf597;hp=7129974c56d0b32dcbd8c705fb118a65130ba7de;hpb=0a69cfc6d2cf672634e95d5eb2015434dd924abc;p=chaz%2Fopenbox diff --git a/render/render.c b/render/render.c index 7129974c..8cc44354 100644 --- a/render/render.c +++ b/render/render.c @@ -6,6 +6,7 @@ #include "font.h" #include "mask.h" #include "color.h" +#include "image.h" #include "../kernel/openbox.h" int render_depth; @@ -92,7 +93,7 @@ void x_paint(Window win, Appearance *l, int x, int y, int w, int h) XImage *im = NULL; Pixmap oldp; - if (w <= 0 || h <= 0) return; + if (w <= 0 || h <= 0 || x+w <= 0 || y+h <= 0) return; g_assert(l->surface.type == Surface_Planar); @@ -106,8 +107,7 @@ void x_paint(Window win, Appearance *l, int x, int y, int w, int h) render_colormap); g_assert(l->xftdraw != NULL); - if (l->surface.data.planar.pixel_data != NULL) - g_free(l->surface.data.planar.pixel_data); + g_free(l->surface.data.planar.pixel_data); l->surface.data.planar.pixel_data = g_new(pixel32, w * h); if (l->surface.data.planar.grad == Background_Solid) @@ -137,12 +137,19 @@ void x_paint(Window win, Appearance *l, int x, int y, int w, int h) l->xftdraw = XftDrawCreate(ob_display, l->pixmap, render_visual, render_colormap); } - font_draw(l->xftdraw, &l->texture[i].data.text, x, y, w, h); + font_draw(l->xftdraw, &l->texture[i].data.text, + &l->texture[i].position); break; case Bitmask: 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, w, h); + mask_draw(l->pixmap, &l->texture[i].data.mask, + &l->texture[i].position); + break; + case RGBA: + image_draw(l->surface.data.planar.pixel_data, + &l->texture[i].data.rgba, + &l->texture[i].position); break; } } @@ -171,7 +178,7 @@ Appearance *appearance_new(SurfaceType type, int numtex) out->surface.type = type; out->textures = numtex; out->xftdraw = NULL; - if (numtex) out->texture = g_new(Texture, numtex); + if (numtex) out->texture = g_new0(Texture, numtex); else out->texture = NULL; out->pixmap = None;