From 1e335fc694e93bdc6e6560b20ccd35d712f51b74 Mon Sep 17 00:00:00 2001 From: lemort Date: Mon, 19 Nov 2007 16:19:01 +0000 Subject: Replace #ifdef GL_DAMAGE statement with a new option (-usedamage) of the TkZinc widget --- generic/Group.c | 62 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'generic/Group.c') diff --git a/generic/Group.c b/generic/Group.c index 6031811..8a1f668 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -1057,10 +1057,10 @@ Render(ZnItem item) GroupItem group = (GroupItem) item; ZnItem current_item; ZnWInfo *wi = item->wi; -#ifdef GL_DAMAGE +//#ifdef GL_DAMAGE ZnBBox *clip_box; ZnBBox bbox, old_damaged_area; -#endif +//#endif unsigned char save_alpha = wi->alpha; unsigned char save_alpha2; @@ -1074,23 +1074,43 @@ Render(ZnItem item) PushTransform(item); PushClip(group, True); -#ifdef GL_DAMAGE - if (ISCLEAR(wi->flags, ZN_CONFIGURE_EVENT) && (group->clip != ZN_NO_ITEM)) { - old_damaged_area = wi->damaged_area; - if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { - ZnIntersectBBox(&wi->damaged_area, clip_box, &bbox); - wi->damaged_area = bbox; + + /* Test if we are using damage or not */ + if (wi->usedamage) { + /* Damage is on */ + if (ISCLEAR(wi->flags, ZN_CONFIGURE_EVENT) && (group->clip != ZN_NO_ITEM)) { + old_damaged_area = wi->damaged_area; + if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { + ZnIntersectBBox(&wi->damaged_area, clip_box, &bbox); + wi->damaged_area = bbox; + } } - } -#endif + } current_item = group->tail; while (current_item != ZN_NO_ITEM) { if (ISSET(current_item->flags, ZN_VISIBLE_BIT)) { -#ifdef GL_DAMAGE - ZnIntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); - if (!ZnIsEmptyBBox(&bbox) || ISSET(wi->flags, ZN_CONFIGURE_EVENT)) { -#endif + /* test if we are using dmaage or not */ + if (wi->usedamage) { + /* Damage is on */ + ZnIntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); + if (!ZnIsEmptyBBox(&bbox) || ISSET(wi->flags, ZN_CONFIGURE_EVENT)) { + + if (current_item->class != ZnGroup) { + PushTransform(current_item); + if (ISCLEAR(current_item->flags, ZN_COMPOSE_ALPHA_BIT)) { + wi->alpha = 100; + } + } + current_item->class->Render(current_item); + if (current_item->class != ZnGroup) { + PopTransform(current_item); + wi->alpha = save_alpha2; + } + } + + } else { + /* Damage is off */ if (current_item->class != ZnGroup) { PushTransform(current_item); if (ISCLEAR(current_item->flags, ZN_COMPOSE_ALPHA_BIT)) { @@ -1102,18 +1122,18 @@ Render(ZnItem item) PopTransform(current_item); wi->alpha = save_alpha2; } -#ifdef GL_DAMAGE } -#endif + } current_item = current_item->previous; } -#ifdef GL_DAMAGE - if (ISCLEAR(wi->flags, ZN_CONFIGURE_EVENT) && (group->clip != ZN_NO_ITEM)) { - wi->damaged_area = old_damaged_area; - } -#endif + /* Test if we are using damage or not */ + if (wi->usedamage) { + if (ISCLEAR(wi->flags, ZN_CONFIGURE_EVENT) && (group->clip != ZN_NO_ITEM)) { + wi->damaged_area = old_damaged_area; + } + } PopClip(group, True); PopTransform(item); -- cgit v1.1