]> Dogcows Code - chaz/openbox/commitdiff
patch from thorsten vollmer to fix bug #2506, interlaces and bevels not drawing correctly
authorMikael Magnusson <mikachu@comhem.se>
Sun, 20 Aug 2006 07:15:18 +0000 (07:15 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Sun, 20 Aug 2006 07:15:18 +0000 (07:15 +0000)
render/gradient.c
render/render.c

index 7b26e54c820df1515042cfea5174087f5b1d0d3f..f4c9c957ba7a9d3a341a702bfb9b2f280cc6663b 100644 (file)
@@ -191,8 +191,9 @@ static void create_bevel_colors(RrAppearance *l)
 
 static void gradient_solid(RrAppearance *l, gint w, gint h) 
 {
 
 static void gradient_solid(RrAppearance *l, gint w, gint h) 
 {
+    gint i;
     RrPixel32 pix;
     RrPixel32 pix;
-    gint i, a, b;
+    RrPixel32 *data = l->surface.pixel_data;
     RrSurface *sp = &l->surface;
     gint left = 0, top = 0, right = w - 1, bottom = h - 1;
 
     RrSurface *sp = &l->surface;
     gint left = 0, top = 0, right = w - 1, bottom = h - 1;
 
@@ -200,20 +201,15 @@ static void gradient_solid(RrAppearance *l, gint w, gint h)
         + (sp->primary->g << RrDefaultGreenOffset)
         + (sp->primary->b << RrDefaultBlueOffset);
 
         + (sp->primary->g << RrDefaultGreenOffset)
         + (sp->primary->b << RrDefaultBlueOffset);
 
-    for (a = 0; a < w; a++)
-        for (b = 0; b < h; b++)
-            sp->pixel_data[a + b * w] = pix;
+    for (i = 0; i < w * h; i++)
+        *data++ = pix;
+
+    if (sp->interlaced)
+        return;
 
     XFillRectangle(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->primary),
                    0, 0, w, h);
 
 
     XFillRectangle(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->primary),
                    0, 0, w, h);
 
-    if (sp->interlaced) {
-        for (i = 0; i < h; i += 2)
-            XDrawLine(RrDisplay(l->inst), l->pixmap,
-                      RrColorGC(sp->interlace_color),
-                      0, i, w, i);
-    }
-
     switch (sp->relief) {
     case RR_RELIEF_RAISED:
         if (!sp->bevel_dark)
     switch (sp->relief) {
     case RR_RELIEF_RAISED:
         if (!sp->bevel_dark)
@@ -233,14 +229,14 @@ static void gradient_solid(RrAppearance *l, gint w, gint h)
             break;
         case RR_BEVEL_2:
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
             break;
         case RR_BEVEL_2:
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
-                      left + 1, bottom - 2, right - 2, bottom - 2);
+                      left + 2, bottom - 1, right - 2, bottom - 1);
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
-                      right - 2, bottom - 2, right - 2, top + 1);
+                      right - 1, bottom - 1, right - 1, top + 1);
 
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
 
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
-                      left + 1, top + 1, right - 2, top + 1);
+                      left + 2, top + 1, right - 2, top + 1);
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
-                      left + 1, bottom - 2, left + 1, top + 1);
+                      left + 1, bottom - 1, left + 1, top + 1);
             break;
         default:
             g_assert_not_reached(); /* unhandled BevelType */
             break;
         default:
             g_assert_not_reached(); /* unhandled BevelType */
@@ -264,15 +260,14 @@ static void gradient_solid(RrAppearance *l, gint w, gint h)
             break;
         case RR_BEVEL_2:
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
             break;
         case RR_BEVEL_2:
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
-                      left + 1, bottom - 2, right - 2, bottom - 2);
+                      left + 2, bottom - 1, right - 2, bottom - 1);
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
             XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
-                      right - 2, bottom - 2, right - 2, top + 1);
-      
+                      right - 1, bottom - 1, right - 1, top + 1);
+
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
-                      left + 1, top + 1, right - 2, top + 1);
+                      left + 2, top + 1, right - 2, top + 1);
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
             XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
-                      left + 1, bottom - 2, left + 1, top + 1);
-
+                      left + 1, bottom - 1, left + 1, top + 1);
             break;
         default:
             g_assert_not_reached(); /* unhandled BevelType */
             break;
         default:
             g_assert_not_reached(); /* unhandled BevelType */
index 5b6cb95feddddb43b0c5f0b0957b9028c6b1f238..b2c25ccf036eddb26130652b17cc7908778fa7a4 100644 (file)
@@ -113,7 +113,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
         case RR_TEXTURE_TEXT:
             if (!transferred) {
                 transferred = 1;
         case RR_TEXTURE_TEXT:
             if (!transferred) {
                 transferred = 1;
-                if (a->surface.grad != RR_SURFACE_SOLID)
+                if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced))
                     pixel_data_to_pixmap(a, 0, 0, w, h);
             }
             if (a->xftdraw == NULL) {
                     pixel_data_to_pixmap(a, 0, 0, w, h);
             }
             if (a->xftdraw == NULL) {
@@ -126,7 +126,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
         case RR_TEXTURE_LINE_ART:
             if (!transferred) {
                 transferred = 1;
         case RR_TEXTURE_LINE_ART:
             if (!transferred) {
                 transferred = 1;
-                if (a->surface.grad != RR_SURFACE_SOLID)
+                if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced))
                     pixel_data_to_pixmap(a, 0, 0, w, h);
             }
             XDrawLine(RrDisplay(a->inst), a->pixmap,
                     pixel_data_to_pixmap(a, 0, 0, w, h);
             }
             XDrawLine(RrDisplay(a->inst), a->pixmap,
@@ -139,7 +139,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
         case RR_TEXTURE_MASK:
             if (!transferred) {
                 transferred = 1;
         case RR_TEXTURE_MASK:
             if (!transferred) {
                 transferred = 1;
-                if (a->surface.grad != RR_SURFACE_SOLID)
+                if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced))
                     pixel_data_to_pixmap(a, 0, 0, w, h);
             }
             RrPixmapMaskDraw(a->pixmap, &a->texture[i].data.mask, &tarea);
                     pixel_data_to_pixmap(a, 0, 0, w, h);
             }
             RrPixmapMaskDraw(a->pixmap, &a->texture[i].data.mask, &tarea);
@@ -156,7 +156,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
 
     if (!transferred) {
         transferred = 1;
 
     if (!transferred) {
         transferred = 1;
-        if (a->surface.grad != RR_SURFACE_SOLID)
+        if ((a->surface.grad != RR_SURFACE_SOLID) || (a->surface.interlaced))
             pixel_data_to_pixmap(a, 0, 0, w, h);
     }
 
             pixel_data_to_pixmap(a, 0, 0, w, h);
     }
 
This page took 0.031357 seconds and 4 git commands to generate.