From f8e17430eb3b501976c3f7533a12d43e65e68ba2 Mon Sep 17 00:00:00 2001 From: "vladimir@pobox.com" Date: Sun, 10 Jun 2007 17:08:00 -0700 Subject: [PATCH] b=383960, Upgrade cairo to 1.4.8, r=me -- moz cairo: avoid-region-extract.patch --- gfx/cairo/README | 5 +++++ gfx/cairo/avoid-region-extract.patch | 16 ++++++++++++++++ gfx/cairo/cairo/src/cairo-traps.c | 6 ++++++ 3 files changed, 27 insertions(+) create mode 100644 gfx/cairo/avoid-region-extract.patch diff --git a/gfx/cairo/README b/gfx/cairo/README index bd93b7a5460..8fc50fde4d1 100644 --- a/gfx/cairo/README +++ b/gfx/cairo/README @@ -32,3 +32,8 @@ win32-no-printer-bitblt.patch: If we need to BitBlt from a DC (to do fallback), only bother trying if the IS_DISPLAY flag is set -- many printers lie about their support for BitBlt, and we end up getting black instead of what we want. + +avoid-region-extract.patch: Bail from _cairo_traps_extract_region early +if we have over 200 traps (arbitrary); this avoids an O(N*N) perf hit +when the region is built up, because we call union_rect with each rect +individually instead of building the region up in one go. \ No newline at end of file diff --git a/gfx/cairo/avoid-region-extract.patch b/gfx/cairo/avoid-region-extract.patch new file mode 100644 index 00000000000..e266cfc208d --- /dev/null +++ b/gfx/cairo/avoid-region-extract.patch @@ -0,0 +1,16 @@ +diff -r 0e7cd985a7f0 gfx/cairo/cairo/src/cairo-traps.c +--- a/gfx/cairo/cairo/src/cairo-traps.c Fri Jun 08 18:09:53 2007 -0700 ++++ b/gfx/cairo/cairo/src/cairo-traps.c Fri Jun 08 18:10:48 2007 -0700 +@@ -599,6 +599,12 @@ _cairo_traps_extract_region (cairo_traps + { + int i; + ++ /* Bail early if we have lots of traps, until we fix the code ++ * below to not use Union() ++ */ ++ if (traps->num_traps > 200) ++ return CAIRO_INT_STATUS_UNSUPPORTED; ++ + for (i = 0; i < traps->num_traps; i++) + if (!(traps->traps[i].left.p1.x == traps->traps[i].left.p2.x + && traps->traps[i].right.p1.x == traps->traps[i].right.p2.x diff --git a/gfx/cairo/cairo/src/cairo-traps.c b/gfx/cairo/cairo/src/cairo-traps.c index f7171ddadf9..9ea5bbc8d62 100644 --- a/gfx/cairo/cairo/src/cairo-traps.c +++ b/gfx/cairo/cairo/src/cairo-traps.c @@ -599,6 +599,12 @@ _cairo_traps_extract_region (cairo_traps_t *traps, { int i; + /* Bail early if we have lots of traps, until we fix the code + * below to not use Union() + */ + if (traps->num_traps > 200) + return CAIRO_INT_STATUS_UNSUPPORTED; + for (i = 0; i < traps->num_traps; i++) if (!(traps->traps[i].left.p1.x == traps->traps[i].left.p2.x && traps->traps[i].right.p1.x == traps->traps[i].right.p2.x