diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-30 17:28:21 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-12 08:29:48 +0100 |
commit | af9fbd176b145f042408ef5391eef2a51d7531f8 (patch) | |
tree | 5f75d1087d4325a013af6f0a4204a666fb4ca4f0 /src/cairo-path-fixed.c | |
parent | 0540bf384aed344899417d3b0313bd6704679c1c (diff) | |
download | cairo-af9fbd176b145f042408ef5391eef2a51d7531f8.tar.gz |
Introduce a new compositor architecture
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
Diffstat (limited to 'src/cairo-path-fixed.c')
-rw-r--r-- | src/cairo-path-fixed.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index d67954f84..c257d73bd 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -584,6 +584,18 @@ _cairo_path_fixed_curve_to (cairo_path_fixed_t *path, cairo_status_t status; cairo_point_t point[3]; + /* If this curves does not move, replace it with a line-to. + * This frequently happens with rounded-rectangles and r==0. + */ + if (path->current_point.x == x2 && path->current_point.y == y2) { + if (x1 == x2 && x0 == x2 && y1 == y2 && y0 == y2) + return _cairo_path_fixed_line_to (path, x2, y2); + + /* We may want to check for the absence of a cusp, in which case + * we can also replace the curve-to with a line-to. + */ + } + /* make sure subpaths are started properly */ if (! path->has_current_point) { status = _cairo_path_fixed_move_to (path, x0, y0); @@ -1270,6 +1282,51 @@ _cairo_path_fixed_is_box (const cairo_path_fixed_t *path, return FALSE; } +cairo_bool_t +_cairo_path_fixed_is_stroke_box (const cairo_path_fixed_t *path, + cairo_box_t *box) +{ + const cairo_path_buf_t *buf = cairo_path_head (path); + + if (! path->fill_is_rectilinear) + return FALSE; + + /* Do we have the right number of ops? */ + if (buf->num_ops != 5) + return FALSE; + + /* Check whether the ops are those that would be used for a rectangle */ + if (buf->op[0] != CAIRO_PATH_OP_MOVE_TO || + buf->op[1] != CAIRO_PATH_OP_LINE_TO || + buf->op[2] != CAIRO_PATH_OP_LINE_TO || + buf->op[3] != CAIRO_PATH_OP_LINE_TO || + buf->op[4] != CAIRO_PATH_OP_CLOSE_PATH) + { + return FALSE; + } + + /* Ok, we may have a box, if the points line up */ + if (buf->points[0].y == buf->points[1].y && + buf->points[1].x == buf->points[2].x && + buf->points[2].y == buf->points[3].y && + buf->points[3].x == buf->points[0].x) + { + _canonical_box (box, &buf->points[0], &buf->points[2]); + return TRUE; + } + + if (buf->points[0].x == buf->points[1].x && + buf->points[1].y == buf->points[2].y && + buf->points[2].x == buf->points[3].x && + buf->points[3].y == buf->points[0].y) + { + _canonical_box (box, &buf->points[0], &buf->points[2]); + return TRUE; + } + + return FALSE; +} + /* * Check whether the given path contains a single rectangle * that is logically equivalent to: |