X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Frender.c;h=8623455f6c06091e6c55335ca48531eb393b8f5b;hb=9cb80fc994c09ee62f99f46244b840ce25fd40f4;hp=2755e6678056f9fd60a9eaa3231715ed35a9cc84;hpb=66d6e1120ec4e66433ecec673258856def164070;p=chaz%2Fopenbox diff --git a/render/render.c b/render/render.c index 2755e667..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; @@ -369,7 +383,7 @@ gint RrMinWidth(RrAppearance *a) a->texture[i].data.text.string, a->texture[i].data.text.shadow_offset_x, a->texture[i].data.text.shadow_offset_y); - w = MAX(w, m->width + 4); + w = MAX(w, m->width); g_free(m); break; case RR_TEXTURE_RGBA: