return our_type;
}
+/**
+ * clutter_geometry_union:
+ * @geometry_a: a #ClutterGeometry
+ * @geometry_b: another #ClutterGeometry
+ * @result: (out): location to store the result
+ *
+ * Find the union of two rectangles represented as #ClutterGeometry.
+ *
+ * Since: 1.4
+ */
+void
+clutter_geometry_union (const ClutterGeometry *geometry_a,
+ const ClutterGeometry *geometry_b,
+ ClutterGeometry *result)
+{
+ /* We don't try to handle rectangles that can't be represented
+ * as a signed integer box */
+ gint x1 = MIN (geometry_a->x, geometry_b->x);
+ gint y1 = MIN (geometry_a->y, geometry_b->y);
+ gint x2 = MAX (geometry_a->x + (gint)geometry_a->width,
+ geometry_b->x + (gint)geometry_b->width);
+ gint y2 = MAX (geometry_a->y + (gint)geometry_a->height,
+ geometry_b->y + (gint)geometry_b->height);
+ result->x = x1;
+ result->y = y1;
+ result->width = x2 - x1;
+ result->height = y2 - y1;
+}
+
/*
* ClutterVertices
*/
GType clutter_geometry_get_type (void) G_GNUC_CONST;
+void clutter_geometry_union (const ClutterGeometry *geometry_a,
+ const ClutterGeometry *geometry_b,
+ ClutterGeometry *result);
+
/**
* ClutterKnot:
* @x: X coordinate of the knot
if (clutter_stage_glx_ignoring_redraw_clips (stage_window))
return;
+ /* Do nothing on an empty clip, to avoid confusing with the flag degenerate clip */
+ if (stage_clip->width == 0)
+ return;
+
/* A NULL stage clip means a full stage redraw has been queued and
* we keep track of this by setting a degenerate
* stage_glx->bounding_redraw_clip */
stage_glx->bounding_redraw_clip.width = stage_clip->width;
stage_glx->bounding_redraw_clip.height = stage_clip->height;
}
- else
+ else if (stage_glx->bounding_redraw_clip.width > 0)
{
- int x2, y2;
-
- stage_glx->bounding_redraw_clip.x =
- MIN (stage_clip->x, stage_glx->bounding_redraw_clip.x);
- stage_glx->bounding_redraw_clip.y =
- MIN (stage_clip->y, stage_glx->bounding_redraw_clip.y);
-
- x2 = MAX (stage_clip->x + stage_clip->width,
- stage_glx->bounding_redraw_clip.x +
- stage_glx->bounding_redraw_clip.width);
- y2 = MAX (stage_clip->y + stage_clip->height,
- stage_glx->bounding_redraw_clip.y +
- stage_glx->bounding_redraw_clip.height);
-
- stage_glx->bounding_redraw_clip.width =
- x2 - stage_glx->bounding_redraw_clip.x;
- stage_glx->bounding_redraw_clip.height =
- y2 - stage_glx->bounding_redraw_clip.y;
+ clutter_geometry_union (&stage_glx->bounding_redraw_clip, stage_clip,
+ &stage_glx->bounding_redraw_clip);
}
/* FIXME: This threshold was plucked out of thin air! */