gfx/cairo/empty-clip-extents.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/empty-clip-extents.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +From b79ea8a6cab8bd28aebecf6e1e8229d5ac017264 Mon Sep 17 00:00:00 2001
     1.5 +From: Karl Tomlinson <karlt+@karlt.net>
     1.6 +Date: Fri, 16 Jul 2010 23:46:25 +0000
     1.7 +Subject: clip: consider all_clipped in _cairo_clip_get_extents
     1.8 +
     1.9 +If the gstate clip in _cairo_gstate_int_clip_extents() has all_clipped
    1.10 +set (and path NULL), then it returns the gstate target extents instead of
    1.11 +an empty rectangle.  If the target is infinite, then it says the clip is
    1.12 +unbounded.
    1.13 +
    1.14 +Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29124
    1.15 +Tested-by test/get-clip
    1.16 +
    1.17 +Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    1.18 +---
    1.19 +diff --git a/src/cairo-clip.c b/src/cairo-clip.c
    1.20 +index f6173c6..77d8214 100644
    1.21 +--- a/src/cairo-clip.c
    1.22 ++++ b/src/cairo-clip.c
    1.23 +@@ -1264,9 +1264,14 @@ _cairo_clip_combine_with_surface (cairo_clip_t *clip,
    1.24 +     return CAIRO_STATUS_SUCCESS;
    1.25 + }
    1.26 + 
    1.27 ++static const cairo_rectangle_int_t _cairo_empty_rectangle_int = { 0, 0, 0, 0 };
    1.28 ++
    1.29 + const cairo_rectangle_int_t *
    1.30 + _cairo_clip_get_extents (const cairo_clip_t *clip)
    1.31 + {
    1.32 ++    if (clip->all_clipped)
    1.33 ++	return &_cairo_empty_rectangle_int;
    1.34 ++
    1.35 +     if (clip->path == NULL)
    1.36 + 	return NULL;
    1.37 + 
    1.38 +diff --git a/test/get-clip.c b/test/get-clip.c
    1.39 +index 9d6e796..f0477a1 100644
    1.40 +--- a/test/get-clip.c
    1.41 ++++ b/test/get-clip.c
    1.42 +@@ -83,6 +83,8 @@ check_clip_extents (const cairo_test_context_t *ctx,
    1.43 +     cairo_clip_extents (cr, &ext_x1, &ext_y1, &ext_x2, &ext_y2);
    1.44 +     if (ext_x1 == x && ext_y1 == y && ext_x2 == x + width && ext_y2 == y + height)
    1.45 +         return 1;
    1.46 ++    if (width == 0.0 && height == 0.0 && ext_x1 == ext_x2 && ext_y1 == ext_y2)
    1.47 ++        return 1;
    1.48 +     cairo_test_log (ctx, "Error: %s; clip extents %f,%f,%f,%f should be %f,%f,%f,%f\n",
    1.49 +                     message, ext_x1, ext_y1, ext_x2 - ext_x1, ext_y2 - ext_y1,
    1.50 +                     x, y, width, height);
    1.51 +@@ -138,7 +140,8 @@ preamble (cairo_test_context_t *ctx)
    1.52 +     cairo_save (cr);
    1.53 +     cairo_clip (cr);
    1.54 +     rectangle_list = cairo_copy_clip_rectangle_list (cr);
    1.55 +-    if (! check_count (ctx, phase, rectangle_list, 0))
    1.56 ++    if (! check_count (ctx, phase, rectangle_list, 0) ||
    1.57 ++        ! check_clip_extents (ctx, phase, cr, 0, 0, 0, 0))
    1.58 +     {
    1.59 + 	goto FAIL;
    1.60 +     }
    1.61 +--
    1.62 +cgit v0.8.3-6-g21f6

mercurial