aboutsummaryrefslogtreecommitdiff
path: root/generic/Rectangle.c
diff options
context:
space:
mode:
authorlecoanet2003-10-02 12:46:10 +0000
committerlecoanet2003-10-02 12:46:10 +0000
commit9eab981c4504806cd47bcc44ed40cece276434ff (patch)
treedbcbc72779ee2259a0ae6379fdc9dada6f5e17e4 /generic/Rectangle.c
parent59e069eea95a33dbb1a369a715233243e2cbf8fa (diff)
downloadtkzinc-9eab981c4504806cd47bcc44ed40cece276434ff.zip
tkzinc-9eab981c4504806cd47bcc44ed40cece276434ff.tar.gz
tkzinc-9eab981c4504806cd47bcc44ed40cece276434ff.tar.bz2
tkzinc-9eab981c4504806cd47bcc44ed40cece276434ff.tar.xz
Tiles and patterns are now updated if their images change.
Corrected a bug in rectangle tiling (textures) under openGL when optimizing for aligned rectangles.
Diffstat (limited to 'generic/Rectangle.c')
-rw-r--r--generic/Rectangle.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/generic/Rectangle.c b/generic/Rectangle.c
index ea0bb7b..fd6e78b 100644
--- a/generic/Rectangle.c
+++ b/generic/Rectangle.c
@@ -197,10 +197,10 @@ Clone(ZnItem item)
rect->gradient = ZnGetGradientByValue(rect->gradient);
}
if (rect->tile != ZnUnspecifiedImage) {
- rect->tile = ZnGetImageByValue(rect->tile);
+ rect->tile = ZnGetImageByValue(rect->tile, ZnUpdateItemImage, item);
}
if (rect->line_pattern != ZnUnspecifiedImage) {
- rect->line_pattern = ZnGetImageByValue(rect->line_pattern);
+ rect->line_pattern = ZnGetImageByValue(rect->line_pattern, NULL, NULL);
}
rect->line_color = ZnGetGradientByValue(rect->line_color);
rect->fill_color = ZnGetGradientByValue(rect->fill_color);
@@ -221,14 +221,14 @@ Destroy(ZnItem item)
RectangleItem rect = (RectangleItem) item;
if (rect->tile != ZnUnspecifiedImage) {
- ZnFreeImage(rect->tile);
+ ZnFreeImage(rect->tile, ZnUpdateItemImage, item);
rect->tile = ZnUnspecifiedImage;
}
if (rect->gradient) {
ZnFreeGradient(rect->gradient);
}
if (rect->line_pattern != ZnUnspecifiedImage) {
- ZnFreeImage(rect->line_pattern);
+ ZnFreeImage(rect->line_pattern, NULL, NULL);
rect->line_pattern = ZnUnspecifiedImage;
}
if (rect->grad_geo) {
@@ -258,7 +258,7 @@ Configure(ZnItem item,
XColor *color;
unsigned short alpha;
- status = ZnConfigureAttributes(wi, item, rect_attrs, argc, argv, flags);
+ status = ZnConfigureAttributes(wi, item, item, rect_attrs, argc, argv, flags);
if (rect->gradient &&
(ISSET(*flags, ZN_BORDER_FLAG) || (rect->relief == ZN_RELIEF_FLAT))) {
@@ -314,7 +314,7 @@ ComputeCoordinates(ZnItem item,
ZnPoint p[4];
int i;
ZnBool aligned;
- ZnDim delta;
+ ZnDim delta, lw2;
ZnResetBBox(&item->item_bounding_box);
if (!rect->line_width && ISCLEAR(rect->flags, FILLED_BIT)) {
@@ -339,10 +339,11 @@ ComputeCoordinates(ZnItem item,
*/
ZnAddPointsToBBox(&item->item_bounding_box, rect->dev, 4);
if (rect->line_width > 0) {
- item->item_bounding_box.orig.x -= rect->line_width;
- item->item_bounding_box.orig.y -= rect->line_width;
- item->item_bounding_box.corner.x += rect->line_width;
- item->item_bounding_box.corner.y += rect->line_width;
+ lw2 = rect->line_width/2.0;
+ item->item_bounding_box.orig.x -= lw2;
+ item->item_bounding_box.orig.y -= lw2;
+ item->item_bounding_box.corner.x += lw2;
+ item->item_bounding_box.corner.y += lw2;
}
item->item_bounding_box.orig.x -= 1;
item->item_bounding_box.orig.y -= 1;
@@ -631,8 +632,11 @@ Render(ZnItem item)
}
else if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled/patterned */
if (ISSET(rect->flags, ALIGNED_BIT)) {
- ZnRenderTile(wi, rect->tile, rect->fill_color, NULL, NULL,
- (ZnPoint *) &item->item_bounding_box);
+ ZnBBox bbox;
+
+ bbox.orig = rect->dev[0];
+ bbox.corner = rect->dev[2];
+ ZnRenderTile(wi, rect->tile, rect->fill_color, NULL, NULL, (ZnPoint *) &bbox);
}
else {
ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB,
@@ -644,7 +648,7 @@ Render(ZnItem item)
XColor *color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
glColor4us(color->red, color->green, color->blue, alpha);
- RectRenderCB(rect);
+ RectRenderCB(rect);
}
}