]> Dogcows Code - chaz/openbox/blobdiff - render/render.c
remove debug prints
[chaz/openbox] / render / render.c
index 7be3993e1cda2e6188a88e60ef2280d2fce2c911..8bde9c6f0416dc10247a9cd36586087666b08d19 100644 (file)
@@ -15,8 +15,8 @@
 #  include <stdlib.h>
 #endif
 
-static void RrPixel32_to_pixmap(RrAppearance *l,
-                                gint x, gint y, gint w, gint h);
+static void pixel_data_to_pixmap(RrAppearance *l,
+                                 gint x, gint y, gint w, gint h);
 
 void RrPaint(RrAppearance *l, Window win, gint w, gint h)
 {
@@ -89,7 +89,7 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h)
             if (!transferred) {
                 transferred = 1;
                 if (l->surface.grad != RR_SURFACE_SOLID)
-                    RrPixel32_to_pixmap(l, 0, 0, w, h);
+                    pixel_data_to_pixmap(l, 0, 0, w, h);
             }
             if (l->xftdraw == NULL) {
                 l->xftdraw = XftDrawCreate(RrDisplay(l->inst), l->pixmap, 
@@ -97,18 +97,30 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h)
                                            RrColormap(l->inst));
             }
             RrFontDraw(l->xftdraw, &l->texture[i].data.text, &tarea);
-        break;
+            break;
+        case RR_TEXTURE_LINE_ART:
+            if (!transferred) {
+                transferred = 1;
+                if (l->surface.grad != RR_SURFACE_SOLID)
+                    pixel_data_to_pixmap(l, 0, 0, w, h);
+            }
+            XDrawLine(RrDisplay(l->inst), l->pixmap,
+                      RrColorGC(l->texture[i].data.lineart.color),
+                      l->texture[i].data.lineart.x1,
+                      l->texture[i].data.lineart.y1,
+                      l->texture[i].data.lineart.x2,
+                      l->texture[i].data.lineart.y2);
+            break;
         case RR_TEXTURE_MASK:
             if (!transferred) {
                 transferred = 1;
                 if (l->surface.grad != RR_SURFACE_SOLID)
-                    RrPixel32_to_pixmap(l, 0, 0, w, h);
+                    pixel_data_to_pixmap(l, 0, 0, w, h);
             }
-            if (l->texture[i].data.mask.color->gc == None)
-                RrColorAllocateGC(l->texture[i].data.mask.color);
             RrPixmapMaskDraw(l->pixmap, &l->texture[i].data.mask, &tarea);
-        break;
+            break;
         case RR_TEXTURE_RGBA:
+            g_assert(!transferred);
             RrImageDraw(l->surface.pixel_data,
                         &l->texture[i].data.rgba, &tarea);
         break;
@@ -118,10 +130,9 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h)
     if (!transferred) {
         transferred = 1;
         if (l->surface.grad != RR_SURFACE_SOLID)
-            RrPixel32_to_pixmap(l, 0, 0, w, h);
+            pixel_data_to_pixmap(l, 0, 0, w, h);
     }
 
-
     XSetWindowBackgroundPixmap(RrDisplay(l->inst), win, l->pixmap);
     XClearWindow(RrDisplay(l->inst), win);
     if (oldp) XFreePixmap(RrDisplay(l->inst), oldp);
@@ -143,6 +154,7 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig)
 {
     RrSurface *spo, *spc;
     RrAppearance *copy = g_new(RrAppearance, 1);
+    gint i;
 
     copy->inst = orig->inst;
 
@@ -172,6 +184,13 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig)
                                        spo->border_color->b);
     else spc->border_color = NULL;
 
+    if (spo->interlace_color != NULL)
+        spc->interlace_color = RrColorNew(copy->inst,
+                                       spo->interlace_color->r,
+                                       spo->interlace_color->g,
+                                       spo->interlace_color->b);
+    else spc->interlace_color = NULL;
+
     if (spo->bevel_dark != NULL)
         spc->bevel_dark = RrColorNew(copy->inst,
                                      spo->bevel_dark->r,
@@ -195,6 +214,11 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig)
     copy->textures = orig->textures;
     copy->texture = g_memdup(orig->texture,
                              orig->textures * sizeof(RrTexture));
+    for (i = 0; i < copy->textures; ++i)
+        if (copy->texture[i].type == RR_TEXTURE_RGBA) {
+            g_free(copy->texture[i].data.rgba.cache);
+            copy->texture[i].data.rgba.cache = NULL;
+        }
     copy->pixmap = None;
     copy->xftdraw = NULL;
     copy->w = copy->h = 0;
@@ -203,16 +227,24 @@ RrAppearance *RrAppearanceCopy(RrAppearance *orig)
 
 void RrAppearanceFree(RrAppearance *a)
 {
+    gint i;
+
     if (a) {
         RrSurface *p;
         if (a->pixmap != None) XFreePixmap(RrDisplay(a->inst), a->pixmap);
         if (a->xftdraw != NULL) XftDrawDestroy(a->xftdraw);
+        for (i = 0; i < a->textures; ++i)
+            if (a->texture[i].type == RR_TEXTURE_RGBA) {
+                g_free(a->texture[i].data.rgba.cache);
+                a->texture[i].data.rgba.cache = NULL;
+            }
         if (a->textures)
             g_free(a->texture);
         p = &a->surface;
         RrColorFree(p->primary);
         RrColorFree(p->secondary);
         RrColorFree(p->border_color);
+        RrColorFree(p->interlace_color);
         RrColorFree(p->bevel_dark);
         RrColorFree(p->bevel_light);
         g_free(p->pixel_data);
@@ -222,7 +254,8 @@ void RrAppearanceFree(RrAppearance *a)
 }
 
 
-static void RrPixel32_to_pixmap(RrAppearance *l, gint x, gint y, gint w, gint h)
+static void pixel_data_to_pixmap(RrAppearance *l,
+                                 gint x, gint y, gint w, gint h)
 {
     RrPixel32 *in, *scratch;
     Pixmap out;
@@ -274,6 +307,12 @@ void RrMinsize(RrAppearance *l, gint *w, gint *h)
             *w += MAX(*w, l->texture[i].data.rgba.width);
             *h += MAX(*h, l->texture[i].data.rgba.height);
             break;
+        case RR_TEXTURE_LINE_ART:
+            *w += MAX(*w, MAX(l->texture[i].data.lineart.x1,
+                              l->texture[i].data.lineart.x2));
+            *h += MAX(*h, MAX(l->texture[i].data.lineart.y1,
+                              l->texture[i].data.lineart.y2));
+            break;
         }
     }
 
This page took 0.024707 seconds and 4 git commands to generate.