[cairo-commit] src/cairo-xcb-surface-render.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu Jul 21 10:07:31 PDT 2011
src/cairo-xcb-surface-render.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
New commits:
commit 5eb8eacde0ec3267e55e9b63a33ed2d4642867a7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jul 21 18:01:34 2011 +0100
xcb: Always send a clip region along with clipped glyphs
As we do not control the geometry used for the individual glyphs, we
must always send a clip-region so that X can trim the glyph
appropriately. However, in order to avoid sending unnecessary data we
only do so if the clip extents is less than the ink extents of the
glyphs.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index faa91ce..3d14093 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2317,6 +2317,7 @@ _cairo_xcb_surface_clear (cairo_xcb_surface_t *dst)
enum {
NEED_CLIP_REGION = 0x1,
NEED_CLIP_SURFACE = 0x2,
+ FORCE_CLIP_REGION = 0x4,
};
static cairo_bool_t
@@ -2371,7 +2372,9 @@ _clip_and_composite (cairo_xcb_surface_t *dst,
if (need_clip & NEED_CLIP_REGION) {
clip_region = _cairo_clip_get_region (extents->clip);
- if (cairo_region_contains_rectangle (clip_region, &extents->unbounded) == CAIRO_REGION_OVERLAP_IN)
+ if ((need_clip & FORCE_CLIP_REGION) == 0 &&
+ cairo_region_contains_rectangle (clip_region,
+ &extents->unbounded) == CAIRO_REGION_OVERLAP_IN)
clip_region = NULL;
if (clip_region != NULL) {
status = _cairo_xcb_surface_set_clip_region (dst, clip_region);
@@ -4716,6 +4719,7 @@ _cairo_xcb_surface_render_glyphs (cairo_xcb_surface_t *surface,
scaled_font, glyphs, &num_glyphs);
if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
composite_glyphs_info_t info;
+ unsigned flags = 0;
info.font = scaled_font;
info.glyphs = (cairo_xcb_glyph_t *) glyphs;
@@ -4725,10 +4729,21 @@ _cairo_xcb_surface_render_glyphs (cairo_xcb_surface_t *surface,
! extents.is_bounded ||
! _cairo_clip_is_region(extents.clip);
+ if (extents.mask.width > extents.unbounded.width ||
+ extents.mask.height > extents.unbounded.height)
+ {
+ /* Glyphs are tricky since we do not directly control the
+ * geometry and their inked extents depend on the
+ * individual glyph-surface size. We must set a clip region
+ * so that the X server can trim the glyphs appropriately.
+ */
+ flags |= FORCE_CLIP_REGION;
+ }
status = _clip_and_composite (surface, op, source,
- _composite_glyphs,
- NULL, &info, &extents,
- need_bounded_clip (&extents));
+ _composite_glyphs, NULL,
+ &info, &extents,
+ need_bounded_clip (&extents) |
+ flags);
}
}
More information about the cairo-commit
mailing list