gfx/cairo/empty-clip-extents.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 From b79ea8a6cab8bd28aebecf6e1e8229d5ac017264 Mon Sep 17 00:00:00 2001
michael@0 2 From: Karl Tomlinson <karlt+@karlt.net>
michael@0 3 Date: Fri, 16 Jul 2010 23:46:25 +0000
michael@0 4 Subject: clip: consider all_clipped in _cairo_clip_get_extents
michael@0 5
michael@0 6 If the gstate clip in _cairo_gstate_int_clip_extents() has all_clipped
michael@0 7 set (and path NULL), then it returns the gstate target extents instead of
michael@0 8 an empty rectangle. If the target is infinite, then it says the clip is
michael@0 9 unbounded.
michael@0 10
michael@0 11 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29124
michael@0 12 Tested-by test/get-clip
michael@0 13
michael@0 14 Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
michael@0 15 ---
michael@0 16 diff --git a/src/cairo-clip.c b/src/cairo-clip.c
michael@0 17 index f6173c6..77d8214 100644
michael@0 18 --- a/src/cairo-clip.c
michael@0 19 +++ b/src/cairo-clip.c
michael@0 20 @@ -1264,9 +1264,14 @@ _cairo_clip_combine_with_surface (cairo_clip_t *clip,
michael@0 21 return CAIRO_STATUS_SUCCESS;
michael@0 22 }
michael@0 23
michael@0 24 +static const cairo_rectangle_int_t _cairo_empty_rectangle_int = { 0, 0, 0, 0 };
michael@0 25 +
michael@0 26 const cairo_rectangle_int_t *
michael@0 27 _cairo_clip_get_extents (const cairo_clip_t *clip)
michael@0 28 {
michael@0 29 + if (clip->all_clipped)
michael@0 30 + return &_cairo_empty_rectangle_int;
michael@0 31 +
michael@0 32 if (clip->path == NULL)
michael@0 33 return NULL;
michael@0 34
michael@0 35 diff --git a/test/get-clip.c b/test/get-clip.c
michael@0 36 index 9d6e796..f0477a1 100644
michael@0 37 --- a/test/get-clip.c
michael@0 38 +++ b/test/get-clip.c
michael@0 39 @@ -83,6 +83,8 @@ check_clip_extents (const cairo_test_context_t *ctx,
michael@0 40 cairo_clip_extents (cr, &ext_x1, &ext_y1, &ext_x2, &ext_y2);
michael@0 41 if (ext_x1 == x && ext_y1 == y && ext_x2 == x + width && ext_y2 == y + height)
michael@0 42 return 1;
michael@0 43 + if (width == 0.0 && height == 0.0 && ext_x1 == ext_x2 && ext_y1 == ext_y2)
michael@0 44 + return 1;
michael@0 45 cairo_test_log (ctx, "Error: %s; clip extents %f,%f,%f,%f should be %f,%f,%f,%f\n",
michael@0 46 message, ext_x1, ext_y1, ext_x2 - ext_x1, ext_y2 - ext_y1,
michael@0 47 x, y, width, height);
michael@0 48 @@ -138,7 +140,8 @@ preamble (cairo_test_context_t *ctx)
michael@0 49 cairo_save (cr);
michael@0 50 cairo_clip (cr);
michael@0 51 rectangle_list = cairo_copy_clip_rectangle_list (cr);
michael@0 52 - if (! check_count (ctx, phase, rectangle_list, 0))
michael@0 53 + if (! check_count (ctx, phase, rectangle_list, 0) ||
michael@0 54 + ! check_clip_extents (ctx, phase, cr, 0, 0, 0, 0))
michael@0 55 {
michael@0 56 goto FAIL;
michael@0 57 }
michael@0 58 --
michael@0 59 cgit v0.8.3-6-g21f6

mercurial