diff options
Diffstat (limited to 'generic/Rectangle.c')
-rw-r--r-- | generic/Rectangle.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/generic/Rectangle.c b/generic/Rectangle.c index bcb7db5..ea0bb7b 100644 --- a/generic/Rectangle.c +++ b/generic/Rectangle.c @@ -356,49 +356,39 @@ ComputeCoordinates(ZnItem item, delta = ABS(delta); aligned |= delta < X_PRECISION_LIMIT; ASSIGN(rect->flags, ALIGNED_BIT, aligned); - + #ifdef GL /* * Compute the gradient geometry */ if (!ZnGradientFlat(rect->fill_color)) { ZnPoly shape; - - if (rect->fill_color->type == ZN_AXIAL_GRADIENT) { - int angle = rect->fill_color->g.angle; - + + if (rect->fill_color->type == ZN_AXIAL_GRADIENT) { + int angle = rect->fill_color->angle; + if ((angle != 0) && (angle != 90) && (angle != 180) && (angle != 270)) { if (!rect->grad_geo) { rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint)); } ZnPolyContour1(&shape, p, 4, False); - ZnComputeAxialGradient(wi, &shape, (ZnReal) angle, rect->grad_geo); + ZnComputeGradient(rect->fill_color, wi, &shape, rect->grad_geo); } else { goto free_ggeo; } - } - else if (rect->fill_color->type == ZN_RADIAL_GRADIENT) { - ZnPoint pp[4]; + else { if (!rect->grad_geo) { rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint)); } - pp[0] = rect->coords[0]; - pp[2] = rect->coords[1]; - pp[1].x = pp[2].x; - pp[1].y = pp[0].y; - pp[3].x = pp[0].x; - pp[3].y = pp[2].y; - ZnPolyContour1(&shape, pp, 4, False); - ZnComputeRadialGradient(wi, &shape, False, &rect->fill_color->g.p, rect->grad_geo); - } - else if (rect->fill_color->type == ZN_PATH_GRADIENT) { - if (!rect->grad_geo) { - rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint)); + if (rect->fill_color->type == ZN_PATH_GRADIENT) { + ZnPolyContour1(&shape, rect->coords, 2, False); } - ZnPolyContour1(&shape, rect->coords, 2, False); - ZnComputePathGradient(wi, &shape, &rect->fill_color->g.p, rect->grad_geo); + else { + ZnPolyContour1(&shape, p, 4, False); + } + ZnComputeGradient(rect->fill_color, wi, &shape, rect->grad_geo); } } else { @@ -497,7 +487,7 @@ Draw(ZnItem item) * Fill if requested. */ if (ISSET(rect->flags, FILLED_BIT)) { - values.foreground = ZnPixel(ZnGetGradientColor(rect->fill_color, 0.0, NULL)); + values.foreground = ZnGetGradientPixel(rect->fill_color, 0.0); if (rect->tile != ZnUnspecifiedImage) { if (!ZnImageIsBitmap(rect->tile)) { /* Fill tiled */ values.fill_style = FillTiled; @@ -563,7 +553,7 @@ Draw(ZnItem item) else { ZnSetLineStyle(wi, rect->line_style); gc_mask = GCFillStyle|GCLineWidth|GCForeground|GCJoinStyle; - values.foreground = ZnPixel(ZnGetGradientColor(rect->line_color, 0.0, NULL)); + values.foreground = ZnGetGradientPixel(rect->line_color, 0.0); values.line_width = (rect->line_width == 1) ? 0 : (int) rect->line_width; values.join_style = JoinMiter; if (ISCLEAR(rect->flags, ALIGNED_BIT)) { @@ -621,8 +611,6 @@ Render(ZnItem item) ZnWInfo *wi = item->wi; RectangleItem rect = (RectangleItem) item; int i; - XColor *color; - unsigned short alpha; #ifdef GL_LIST if (!item->gl_list) { @@ -642,11 +630,18 @@ Render(ZnItem item) fast ? rect->dev : rect->grad_geo, &poly); } else if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled/patterned */ - ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB, - rect, (ZnPoint *) &item->item_bounding_box); + if (ISSET(rect->flags, ALIGNED_BIT)) { + ZnRenderTile(wi, rect->tile, rect->fill_color, NULL, NULL, + (ZnPoint *) &item->item_bounding_box); + } + else { + ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB, + rect, (ZnPoint *) &item->item_bounding_box); + } } else { - color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha); + unsigned short alpha; + XColor *color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha); alpha = ZnComposeAlpha(alpha, wi->alpha); glColor4us(color->red, color->green, color->blue, alpha); RectRenderCB(rect); |