patch from thorsten vollmer to fix bug #2506, interlaces and bevels not drawing correctly

This commit is contained in:
Mikael Magnusson 2006-08-20 07:15:18 +00:00
parent d77c8f62f2
commit e8c19d0c99
2 changed files with 21 additions and 26 deletions

View 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; RrSurface *sp = &l->surface;
gint left = 0, top = 0, right = w - 1, bottom = h - 1; 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->g << RrDefaultGreenOffset)
+ (sp->primary->b << RrDefaultBlueOffset); + (sp->primary->b << RrDefaultBlueOffset);
for (a = 0; a < w; a++) for (i = 0; i < w * h; i++)
for (b = 0; b < h; b++) *data++ = pix;
sp->pixel_data[a + b * w] = pix;
if (sp->interlaced)
return;
XFillRectangle(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->primary), XFillRectangle(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->primary),
0, 0, w, h); 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) { switch (sp->relief) {
case RR_RELIEF_RAISED: case RR_RELIEF_RAISED:
if (!sp->bevel_dark) if (!sp->bevel_dark)
@ -233,14 +229,14 @@ static void gradient_solid(RrAppearance *l, gint w, gint h)
break; break;
case RR_BEVEL_2: case RR_BEVEL_2:
XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark), 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; break;
default: default:
g_assert_not_reached(); /* unhandled BevelType */ g_assert_not_reached(); /* unhandled BevelType */
@ -264,15 +260,14 @@ static void gradient_solid(RrAppearance *l, gint w, gint h)
break; break;
case RR_BEVEL_2: case RR_BEVEL_2:
XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light), 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),
left + 1, top + 1, right - 2, top + 1);
XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
left + 1, bottom - 2, left + 1, top + 1);
XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
left + 2, top + 1, right - 2, top + 1);
XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
left + 1, bottom - 1, left + 1, top + 1);
break; break;
default: default:
g_assert_not_reached(); /* unhandled BevelType */ g_assert_not_reached(); /* unhandled BevelType */

View file

@ -113,7 +113,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
case RR_TEXTURE_TEXT: case RR_TEXTURE_TEXT:
if (!transferred) { if (!transferred) {
transferred = 1; 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);
} }
if (a->xftdraw == NULL) { if (a->xftdraw == NULL) {
@ -126,7 +126,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
case RR_TEXTURE_LINE_ART: case RR_TEXTURE_LINE_ART:
if (!transferred) { if (!transferred) {
transferred = 1; 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);
} }
XDrawLine(RrDisplay(a->inst), a->pixmap, XDrawLine(RrDisplay(a->inst), a->pixmap,
@ -139,7 +139,7 @@ void RrPaint(RrAppearance *a, Window win, gint w, gint h)
case RR_TEXTURE_MASK: case RR_TEXTURE_MASK:
if (!transferred) { if (!transferred) {
transferred = 1; 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);
} }
RrPixmapMaskDraw(a->pixmap, &a->texture[i].data.mask, &tarea); 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) { if (!transferred) {
transferred = 1; 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);
} }