[traps] Increase exponential expansion factor.

Grow the traps more rapidly, as the allocations are very short-lived so
the over-allocation is less of an issue.
This commit is contained in:
Chris Wilson 2009-07-25 07:38:04 +01:00
parent 9d51c03bad
commit 36480fe531
2 changed files with 6 additions and 10 deletions

View file

@ -124,7 +124,7 @@ static cairo_bool_t
_cairo_traps_grow (cairo_traps_t *traps)
{
cairo_trapezoid_t *new_traps;
int new_size = 2 * MAX (traps->traps_size, 16);
int new_size = 4 * traps->traps_size;
if (CAIRO_INJECT_FAULT ()) {
traps->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -157,10 +157,8 @@ _cairo_traps_add_trap (cairo_traps_t *traps,
{
cairo_trapezoid_t *trap;
assert (top < bottom);
if (traps->num_traps == traps->traps_size) {
if (! _cairo_traps_grow (traps))
if (unlikely (traps->num_traps == traps->traps_size)) {
if (unlikely (! _cairo_traps_grow (traps)))
return;
}

View file

@ -954,15 +954,13 @@ typedef struct _cairo_traps {
cairo_box_t limits;
unsigned int maybe_region : 1; /* hint: 0 implies that it cannot be */
unsigned int has_limits : 1;
unsigned int has_intersections : 1;
int num_traps;
int traps_size;
cairo_trapezoid_t *traps;
/* embed enough storage for a stroked rectangle */
cairo_trapezoid_t traps_embedded[4];
cairo_bool_t has_limits;
cairo_bool_t has_intersections;
cairo_trapezoid_t traps_embedded[16];
} cairo_traps_t;
#define CAIRO_FONT_SLANT_DEFAULT CAIRO_FONT_SLANT_NORMAL