[cairo] Disabling antialiased shape drawing
Billy Biggs
vektor at dumbterm.net
Wed Aug 3 21:57:15 PDT 2005
Attached is a revival of David Reveman's patch [1] to disable
antialiasing, with a slightly different API. Rather than explicitly
expose the details of how the shape is rendered, this new patch simply
provides a "shape resolution" hint with two settings: default and low.
Advantages of this approach:
1. The API does not hold back new backends that may want to default
to higher quality shape rasterizing (rather than specify A8).
2. The API can be safely ignored by backends that do not require this
setting, such as the PS or PDF outputs.
Disadvantages:
1. LCD-optimized shape rendering will require a new API.
2. The hint is vague and therefore might be misinterpreted either
by backend implementors or API users.
There has been interest in the past by multiple people for support of
non-antialiased shape rendering in Cairo. See [2], [3], and other posts
from those threads. I will try to summarize the main motivations for
this patch:
- Compatibility. Some vector graphics formats specify whether objects
should be drawn antialiased or not. Having this feature in cairo
may allow them to render correctly. [4]
- Completeness. Other APIs like GDI+ and CoreGraphics provide
mechanisms for non-antialiased rendering. Having this in Cairo
helps cross-platform development and implementors of porting tools.
- Consistency. If other parts of an application are being drawn using
an API which does not support antialiased line drawing, having
certain widgets or adornments antialiased may appear inconsistent.
- Debugging. It is useful for the programmer to disable antialiased
shapes when trying to determine what's causing a rendering error.
So far, the main argument against this change has been that there is
not been a clear need for this parameter (good job! bloating an API
should not be done lightly!). However, I believe that there is a high
demand for this change, and I think that having a hint-style API will
keep the impact on the implementation low while meeting these needs.
Comments appreciated.
-Billy
[1] David Reveman's posted the original patch here:
http://lists.freedesktop.org/archives/cairo/2005-January/002662.html
[2] http://lists.freedesktop.org/archives/cairo/2005-January/002636.html
[3] http://lists.freedesktop.org/archives/cairo/2005-March/003298.html
[4] http://www.w3.org/TR/1998/WD-SVGReq-19981029#DRAntialiasing
-------------- next part --------------
Index: doc/public/cairo-sections.txt
===================================================================
RCS file: /cvs/cairo/cairo/doc/public/cairo-sections.txt,v
retrieving revision 1.26
diff -p -u -r1.26 cairo-sections.txt
--- doc/public/cairo-sections.txt 25 Jul 2005 19:29:23 -0000 1.26
+++ doc/public/cairo-sections.txt 4 Aug 2005 04:23:37 -0000
@@ -196,6 +196,8 @@ cairo_set_source_rgba
cairo_set_source
cairo_set_source_surface
cairo_set_tolerance
+cairo_shape_resolution_t
+cairo_set_shape_resolution
cairo_fill_rule_t
cairo_set_fill_rule
cairo_set_line_width
@@ -265,6 +267,7 @@ cairo_glyph_path
cairo_get_operator
cairo_get_source
cairo_get_tolerance
+cairo_get_shape_resolution
cairo_get_current_point
cairo_get_fill_rule
cairo_get_line_width
Index: doc/public/tmpl/cairo.sgml
===================================================================
RCS file: /cvs/cairo/cairo/doc/public/tmpl/cairo.sgml,v
retrieving revision 1.26
diff -p -u -r1.26 cairo.sgml
--- doc/public/tmpl/cairo.sgml 28 Jul 2005 18:34:47 -0000 1.26
+++ doc/public/tmpl/cairo.sgml 4 Aug 2005 04:23:37 -0000
@@ -190,6 +190,23 @@ Drawing contexts.
@tolerance:
+<!-- ##### ENUM cairo_shape_resolution_t ##### -->
+<para>
+
+</para>
+
+ at CAIRO_SHAPE_RESOLUTION_DEFAULT:
+ at CAIRO_SHAPE_RESOLUTION_LOW:
+
+<!-- ##### FUNCTION cairo_set_shape_resolution ##### -->
+<para>
+
+</para>
+
+ at cr:
+ at resolution:
+
+
<!-- ##### ENUM cairo_fill_rule_t ##### -->
<para>
@@ -845,6 +862,15 @@ Drawing contexts.
@Returns:
+<!-- ##### FUNCTION cairo_get_shape_resolution ##### -->
+<para>
+
+</para>
+
+ at cr:
+ at Returns:
+
+
<!-- ##### FUNCTION cairo_get_current_point ##### -->
<para>
Index: src/cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.54
diff -p -u -r1.54 cairo-glitz-surface.c
--- src/cairo-glitz-surface.c 28 Jul 2005 16:46:38 -0000 1.54
+++ src/cairo-glitz-surface.c 4 Aug 2005 04:23:38 -0000
@@ -937,6 +937,7 @@ static cairo_int_status_t
_cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
cairo_pattern_t *pattern,
void *abstract_dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
Index: src/cairo-gstate-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate-private.h,v
retrieving revision 1.13
diff -p -u -r1.13 cairo-gstate-private.h
--- src/cairo-gstate-private.h 25 Jul 2005 19:29:24 -0000 1.13
+++ src/cairo-gstate-private.h 4 Aug 2005 04:23:38 -0000
@@ -81,6 +81,7 @@ struct _cairo_gstate {
cairo_operator_t operator;
double tolerance;
+ cairo_format_t shape_format;
/* stroke style */
double line_width;
Index: src/cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.152
diff -p -u -r1.152 cairo-gstate.c
--- src/cairo-gstate.c 28 Jul 2005 22:58:09 -0000 1.152
+++ src/cairo-gstate.c 4 Aug 2005 04:23:39 -0000
@@ -103,6 +103,7 @@ _cairo_gstate_init (cairo_gstate_t *gst
gstate->operator = CAIRO_GSTATE_OPERATOR_DEFAULT;
gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
+ gstate->shape_format = CAIRO_GSTATE_SHAPE_FORMAT_DEFAULT;
gstate->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
gstate->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
@@ -1258,6 +1259,7 @@ _composite_traps_intermediate_surface (c
status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_ADD,
&pattern.base,
intermediate,
+ gstate->shape_format,
extents->x, extents->y,
0, 0,
extents->width,
@@ -1353,6 +1355,7 @@ _composite_traps (cairo_gstate_t *gst
status = _cairo_surface_composite_trapezoids (gstate->operator,
&pattern.base, dst,
+ gstate->shape_format,
extents->x, extents->y,
extents->x, extents->y,
extents->width,
@@ -1737,6 +1740,7 @@ _cairo_gstate_intersect_clip_mask (cairo
status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN,
&pattern.base,
surface,
+ gstate->shape_format,
0, 0,
0, 0,
surface_rect.width,
@@ -2291,3 +2295,25 @@ _cairo_gstate_glyph_path (cairo_gstate_t
free (transformed_glyphs);
return status;
}
+
+cairo_private cairo_status_t
+_cairo_gstate_set_shape_resolution (cairo_gstate_t *gstate,
+ cairo_shape_resolution_t resolution)
+{
+ if (resolution == CAIRO_SHAPE_RESOLUTION_LOW)
+ gstate->shape_format = CAIRO_FORMAT_A1;
+ else
+ gstate->shape_format = CAIRO_GSTATE_SHAPE_FORMAT_DEFAULT;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_private cairo_shape_resolution_t
+_cairo_gstate_get_shape_resolution (cairo_gstate_t *gstate)
+{
+ if (gstate->shape_format == CAIRO_FORMAT_A1)
+ return CAIRO_SHAPE_RESOLUTION_LOW;
+
+ return CAIRO_SHAPE_RESOLUTION_DEFAULT;
+}
+
Index: src/cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.54
diff -p -u -r1.54 cairo-image-surface.c
--- src/cairo-image-surface.c 28 Jul 2005 17:47:40 -0000 1.54
+++ src/cairo-image-surface.c 4 Aug 2005 04:23:39 -0000
@@ -649,6 +649,7 @@ static cairo_int_status_t
_cairo_image_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
@@ -664,6 +665,19 @@ _cairo_image_surface_composite_trapezoid
cairo_int_status_t status;
int render_reference_x, render_reference_y;
int render_src_x, render_src_y;
+ pixman_format_t *image_format;
+
+ switch (shape_format) {
+ case CAIRO_FORMAT_A1:
+ image_format = pixman_format_create (PIXMAN_FORMAT_NAME_A1);
+ break;
+ case CAIRO_FORMAT_A8:
+ default:
+ image_format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
+ break;
+ }
+ if (!image_format)
+ return CAIRO_STATUS_NO_MEMORY;
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
src_x, src_y, width, height,
@@ -690,12 +704,15 @@ _cairo_image_surface_composite_trapezoid
pixman_composite_trapezoids (_pixman_operator (operator),
src->pixman_image,
dst->pixman_image,
+ image_format,
render_src_x + attributes.x_offset,
render_src_y + attributes.y_offset,
(pixman_trapezoid_t *) traps, num_traps);
_cairo_pattern_release_surface (pattern, &src->base, &attributes);
+ pixman_format_destroy (image_format);
+
return status;
}
Index: src/cairo-meta-surface-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface-private.h,v
retrieving revision 1.2
diff -p -u -r1.2 cairo-meta-surface-private.h
--- src/cairo-meta-surface-private.h 13 Jul 2005 19:32:51 -0000 1.2
+++ src/cairo-meta-surface-private.h 4 Aug 2005 04:23:39 -0000
@@ -77,6 +77,7 @@ typedef struct _cairo_command_composite_
cairo_command_type_t type;
cairo_operator_t operator;
cairo_pattern_union_t pattern;
+ cairo_format_t shape_format;
int x_src;
int y_src;
int x_dst;
Index: src/cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.5
diff -p -u -r1.5 cairo-meta-surface.c
--- src/cairo-meta-surface.c 27 Jul 2005 22:39:35 -0000 1.5
+++ src/cairo-meta-surface.c 4 Aug 2005 04:23:39 -0000
@@ -229,6 +229,7 @@ static cairo_int_status_t
_cairo_meta_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
+ cairo_format_t shape_format,
int x_src,
int y_src,
int x_dst,
@@ -248,6 +249,7 @@ _cairo_meta_surface_composite_trapezoids
command->type = CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS;
command->operator = operator;
_cairo_pattern_init_copy (&command->pattern.base, pattern);
+ command->shape_format = shape_format;
command->x_src = x_src;
command->y_src = y_src;
command->x_dst = x_dst;
@@ -523,6 +525,7 @@ _cairo_meta_surface_replay (cairo_surfac
(command->composite_trapezoids.operator,
&command->composite_trapezoids.pattern.base,
target,
+ command->composite_trapezoids.shape_format,
command->composite_trapezoids.x_src,
command->composite_trapezoids.y_src,
command->composite_trapezoids.x_dst,
Index: src/cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.54
diff -p -u -r1.54 cairo-pdf-surface.c
--- src/cairo-pdf-surface.c 27 Jul 2005 22:39:35 -0000 1.54
+++ src/cairo-pdf-surface.c 4 Aug 2005 04:23:40 -0000
@@ -1152,6 +1152,7 @@ static cairo_int_status_t
_cairo_pdf_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_dst,
+ cairo_format_t shape_format,
int x_src,
int y_src,
int x_dst,
Index: src/cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.45
diff -p -u -r1.45 cairo-ps-surface.c
--- src/cairo-ps-surface.c 28 Jul 2005 16:46:38 -0000 1.45
+++ src/cairo-ps-surface.c 4 Aug 2005 04:23:40 -0000
@@ -272,6 +272,7 @@ static cairo_int_status_t
_cairo_ps_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_dst,
+ cairo_format_t shape_format,
int x_src,
int y_src,
int x_dst,
@@ -286,6 +287,7 @@ _cairo_ps_surface_composite_trapezoids (
return _cairo_surface_composite_trapezoids (operator,
pattern,
surface->current_page,
+ shape_format,
x_src,
y_src,
x_dst,
Index: src/cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.85
diff -p -u -r1.85 cairo-surface.c
--- src/cairo-surface.c 28 Jul 2005 17:41:08 -0000 1.85
+++ src/cairo-surface.c 4 Aug 2005 04:23:41 -0000
@@ -876,6 +876,7 @@ static cairo_status_t
_fallback_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
cairo_surface_t *dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
@@ -928,6 +929,7 @@ _fallback_composite_trapezoids (cairo_op
state.image->base.backend->composite_trapezoids (operator, pattern,
&state.image->base,
+ shape_format,
src_x, src_y,
dst_x - state.image_rect.x,
dst_y - state.image_rect.y,
@@ -945,6 +947,7 @@ cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
cairo_surface_t *dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
@@ -965,6 +968,7 @@ _cairo_surface_composite_trapezoids (cai
if (dst->backend->composite_trapezoids) {
status = dst->backend->composite_trapezoids (operator,
pattern, dst,
+ shape_format,
src_x, src_y,
dst_x, dst_y,
width, height,
@@ -974,6 +978,7 @@ _cairo_surface_composite_trapezoids (cai
}
return _fallback_composite_trapezoids (operator, pattern, dst,
+ shape_format,
src_x, src_y,
dst_x, dst_y,
width, height,
Index: src/cairo-xcb-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xcb-surface.c,v
retrieving revision 1.44
diff -p -u -r1.44 cairo-xcb-surface.c
--- src/cairo-xcb-surface.c 28 Jul 2005 17:02:54 -0000 1.44
+++ src/cairo-xcb-surface.c 4 Aug 2005 04:23:41 -0000
@@ -943,6 +943,7 @@ static cairo_int_status_t
_cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
@@ -981,9 +982,18 @@ _cairo_xcb_surface_composite_trapezoids
render_src_x = src_x + render_reference_x - dst_x;
render_src_y = src_y + render_reference_y - dst_y;
+ switch (shape_format) {
+ case CAIRO_FORMAT_A1:
+ render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A1),
+ break;
+ case CAIRO_FORMAT_A8:
+ default:
+ render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
+ break;
+ }
+
/* XXX: The XTrapezoid cast is evil and needs to go away somehow. */
/* XXX: _format_from_cairo is slow. should cache something. */
- render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
status = _cairo_xcb_surface_set_attributes (src, &attributes);
if (status == CAIRO_STATUS_SUCCESS)
XCBRenderTrapezoids (dst->dpy,
Index: src/cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.101
diff -p -u -r1.101 cairo-xlib-surface.c
--- src/cairo-xlib-surface.c 28 Jul 2005 17:02:54 -0000 1.101
+++ src/cairo-xlib-surface.c 4 Aug 2005 04:23:42 -0000
@@ -1199,6 +1199,7 @@ static cairo_int_status_t
_cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
@@ -1215,6 +1216,7 @@ _cairo_xlib_surface_composite_trapezoids
composite_operation_t operation;
int render_reference_x, render_reference_y;
int render_src_x, render_src_y;
+ XRenderPictFormat *pict_format;
if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1235,6 +1237,16 @@ _cairo_xlib_surface_composite_trapezoids
status = CAIRO_INT_STATUS_UNSUPPORTED;
goto FAIL;
}
+
+ switch (shape_format) {
+ case CAIRO_FORMAT_A1:
+ pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA1);
+ break;
+ case CAIRO_FORMAT_A8:
+ default:
+ pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA8);
+ break;
+ }
if (traps[0].left.p1.y < traps[0].left.p2.y) {
render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x);
@@ -1254,7 +1266,7 @@ _cairo_xlib_surface_composite_trapezoids
XRenderCompositeTrapezoids (dst->dpy,
_render_operator (operator),
src->src_picture, dst->dst_picture,
- XRenderFindStandardFormat (dst->dpy, PictStandardA8),
+ pict_format,
render_src_x + attributes.x_offset,
render_src_y + attributes.y_offset,
(XTrapezoid *) traps, num_traps);
Index: src/cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.117
diff -p -u -r1.117 cairo.c
--- src/cairo.c 28 Jul 2005 17:41:08 -0000 1.117
+++ src/cairo.c 4 Aug 2005 04:23:43 -0000
@@ -532,6 +532,29 @@ cairo_set_tolerance (cairo_t *cr, double
}
/**
+ * cairo_set_shape_resolution:
+ * @cr: a #cairo_t
+ * @resolution: a shape resolution description, specified as
+ * a #cairo_shape_resolution_t
+ *
+ * Set the output resolution of the rasterizer used for drawing shapes.
+ * When set to %CAIRO_SHAPE_RESOLUTION_LOW this may disable antialiasing
+ * for geometry drawn to this context. See #cairo_shape_resolution_t.
+ **/
+void
+cairo_set_shape_resolution (cairo_t *cr, cairo_shape_resolution_t resolution)
+{
+ if (cr->status) {
+ _cairo_set_error (cr, cr->status);
+ return;
+ }
+
+ cr->status = _cairo_gstate_set_shape_resolution (cr->gstate, resolution);
+ if (cr->status)
+ _cairo_set_error (cr, cr->status);
+}
+
+/**
* cairo_set_fill_rule:
* @cr: a #cairo_t
* @fill_rule: a fill rule, specified as a #cairo_fill_rule_t
@@ -2079,6 +2102,20 @@ cairo_get_tolerance (cairo_t *cr)
}
/**
+ * cairo_get_shape_resolution:
+ * @cr: a cairo context
+ *
+ * Gets the shape resolution parameter set by cairo_set_shape_resolution().
+ *
+ * Return value: the requested shape resolution.
+ **/
+cairo_shape_resolution_t
+cairo_get_shape_resolution (cairo_t *cr)
+{
+ return _cairo_gstate_get_shape_resolution (cr->gstate);
+}
+
+/**
* cairo_get_current_point:
* @cr: a cairo context
* @x: return value for X coordinate of the current point
Index: src/cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.142
diff -p -u -r1.142 cairo.h
--- src/cairo.h 28 Jul 2005 17:41:08 -0000 1.142
+++ src/cairo.h 4 Aug 2005 04:23:44 -0000
@@ -296,6 +296,24 @@ void
cairo_set_tolerance (cairo_t *cr, double tolerance);
/**
+ * cairo_shape_resolution_t
+ * @CAIRO_SHAPE_RESOLUTION_DEFAULT: shapes are rendered normally.
+ * @CAIRO_SHAPE_RESOLUTION_LOW: where appropriate, shapes are rendered
+ * at a lower reseolution. For some backends, this disables
+ * antialiasing for geometry drawn to this context.
+ *
+ * #cairo_shape_resolution_t is used to identify the resolution
+ * of the shape rendering for supporting backends.
+ */
+typedef enum _cairo_shape_resolution {
+ CAIRO_SHAPE_RESOLUTION_DEFAULT,
+ CAIRO_SHAPE_RESOLUTION_LOW
+} cairo_shape_resolution_t;
+
+void
+cairo_set_shape_resolution (cairo_t *cr, cairo_shape_resolution_t resolution);
+
+/**
* cairo_fill_rule_t
* @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from
* left-to-right, counts +1. If the path crosses the ray
@@ -928,6 +946,9 @@ cairo_get_source (cairo_t *cr);
double
cairo_get_tolerance (cairo_t *cr);
+cairo_shape_resolution_t
+cairo_get_shape_resolution (cairo_t *cr);
+
void
cairo_get_current_point (cairo_t *cr, double *x, double *y);
Index: src/cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.175
diff -p -u -r1.175 cairoint.h
--- src/cairoint.h 29 Jul 2005 19:45:01 -0000 1.175
+++ src/cairoint.h 4 Aug 2005 04:23:44 -0000
@@ -683,6 +683,7 @@ typedef struct _cairo_surface_backend {
(*composite_trapezoids) (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
@@ -983,6 +984,7 @@ typedef struct _cairo_traps {
#define CAIRO_GSTATE_OPERATOR_DEFAULT CAIRO_OPERATOR_OVER
#define CAIRO_GSTATE_TOLERANCE_DEFAULT 0.1
+#define CAIRO_GSTATE_SHAPE_FORMAT_DEFAULT CAIRO_FORMAT_A8
#define CAIRO_GSTATE_FILL_RULE_DEFAULT CAIRO_FILL_RULE_WINDING
#define CAIRO_GSTATE_LINE_WIDTH_DEFAULT 2.0
#define CAIRO_GSTATE_LINE_CAP_DEFAULT CAIRO_LINE_CAP_BUTT
@@ -1262,6 +1264,13 @@ _cairo_gstate_glyph_path (cairo_gstate_t
int num_glyphs,
cairo_path_fixed_t *path);
+cairo_private cairo_status_t
+_cairo_gstate_set_shape_resolution (cairo_gstate_t *gstate,
+ cairo_shape_resolution_t resolution);
+
+cairo_private cairo_shape_resolution_t
+_cairo_gstate_get_shape_resolution (cairo_gstate_t *gstate);
+
/* cairo_color.c */
cairo_private const cairo_color_t *
@@ -1552,6 +1561,7 @@ cairo_private cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
cairo_surface_t *dst,
+ cairo_format_t shape_format,
int src_x,
int src_y,
int dst_x,
-------------- next part --------------
Index: src/pixman.h
===================================================================
RCS file: /cvs/cairo/libpixman/src/pixman.h,v
retrieving revision 1.21
diff -p -u -r1.21 pixman.h
--- src/pixman.h 25 Jun 2005 01:21:16 -0000 1.21
+++ src/pixman.h 4 Aug 2005 04:53:55 -0000
@@ -410,6 +410,7 @@ void
pixman_composite_trapezoids (pixman_operator_t op,
pixman_image_t *src,
pixman_image_t *dst,
+ pixman_format_t *format,
int xSrc,
int ySrc,
const pixman_trapezoid_t *traps,
Index: src/ictrap.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/ictrap.c,v
retrieving revision 1.26
diff -p -u -r1.26 ictrap.c
--- src/ictrap.c 25 Jun 2005 03:13:19 -0000 1.26
+++ src/ictrap.c 4 Aug 2005 04:53:55 -0000
@@ -111,6 +111,7 @@ void
pixman_composite_trapezoids (pixman_operator_t op,
pixman_image_t *src,
pixman_image_t *dst,
+ pixman_format_t *format,
int xSrc,
int ySrc,
const pixman_trapezoid_t *traps,
@@ -121,7 +122,6 @@ pixman_composite_trapezoids (pixman_oper
pixman_region16_t *traps_region, *dst_region;
int16_t xDst, yDst;
int16_t xRel, yRel;
- pixman_format_t *format;
if (ntraps == 0)
return;
@@ -163,16 +163,11 @@ pixman_composite_trapezoids (pixman_oper
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
return;
- format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
- if (!format)
- return;
-
image = FbCreateAlphaPicture (dst, format,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
if (!image)
{
- pixman_format_destroy (format);
return;
}
@@ -191,8 +186,6 @@ pixman_composite_trapezoids (pixman_oper
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
pixman_image_destroy (image);
-
- pixman_format_destroy (format);
}
void
More information about the cairo
mailing list