X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Frender.c;h=8623455f6c06091e6c55335ca48531eb393b8f5b;hb=959fff5e1cda35b0a1569ef323aab3129db3cb1f;hp=d34ddccb1df921cb2704ee7e297a0772e031749a;hpb=82b2f0aa7a1723632e8d3cf7dc772e4bdb66868a;p=chaz%2Fopenbox diff --git a/render/render.c b/render/render.c index d34ddccb..8623455f 100644 --- a/render/render.c +++ b/render/render.c @@ -18,9 +18,6 @@ See the COPYING file for a copy of the GNU General Public License. */ -#include -#include - #include "render.h" #include "gradient.h" #include "font.h" @@ -30,6 +27,9 @@ #include "theme.h" #include +#include +#include +#include #ifdef HAVE_STDLIB_H # include @@ -40,9 +40,9 @@ static void pixel_data_to_pixmap(RrAppearance *l, Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) { - gint i, transferred = 0, sw, sh, partial_w, partial_h; + gint i, transferred = 0, sw, sh, partial_w, partial_h, force_transfer = 0; RrPixel32 *source, *dest; - Pixmap oldp; + Pixmap oldp = None; RrRect tarea; /* area in which to draw textures */ gboolean resized; @@ -77,8 +77,10 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) RrVisual(a->inst), RrColormap(a->inst)); g_assert(a->xftdraw != NULL); - g_free(a->surface.pixel_data); - a->surface.pixel_data = g_new(RrPixel32, w * h); + if (resized) { + g_free(a->surface.pixel_data); + a->surface.pixel_data = g_new(RrPixel32, w * h); + } if (a->surface.grad == RR_SURFACE_PARENTREL) { g_assert (a->surface.parent); @@ -158,14 +160,18 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) &a->texture[i].data.rgba, a->w, a->h, &tarea); + force_transfer = 1; break; } } if (!transferred) { transferred = 1; - if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced)) + if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced) || + force_transfer) + { pixel_data_to_pixmap(a, 0, 0, w, h); + } } return oldp; @@ -194,6 +200,14 @@ RrAppearance *RrAppearanceNew(const RrInstance *inst, gint numtex) return out; } +void RrAppearanceAddTextures(RrAppearance *a, gint numtex) +{ + g_assert(a->textures == 0); + + a->textures = numtex; + if (numtex) a->texture = g_new0(RrTexture, numtex); +} + RrAppearance *RrAppearanceCopy(RrAppearance *orig) { RrSurface *spo, *spc;