aboutsummaryrefslogtreecommitdiff
path: root/generic/Item.c
diff options
context:
space:
mode:
authorlecoanet2002-03-26 09:29:53 +0000
committerlecoanet2002-03-26 09:29:53 +0000
commitfb257f808c6b342179fe53d281335d841a6f1ab5 (patch)
tree3532abc7174600a429d6ebd287f89298b58226dd /generic/Item.c
parent9159a6f2a9aa3940150399cb797632f06a55f4d2 (diff)
downloadtkzinc-fb257f808c6b342179fe53d281335d841a6f1ab5.zip
tkzinc-fb257f808c6b342179fe53d281335d841a6f1ab5.tar.gz
tkzinc-fb257f808c6b342179fe53d281335d841a6f1ab5.tar.bz2
tkzinc-fb257f808c6b342179fe53d281335d841a6f1ab5.tar.xz
Correction du probl�me de redessin avec GLX_DAMAGE du en une mauvaise
interaction entre calcul de damaged area et suppression de inset. Le scissor n'etait pas r�activ� apr�s le redessin de la bordure.
Diffstat (limited to 'generic/Item.c')
-rw-r--r--generic/Item.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/generic/Item.c b/generic/Item.c
index 4c52f9c..456f814 100644
--- a/generic/Item.c
+++ b/generic/Item.c
@@ -4752,36 +4752,44 @@ Damage(WidgetInfo *wi,
wi->damaged_area.corner.x = MAX(wi->damaged_area.corner.x, damage->corner.x);
wi->damaged_area.corner.y = MAX(wi->damaged_area.corner.y, damage->corner.y);
}
- if (wi->damaged_area.orig.x < 0) {
- wi->damaged_area.orig.x = 0;
+ /*printf("damaged area: %g %g %g %g\n", wi->damaged_area.orig.x,
+ wi->damaged_area.orig.y, wi->damaged_area.corner.x,
+ wi->damaged_area.corner.y);*/
+}
+
+static void
+ClampDamageArea(WidgetInfo *wi)
+{
+ int width, height;
+
+ if (wi->damaged_area.orig.x < wi->inset) {
+ wi->damaged_area.orig.x = wi->inset;
}
- if (wi->damaged_area.orig.y < 0) {
- wi->damaged_area.orig.y = 0;
+ if (wi->damaged_area.orig.y < wi->inset) {
+ wi->damaged_area.orig.y = wi->inset;
}
- if (wi->damaged_area.corner.x < 0) {
- wi->damaged_area.corner.x = 0;
+ if (wi->damaged_area.corner.x < wi->inset) {
+ wi->damaged_area.corner.x = wi->inset;
}
- if (wi->damaged_area.corner.y < 0) {
- wi->damaged_area.corner.y = 0;
+ if (wi->damaged_area.corner.y < wi->inset) {
+ wi->damaged_area.corner.y = wi->inset;
}
- if (wi->damaged_area.orig.x > wi->width) {
- wi->damaged_area.orig.x = wi->width;
+ width = wi->width - wi->inset;
+ height = wi->height - wi->inset;
+ if (wi->damaged_area.orig.x > width) {
+ wi->damaged_area.orig.x = width;
}
- if (wi->damaged_area.orig.y > wi->height) {
- wi->damaged_area.orig.y = wi->height;
+ if (wi->damaged_area.orig.y > height) {
+ wi->damaged_area.orig.y = height;
}
- if (wi->damaged_area.corner.x > wi->width) {
- wi->damaged_area.corner.x = wi->width;
+ if (wi->damaged_area.corner.x > width) {
+ wi->damaged_area.corner.x = width;
}
- if (wi->damaged_area.corner.y > wi->height) {
- wi->damaged_area.corner.y = wi->height;
+ if (wi->damaged_area.corner.y > height) {
+ wi->damaged_area.corner.y = height;
}
- /*printf("damaged area: %g %g %g %g\n", wi->damaged_area.orig.x,
- wi->damaged_area.orig.y, wi->damaged_area.corner.x,
- wi->damaged_area.corner.y);*/
}
-
static void
Update(WidgetInfo *wi)
{
@@ -4820,6 +4828,17 @@ Repair(WidgetInfo *wi)
if (wi->render) {
#ifdef GLX
+#ifdef GLX_DAMAGE
+ ClampDamageArea(wi);
+ /*
+ * Merge the exposed area.
+ */
+ AddBBoxToBBox(&wi->damaged_area, &wi->exposed_area);
+ if (IsEmptyBBox(&wi->damaged_area)) {
+ return;
+ }
+#endif
+
glXMakeCurrent(wi->dpy, ZnWindowId(wi->win), wi->gl_context);
glEnable(GL_POINT_SMOOTH);
@@ -4854,18 +4873,8 @@ Repair(WidgetInfo *wi)
glEnable(GL_SCISSOR_TEST);
/*
- * Merge the exposed area.
- */
- AddBBoxToBBox(&wi->damaged_area, &wi->exposed_area);
- /*
* Set the damaged area as the scissor area.
*/
- wi->damaged_area.orig.x = MAX(wi->damaged_area.orig.x, wi->inset);
- wi->damaged_area.orig.y = MAX(wi->damaged_area.orig.y, wi->inset);
- wi->damaged_area.corner.x = MIN(wi->damaged_area.corner.x,
- int_width-wi->inset);
- wi->damaged_area.corner.y = MIN(wi->damaged_area.corner.y,
- int_height-wi->inset);
wi->damaged_area.orig.x = REAL_TO_INT(wi->damaged_area.orig.x);
wi->damaged_area.orig.y = REAL_TO_INT(wi->damaged_area.orig.y);
wi->damaged_area.corner.x = REAL_TO_INT(wi->damaged_area.corner.x);
@@ -4926,7 +4935,7 @@ Repair(WidgetInfo *wi)
glVertex2f(wi->highlight_width, wi->highlight_width);
glVertex2f(int_width, 0);
glVertex2f(int_width - wi->highlight_width, wi->highlight_width);
- glVertex2f(int_width, Tk_Height(wi->win));
+ glVertex2f(int_width, int_height);
glVertex2f(int_width - wi->highlight_width, int_height - wi->highlight_width);
glVertex2f(0, int_height);
glVertex2f(wi->highlight_width, int_height - wi->highlight_width);
@@ -4942,8 +4951,11 @@ Repair(WidgetInfo *wi)
p[3].x = p[2].x = int_width - wi->highlight_width;
p[2].y = p[1].y = int_height - wi->highlight_width;
RenderPolygonRelief(wi, wi->relief, wi->relief_grad,
- False, p, 5, wi->border_width);
+ False, p, 5, wi->border_width);
}
+#ifdef GLX_DAMAGE
+ glEnable(GL_SCISSOR_TEST);
+#endif
}
/* Switch the GL buffers. */
@@ -4963,6 +4975,7 @@ Repair(WidgetInfo *wi)
XRectangle r;
ZnBBox merge;
+ ClampDamageArea(wi);
/*
* Merge the damaged area with the exposed area.
*/