[cairo-commit] 2 commits - perf/cairo-stats.c src/cairo-mono-scan-converter.c src/cairo-traps-compositor.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Sep 13 04:32:18 PDT 2011
perf/cairo-stats.c | 13 ++++++-------
src/cairo-mono-scan-converter.c | 2 +-
src/cairo-traps-compositor.c | 32 ++++++++++++--------------------
3 files changed, 19 insertions(+), 28 deletions(-)
New commits:
commit 3e655f081921c8caa0b6d2bedfbe5f6174e999a1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Sep 13 09:39:42 2011 +0100
traps: Send unaligned boxes as trapezoids
According to the little fishies this performs significantly better.
As a bonus, it did not handle overlapping boxes correctly...
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-mono-scan-converter.c b/src/cairo-mono-scan-converter.c
index 52cd935..4dc8aaa 100644
--- a/src/cairo-mono-scan-converter.c
+++ b/src/cairo-mono-scan-converter.c
@@ -127,7 +127,7 @@ polygon_init (struct polygon *polygon, int ymin, int ymax)
if (unlikely (NULL == polygon->y_buckets))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
- memset (polygon->y_buckets, 0, h * sizeof (struct edge *));
+ memset (polygon->y_buckets, 0, h * sizeof (struct edge *));
polygon->ymin = ymin;
polygon->ymax = ymax;
diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
index 92c8665..5b22fd7 100644
--- a/src/cairo-traps-compositor.c
+++ b/src/cairo-traps-compositor.c
@@ -1458,29 +1458,21 @@ composite_boxes (const cairo_traps_compositor_t *compositor,
const cairo_rectangle_int_t *extents,
cairo_clip_t *clip)
{
- const cairo_boxes_t *boxes = closure;
- const struct _cairo_boxes_chunk *chunk;
- struct composite_opacity_info info;
- int i;
-
- info.compositor = compositor;
- info.op = op;
- info.dst = dst;
-
- info.src = src;
- info.src_x = src_x;
- info.src_y = src_y;
+ cairo_traps_t traps;
+ cairo_status_t status;
- info.opacity = 1. / (double) 0xffff;
+ status = _cairo_traps_init_boxes (&traps, closure);
+ if (unlikely (status))
+ return status;
- /* XXX for lots of boxes create a clip region for the fully opaque areas */
- for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
- for (i = 0; i < chunk->count; i++)
- do_unaligned_box(composite_opacity, &info,
- &chunk->base[i], dst_x, dst_y);
- }
+ status = compositor->composite_traps (dst, op, src,
+ src_x - dst_x, src_y - dst_y,
+ dst_x, dst_y,
+ extents,
+ CAIRO_ANTIALIAS_DEFAULT, &traps);
+ _cairo_traps_fini (&traps);
- return CAIRO_STATUS_SUCCESS;
+ return status;
}
static cairo_status_t
commit 05a73434fc5ce8157af70b4950ca9de4c6dd7a46
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Sep 13 09:40:35 2011 +0100
perf/stats: Avoid overflow when summing time-squared
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/perf/cairo-stats.c b/perf/cairo-stats.c
index c422d6c..1e25aef 100644
--- a/perf/cairo-stats.c
+++ b/perf/cairo-stats.c
@@ -35,6 +35,7 @@ _cairo_stats_compute (cairo_stats_t *stats,
cairo_time_t sum, mean, delta, q1, q3, iqr;
cairo_time_t outlier_min, outlier_max;
int i, min_valid, num_valid;
+ double s;
assert (num_values > 0);
@@ -83,13 +84,11 @@ _cairo_stats_compute (cairo_stats_t *stats,
sum = _cairo_time_add (sum, values[i]);
mean = sum / num_valid;
- sum = 0;
+ /* Let's use a normalized std. deviation for easier comparison. */
+ s = 0;
for (i = min_valid; i < min_valid + num_valid; i++) {
- delta = values[i] - mean;
- sum += delta * delta;
+ double delta = (values[i] - mean) / (double)mean;
+ s += delta * delta;
}
-
- /* Let's use a std. deviation normalized to the mean for easier
- * comparison. */
- stats->std_dev = sqrt(sum / num_valid) / mean;
+ stats->std_dev = sqrt(s / num_valid);
}
More information about the cairo-commit
mailing list