[cairo-commit] 3 commits - src/cairo-xcb-connection.c src/cairo-xcb-connection-render.c src/cairo-xcb-private.h src/cairo-xcb-surface-render.c
Uli Schlachter
psychon at kemper.freedesktop.org
Mon Feb 28 12:42:43 PST 2011
src/cairo-xcb-connection-render.c | 73 -----------------
src/cairo-xcb-connection.c | 22 -----
src/cairo-xcb-private.h | 25 +-----
src/cairo-xcb-surface-render.c | 156 +-------------------------------------
4 files changed, 13 insertions(+), 263 deletions(-)
New commits:
commit c0dc933efda7672b07e188a1195821340f911a66
Author: Uli Schlachter <psychon at znc.in>
Date: Mon Feb 28 15:54:02 2011 +0100
xcb: Remove CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS
This flag was only ever tested, but never set. Also, there is no X11 server out
there which actually supports this.
AFAIK it was just an experiment which turned into dead code.
Signed-off-by: Uli Schlachter <psychon at znc.in>
diff --git a/src/cairo-xcb-connection-render.c b/src/cairo-xcb-connection-render.c
index b44e363..8d95509 100644
--- a/src/cairo-xcb-connection-render.c
+++ b/src/cairo-xcb-connection-render.c
@@ -113,79 +113,6 @@ _cairo_xcb_connection_render_trapezoids (cairo_xcb_connection_t *connection,
}
void
-_cairo_xcb_connection_render_spans (cairo_xcb_connection_t *connection,
- xcb_render_picture_t dst,
- int op,
- xcb_render_picture_t src,
- int16_t src_x, int16_t src_y,
- int16_t dst_x, int16_t dst_y,
- int16_t width, int16_t height,
- uint32_t num_spans,
- uint16_t *spans)
-{
- ASSERT_NOT_REACHED;
-#if 0
-#define X_RenderSpans 99
-
- struct {
- uint8_t major;
- uint8_t minor;
- uint16_t length;
- uint8_t op;
- uint8_t pad1;
- uint16_t pad2;
- uint32_t src;
- uint32_t dst;
- int16_t src_x;
- int16_t src_y;
- int16_t dst_x;
- int16_t dst_y;
- uint16_t width;
- uint16_t height;
- } req;
- struct iovec vec[3];
- uint32_t prefix[2];
- uint32_t len = (sizeof (req) + num_spans * sizeof (uint16_t)) >> 2;
-
- req.major = connection->render->major_opcode;
- req.minor = X_RenderSpans;
- req.length = 0;
-
- req.dst = dst;
- req.op = op;
- req.src = src;
- req.src_x = src_x;
- req.src_y = src_y;
- req.dst_x = dst_x;
- req.dst_y = dst_y;
- req.width = width;
- req.height = height;
-
- if (len < connection->root->maximum_request_length) {
- req.length = len;
-
- vec[0].iov_base = &req;
- vec[0].iov_len = sizeof (req);
- vec[1].iov_base = spans;
- vec[1].iov_len = num_spans * sizeof (uint16_t);
-
- _cairo_xcb_connection_write (connection, vec, 2);
- } else {
- prefix[0] = *(uint32_t *) &req;
- prefix[1] = len + 1;
- vec[0].iov_base = prefix;
- vec[0].iov_len = sizeof (prefix);
- vec[1].iov_base = (uint32_t *) &req + 1;
- vec[1].iov_len = sizeof (req) - 4;
- vec[2].iov_base = spans;
- vec[2].iov_len = num_spans * sizeof (uint16_t);
-
- _cairo_xcb_connection_write (connection, vec, 3);
- }
-#endif
-}
-
-void
_cairo_xcb_connection_render_create_glyph_set (cairo_xcb_connection_t *connection,
xcb_render_glyphset_t id,
xcb_render_pictformat_t format)
diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h
index 17cb0b4..be6ca44 100644
--- a/src/cairo-xcb-private.h
+++ b/src/cairo-xcb-private.h
@@ -204,13 +204,12 @@ enum {
CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES = 0x0002,
CAIRO_XCB_RENDER_HAS_COMPOSITE = 0x0004,
CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS = 0x0008,
- CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS = 0x0010,
- CAIRO_XCB_RENDER_HAS_COMPOSITE_GLYPHS = 0x0020,
- CAIRO_XCB_RENDER_HAS_PICTURE_TRANSFORM = 0x0040,
- CAIRO_XCB_RENDER_HAS_FILTERS = 0x0080,
- CAIRO_XCB_RENDER_HAS_PDF_OPERATORS = 0x0100,
- CAIRO_XCB_RENDER_HAS_EXTENDED_REPEAT = 0x0200,
- CAIRO_XCB_RENDER_HAS_GRADIENTS = 0x0400,
+ CAIRO_XCB_RENDER_HAS_COMPOSITE_GLYPHS = 0x0010,
+ CAIRO_XCB_RENDER_HAS_PICTURE_TRANSFORM = 0x0020,
+ CAIRO_XCB_RENDER_HAS_FILTERS = 0x0040,
+ CAIRO_XCB_RENDER_HAS_PDF_OPERATORS = 0x0080,
+ CAIRO_XCB_RENDER_HAS_EXTENDED_REPEAT = 0x0100,
+ CAIRO_XCB_RENDER_HAS_GRADIENTS = 0x0200,
CAIRO_XCB_HAS_DRI2 = 0x40000000,
CAIRO_XCB_HAS_SHM = 0x80000000
@@ -586,16 +585,6 @@ _cairo_xcb_connection_shm_put_image (cairo_xcb_connection_t *connection,
#endif
cairo_private void
-_cairo_xcb_connection_render_spans (cairo_xcb_connection_t *connection,
- xcb_render_picture_t dst,
- int op,
- xcb_render_picture_t src,
- int16_t src_x, int16_t src_y,
- int16_t dst_x, int16_t dst_y,
- int16_t width, int16_t height,
- unsigned int length,
- uint16_t *spans);
-cairo_private void
_cairo_xcb_connection_render_create_picture (cairo_xcb_connection_t *connection,
xcb_render_picture_t picture,
xcb_drawable_t drawable,
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 204863a..cb81507 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2778,128 +2778,6 @@ _boxes_for_traps (cairo_boxes_t *boxes,
}
}
-typedef struct _cairo_xcb_surface_span_renderer {
- cairo_span_renderer_t base;
-
- void *spans;
- unsigned len;
- unsigned size;
- uint16_t spans_embedded[1024];
-} cairo_xcb_surface_span_renderer_t;
-
-static cairo_status_t
-_cairo_xcb_surface_span_renderer_accumulate (void *abstract_renderer,
- int y,
- int height,
- const cairo_half_open_span_t *spans,
- unsigned num_spans)
-{
- cairo_xcb_surface_span_renderer_t *renderer = abstract_renderer;
- uint16_t *u16;
- int len;
-
- len = 4 * (2 + num_spans);
- if (renderer->size < renderer->len + len) {
- char *new_spans;
-
- do {
- renderer->size <<= 1;
- } while (renderer->size < renderer->len + len);
-
- if (renderer->spans == renderer->spans_embedded) {
- new_spans = malloc (renderer->size);
- if (unlikely (new_spans == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
- memcpy (new_spans, renderer->spans, renderer->len);
- } else {
- new_spans = realloc (renderer->spans, renderer->size);
- if (unlikely (new_spans == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
- }
-
- renderer->spans = new_spans;
- }
-
- u16 = (uint16_t *) ((char *) renderer->spans + renderer->len);
- *u16++ = y;
- *u16++ = height;
- *u16++ = num_spans;
- *u16++ = 0;
- while (num_spans--) {
- *u16++ = spans->x;
- *u16++ = spans->coverage * 0x0101;
- spans++;
- }
- renderer->len += len;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-typedef struct {
- cairo_polygon_t *polygon;
- cairo_fill_rule_t fill_rule;
- cairo_antialias_t antialias;
-} composite_spans_info_t;
-
-static cairo_status_t
-_composite_spans (void *closure,
- cairo_xcb_surface_t *dst,
- cairo_operator_t op,
- const cairo_pattern_t *pattern,
- int dst_x,
- int dst_y,
- const cairo_rectangle_int_t *extents,
- cairo_region_t *clip_region)
-{
- composite_spans_info_t *info = closure;
- cairo_xcb_surface_span_renderer_t renderer;
- cairo_scan_converter_t *converter;
- cairo_status_t status;
- cairo_xcb_picture_t *src;
-
- renderer.base.render_rows = _cairo_xcb_surface_span_renderer_accumulate;
- renderer.spans = renderer.spans_embedded;
- renderer.size = ARRAY_LENGTH (renderer.spans_embedded);
- renderer.len = 0;
-
- converter = _cairo_tor_scan_converter_create (extents->x,
- extents->x + extents->width,
- extents->y,
- extents->y + extents->height,
- info->fill_rule);
- status = converter->add_polygon (converter, info->polygon);
- if (unlikely (status))
- goto CLEANUP_RENDERER;
-
- status = converter->generate (converter, &renderer.base);
- if (unlikely (status))
- goto CLEANUP_CONVERTER;
-
- src = _cairo_xcb_picture_for_pattern (dst, pattern, extents);
- status = src->base.status;
- if (unlikely (status))
- goto CLEANUP_CONVERTER;
-
- _cairo_xcb_connection_render_spans (dst->connection,
- dst->picture,
- _render_operator (op),
- src->picture,
- extents->x + src->x, extents->y + src->y,
- extents->x + dst_x, extents->y + dst_y,
- extents->width, extents->height,
- renderer.len >> 1, renderer.spans);
- cairo_surface_destroy (&src->base);
-
- CLEANUP_CONVERTER:
- converter->destroy (converter);
- CLEANUP_RENDERER:
- if (renderer.spans != renderer.spans_embedded)
- free (renderer.spans);
-
- return status;
-}
-
static cairo_status_t
_composite_mask (void *closure,
cairo_xcb_surface_t *dst,
@@ -2994,8 +2872,7 @@ _cairo_xcb_surface_render_paint (cairo_xcb_surface_t *surface,
if (unlikely (! _operator_is_supported (surface->flags, op)))
return CAIRO_INT_STATUS_UNSUPPORTED;
- if ((surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS |
- CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
+ if ((surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
CAIRO_XCB_RENDER_HAS_COMPOSITE)) == 0)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -3104,12 +2981,6 @@ _cairo_xcb_surface_render_mask (cairo_xcb_surface_t *surface,
return status;
}
-typedef struct {
- cairo_polygon_t polygon;
- cairo_fill_rule_t fill_rule;
- cairo_antialias_t antialias;
-} composite_polygon_info_t;
-
static cairo_status_t
_cairo_xcb_surface_render_composite_polygon (cairo_xcb_surface_t *dst,
cairo_operator_t op,
@@ -3162,18 +3033,6 @@ _cairo_xcb_surface_render_composite_polygon (cairo_xcb_surface_t *dst,
if (extents->is_bounded && ! is_not_empty)
return CAIRO_STATUS_SUCCESS;
- if (dst->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS) {
- composite_spans_info_t spans;
-
- spans.polygon = polygon;
- spans.fill_rule = CAIRO_FILL_RULE_WINDING;
- spans.antialias = antialias;
-
- return _clip_and_composite (dst, op, source,
- _composite_spans, &spans,
- extents, clip);
- }
-
_cairo_traps_init (&traps.traps);
status = _cairo_bentley_ottmann_tessellate_polygon (&traps.traps, polygon, fill_rule);
@@ -3351,8 +3210,7 @@ _cairo_xcb_surface_render_stroke (cairo_xcb_surface_t *surface,
if (unlikely (! _operator_is_supported (surface->flags, op)))
return CAIRO_INT_STATUS_UNSUPPORTED;
- if ((surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS |
- CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
+ if ((surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
CAIRO_XCB_RENDER_HAS_COMPOSITE)) == 0)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -3404,7 +3262,7 @@ _cairo_xcb_surface_render_stroke (cairo_xcb_surface_t *surface,
}
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
- if (surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS | CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS)) {
+ if (surface->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS) {
status = _cairo_xcb_surface_render_stroke_as_polygon (surface, op, source,
path, style,
ctm, ctm_inverse,
@@ -3534,8 +3392,7 @@ _cairo_xcb_surface_render_fill (cairo_xcb_surface_t *surface,
if (unlikely (! _operator_is_supported (surface->flags, op)))
return CAIRO_INT_STATUS_UNSUPPORTED;
- if ((surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS |
- CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
+ if ((surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS |
CAIRO_XCB_RENDER_HAS_COMPOSITE)) == 0)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -3585,7 +3442,7 @@ _cairo_xcb_surface_render_fill (cairo_xcb_surface_t *surface,
}
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
- if (surface->flags & (CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANS | CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS)) {
+ if (surface->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS) {
status = _cairo_xcb_surface_render_fill_as_polygon (surface, op, source, path,
fill_rule, tolerance, antialias,
clip, clip_boxes, num_boxes,
commit 6cd96f966f94cb4f9bf38f2b2c603068f10b55e8
Author: Uli Schlachter <psychon at znc.in>
Date: Mon Feb 28 15:45:14 2011 +0100
xcb: Fix for PDF operators with RENDER 0.11
RENDER 0.11 added PDF operators and the cairo-xcb backend is already prepared
for handling them. However, it doesn't actually handle them.
If you used such an operator with RENDER 0.11, _operator_is_supported() would
return TRUE, but later on an ASSERT_NOT_REACHED in _render_operator() is hit.
Signed-off-by: Uli Schlachter <psychon at znc.in>
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 5f1ede8..204863a 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -211,7 +211,8 @@ _operator_is_supported (uint32_t flags, cairo_operator_t op)
if (op <= CAIRO_OPERATOR_SATURATE)
return TRUE;
- return flags & CAIRO_XCB_RENDER_HAS_PDF_OPERATORS;
+ /* TODO Support pdf operators via CAIRO_XCB_RENDER_HAS_PDF_OPERATORS */
+ return FALSE;
}
static int
commit da9d6db11538bbec159155b2c30d9d77f181e78d
Author: Uli Schlachter <psychon at znc.in>
Date: Mon Feb 28 15:42:57 2011 +0100
xcb: Remove some unused code
All of these defines where not used anymore and this '#if 0'd code was so for
ages and most likely would stay commented out for more ages, too.
Signed-off-by: Uli Schlachter <psychon at znc.in>
diff --git a/src/cairo-xcb-connection.c b/src/cairo-xcb-connection.c
index 8098337..0c244b1 100644
--- a/src/cairo-xcb-connection.c
+++ b/src/cairo-xcb-connection.c
@@ -78,7 +78,6 @@ typedef struct _cairo_xcb_xid {
#define XCB_RENDER_HAS_TRIANGLES(surface) XCB_RENDER_AT_LEAST((surface), 0, 4)
#define XCB_RENDER_HAS_TRISTRIP(surface) XCB_RENDER_AT_LEAST((surface), 0, 4)
#define XCB_RENDER_HAS_TRIFAN(surface) XCB_RENDER_AT_LEAST((surface), 0, 4)
-#define XCB_RENDER_HAS_SPANS(surface) XCB_RENDER_AT_LEAST((surface), 0, 12)
#define XCB_RENDER_HAS_PICTURE_TRANSFORM(surface) XCB_RENDER_AT_LEAST((surface), 0, 6)
#define XCB_RENDER_HAS_FILTERS(surface) XCB_RENDER_AT_LEAST((surface), 0, 6)
@@ -890,24 +889,3 @@ cairo_xcb_device_debug_cap_xrender_version (cairo_device_t *device,
connection->flags &= ~CAIRO_XCB_RENDER_HAS_GRADIENTS;
}
}
-
-#if 0
-void
-cairo_xcb_device_debug_cap_xcairo_version (cairo_device_t *device,
- int major_version,
- int minor_version)
-{
- cairo_xcb_connection_t *connection = (cairo_xcb_connection_t *) device;
- cairo_status_t status;
-
- if (device->backend->type != CAIRO_DEVICE_TYPE_XCB) {
- status = _cairo_device_set_error (device, CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
- return;
- }
-
- /* clear any flags that are inappropriate for the desired version */
- if (major_version < 0 && minor_version < 0) {
- connection->flags &= ~(CAIRO_XCB_HAS_CAIRO);
- }
-}
-#endif
diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h
index aa8e34f..17cb0b4 100644
--- a/src/cairo-xcb-private.h
+++ b/src/cairo-xcb-private.h
@@ -212,8 +212,6 @@ enum {
CAIRO_XCB_RENDER_HAS_EXTENDED_REPEAT = 0x0200,
CAIRO_XCB_RENDER_HAS_GRADIENTS = 0x0400,
- CAIRO_XCB_HAS_CAIRO = 0x10000,
-
CAIRO_XCB_HAS_DRI2 = 0x40000000,
CAIRO_XCB_HAS_SHM = 0x80000000
};
More information about the cairo-commit
mailing list