[cairo-commit] cairo/src cairo-glitz-surface.c, 1.65,
1.66 cairo-gstate-private.h, 1.18, 1.19 cairo-gstate.c, 1.178,
1.179 cairo-meta-surface-private.h, 1.5,
1.6 cairo-meta-surface.c, 1.13, 1.14 cairo-path-stroke.c, 1.29,
1.30 cairo-pdf-surface.c, 1.66, 1.67 cairo-ps-surface.c, 1.56,
1.57 cairo-surface.c, 1.110, 1.111 cairo-win32-surface.c, 1.37,
1.38 cairo-xcb-surface.c, 1.51, 1.52 cairo-xlib-surface.c,
1.126, 1.127 cairoint.h, 1.222, 1.223
Carl Worth
commit at pdx.freedesktop.org
Fri Nov 4 11:16:42 PST 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv668/src
Modified Files:
cairo-glitz-surface.c cairo-gstate-private.h cairo-gstate.c
cairo-meta-surface-private.h cairo-meta-surface.c
cairo-path-stroke.c cairo-pdf-surface.c cairo-ps-surface.c
cairo-surface.c cairo-win32-surface.c cairo-xcb-surface.c
cairo-xlib-surface.c cairoint.h
Log Message:
2005-11-04 Carl Worth <cworth at cworth.org>
* src/cairoint.h: Rework support in the surface backend for the
five basic drawing operations (paint, mask, stroke, fill, and
show_glyphs). Now, all 5 operations have backend functions, and
all use a consistent convention for argument naming and
ordering. The old fill_path has been replaced with a new fill. The
old show_glyphs function was recently renamed to old_show_glyphs
and has not yet been ported to the new show_glyphs, (so all
backends have a NULL show_glyphs function). In fact, of the 5 new
backend functions, fill is the only one that has an implementation
in any backend. As part of this cleanup a new cairo_stroke_style_t
object is introduced to capture the many settings unique to the
stroke operation, (line_width, line_cap, line_join, miter_limit,
dash, num_dashes, and dash_offset).
* src/cairo-meta-surface-private.h:
* src/cairo-meta-surface.c: (_cairo_meta_surface_finish),
(_cairo_meta_surface_fill), (_cairo_meta_surface_replay):
* src/cairo-ps-surface.c: (_cairo_ps_surface_fill),
(_ps_output_fill):
* src/cairo-pdf-surface.c: (_cairo_pdf_surface_fill):
Track changes in surface backend from fill_path to fill.
* src/cairo-surface.c: (_fallback_paint), (_cairo_surface_paint),
(_fallback_mask), (_cairo_surface_mask), (_fallback_stroke),
(_cairo_surface_stroke), (_fallback_fill), (_cairo_surface_fill),
(_fallback_show_glyphs), (_cairo_surface_show_glyphs):
* src/cairo-gstate.c: (_cairo_gstate_init),
(_cairo_gstate_paint),
(_cairo_gstate_mask), (_cairo_gstate_stroke),
(_cairo_gstate_fill),
(_cairo_gstate_show_glyphs): Track the new canonical argument
naming and ordering for the 5 drawing operations.
* src/cairo-gstate-private.h:
* src/cairo-gstate.c: (_cairo_gstate_init),
(_cairo_gstate_init_copy), (_cairo_gstate_fini),
(_cairo_gstate_set_line_width), (_cairo_gstate_get_line_width),
(_cairo_gstate_set_line_cap), (_cairo_gstate_get_line_cap),
(_cairo_gstate_set_line_join), (_cairo_gstate_get_line_join),
(_cairo_gstate_set_dash), (_cairo_gstate_set_miter_limit),
(_cairo_gstate_get_miter_limit), (_cairo_gstate_stroke),
(_cairo_gstate_in_stroke), (_cairo_gstate_stroke_extents):
* src/cairo-path-stroke.c: (_cairo_stroker_start_dash),
(_cairo_stroker_step_dash), (_cairo_stroker_init),
(_cairo_stroker_join), (_cairo_stroker_add_cap), (_compute_face),
(_cairo_stroker_curve_to_dashed),
(_cairo_path_fixed_stroke_to_traps):
Move various stroke style settings into new cairo_stroke_style_t.
* src/cairo-glitz-surface.c:
* src/cairo-win32-surface.c:
* src/cairo-xcb-surface.c:
* src/cairo-xlib-surface.c:
Drop NULL fill_path backend function which no longer exists.
Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- cairo-glitz-surface.c 2 Nov 2005 00:40:37 -0000 1.65
+++ cairo-glitz-surface.c 4 Nov 2005 19:16:39 -0000 1.66
@@ -2128,7 +2128,6 @@
NULL, /* intersect_clip_path */
_cairo_glitz_surface_get_extents,
_cairo_glitz_surface_old_show_glyphs,
- NULL, /* fill_path */
NULL, /* get_font_options */
NULL, /* flush */
NULL, /* mark_dirty_rectangle */
Index: cairo-gstate-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate-private.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cairo-gstate-private.h 1 Nov 2005 00:55:21 -0000 1.18
+++ cairo-gstate-private.h 4 Nov 2005 19:16:39 -0000 1.19
@@ -44,18 +44,10 @@
double tolerance;
cairo_antialias_t antialias;
- /* stroke style */
- double line_width;
- cairo_line_cap_t line_cap;
- cairo_line_join_t line_join;
- double miter_limit;
+ cairo_stroke_style_t stroke_style;
cairo_fill_rule_t fill_rule;
- double *dash;
- int num_dashes;
- double dash_offset;
-
cairo_font_face_t *font_face;
cairo_scaled_font_t *scaled_font; /* Specific to the current CTM */
cairo_matrix_t font_matrix;
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- cairo-gstate.c 2 Nov 2005 00:40:37 -0000 1.178
+++ cairo-gstate.c 4 Nov 2005 19:16:39 -0000 1.179
@@ -90,17 +90,16 @@
gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
gstate->antialias = CAIRO_ANTIALIAS_DEFAULT;
- gstate->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
- gstate->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
- gstate->line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
- gstate->miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
+ gstate->stroke_style.line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
+ gstate->stroke_style.line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
+ gstate->stroke_style.line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
+ gstate->stroke_style.miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
+ gstate->stroke_style.dash = NULL;
+ gstate->stroke_style.num_dashes = 0;
+ gstate->stroke_style.dash_offset = 0.0;
gstate->fill_rule = CAIRO_GSTATE_FILL_RULE_DEFAULT;
- gstate->dash = NULL;
- gstate->num_dashes = 0;
- gstate->dash_offset = 0.0;
-
gstate->font_face = NULL;
gstate->scaled_font = NULL;
@@ -137,11 +136,12 @@
gstate->next = next;
/* Now fix up pointer data that needs to be cloned/referenced */
- if (other->dash) {
- gstate->dash = malloc (other->num_dashes * sizeof (double));
- if (gstate->dash == NULL)
+ if (other->stroke_style.dash) {
+ gstate->stroke_style.dash = malloc (other->stroke_style.num_dashes * sizeof (double));
+ if (gstate->stroke_style.dash == NULL)
return CAIRO_STATUS_NO_MEMORY;
- memcpy (gstate->dash, other->dash, other->num_dashes * sizeof (double));
+ memcpy (gstate->stroke_style.dash, other->stroke_style.dash,
+ other->stroke_style.num_dashes * sizeof (double));
}
_cairo_clip_init_copy (&gstate->clip, &other->clip);
@@ -177,9 +177,9 @@
cairo_pattern_destroy (gstate->source);
- if (gstate->dash) {
- free (gstate->dash);
- gstate->dash = NULL;
+ if (gstate->stroke_style.dash) {
+ free (gstate->stroke_style.dash);
+ gstate->stroke_style.dash = NULL;
}
}
@@ -366,7 +366,7 @@
cairo_status_t
_cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width)
{
- gstate->line_width = width;
+ gstate->stroke_style.line_width = width;
return CAIRO_STATUS_SUCCESS;
}
@@ -374,13 +374,13 @@
double
_cairo_gstate_get_line_width (cairo_gstate_t *gstate)
{
- return gstate->line_width;
+ return gstate->stroke_style.line_width;
}
cairo_status_t
_cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap)
{
- gstate->line_cap = line_cap;
+ gstate->stroke_style.line_cap = line_cap;
return CAIRO_STATUS_SUCCESS;
}
@@ -388,13 +388,13 @@
cairo_line_cap_t
_cairo_gstate_get_line_cap (cairo_gstate_t *gstate)
{
- return gstate->line_cap;
+ return gstate->stroke_style.line_cap;
}
cairo_status_t
_cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join)
{
- gstate->line_join = line_join;
+ gstate->stroke_style.line_join = line_join;
return CAIRO_STATUS_SUCCESS;
}
@@ -402,7 +402,7 @@
cairo_line_join_t
_cairo_gstate_get_line_join (cairo_gstate_t *gstate)
{
- return gstate->line_join;
+ return gstate->stroke_style.line_join;
}
cairo_status_t
@@ -411,30 +411,30 @@
int i;
double dash_total;
- if (gstate->dash)
- free (gstate->dash);
+ if (gstate->stroke_style.dash)
+ free (gstate->stroke_style.dash);
- gstate->num_dashes = num_dashes;
+ gstate->stroke_style.num_dashes = num_dashes;
- if (gstate->num_dashes == 0) {
- gstate->dash = NULL;
- gstate->dash_offset = 0.0;
+ if (gstate->stroke_style.num_dashes == 0) {
+ gstate->stroke_style.dash = NULL;
+ gstate->stroke_style.dash_offset = 0.0;
return CAIRO_STATUS_SUCCESS;
}
- gstate->dash = malloc (gstate->num_dashes * sizeof (double));
- if (gstate->dash == NULL) {
- gstate->num_dashes = 0;
+ gstate->stroke_style.dash = malloc (gstate->stroke_style.num_dashes * sizeof (double));
+ if (gstate->stroke_style.dash == NULL) {
+ gstate->stroke_style.num_dashes = 0;
return CAIRO_STATUS_NO_MEMORY;
}
- memcpy (gstate->dash, dash, gstate->num_dashes * sizeof (double));
+ memcpy (gstate->stroke_style.dash, dash, gstate->stroke_style.num_dashes * sizeof (double));
dash_total = 0.0;
- for (i = 0; i < gstate->num_dashes; i++) {
- if (gstate->dash[i] < 0)
+ for (i = 0; i < gstate->stroke_style.num_dashes; i++) {
+ if (gstate->stroke_style.dash[i] < 0)
return CAIRO_STATUS_INVALID_DASH;
- dash_total += gstate->dash[i];
+ dash_total += gstate->stroke_style.dash[i];
}
if (dash_total == 0.0)
@@ -442,7 +442,7 @@
/* A single dash value indicate symmetric repeating, so the total
* is twice as long. */
- if (gstate->num_dashes == 1)
+ if (gstate->stroke_style.num_dashes == 1)
dash_total *= 2;
/* The dashing code doesn't like a negative offset, so we compute
@@ -450,7 +450,7 @@
if (offset < 0)
offset += ceil (-offset / dash_total + 0.5) * dash_total;
- gstate->dash_offset = offset;
+ gstate->stroke_style.dash_offset = offset;
return CAIRO_STATUS_SUCCESS;
}
@@ -458,7 +458,7 @@
cairo_status_t
_cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit)
{
- gstate->miter_limit = limit;
+ gstate->stroke_style.miter_limit = limit;
return CAIRO_STATUS_SUCCESS;
}
@@ -466,7 +466,7 @@
double
_cairo_gstate_get_miter_limit (cairo_gstate_t *gstate)
{
- return gstate->miter_limit;
+ return gstate->stroke_style.miter_limit;
}
static void
@@ -718,9 +718,9 @@
_cairo_gstate_copy_transformed_source (gstate, &pattern.base);
- status = _cairo_surface_paint (gstate->operator,
- &pattern.base,
- gstate->target);
+ status = _cairo_surface_paint (gstate->target,
+ gstate->operator,
+ &pattern.base);
_cairo_pattern_fini (&pattern.base);
@@ -1120,10 +1120,10 @@
_cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
_cairo_gstate_copy_transformed_mask (gstate, &mask_pattern.base, mask);
- status = _cairo_surface_mask (gstate->operator,
+ status = _cairo_surface_mask (gstate->target,
+ gstate->operator,
&source_pattern.base,
- &mask_pattern.base,
- gstate->target);
+ &mask_pattern.base);
_cairo_pattern_fini (&source_pattern.base);
_cairo_pattern_fini (&mask_pattern.base);
@@ -1140,7 +1140,7 @@
if (gstate->source->status)
return gstate->source->status;
- if (gstate->line_width <= 0.0)
+ if (gstate->stroke_style.line_width <= 0.0)
return CAIRO_STATUS_SUCCESS;
status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
@@ -1149,23 +1149,15 @@
_cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
- status = _cairo_surface_stroke (gstate->operator,
+ status = _cairo_surface_stroke (gstate->target,
+ gstate->operator,
&source_pattern.base,
- gstate->target,
path,
- gstate->tolerance,
+ &gstate->stroke_style,
&gstate->ctm,
&gstate->ctm_inverse,
- gstate->antialias,
-
- gstate->line_width,
- gstate->line_cap,
- gstate->line_join,
- gstate->miter_limit,
-
- gstate->dash,
- gstate->num_dashes,
- gstate->dash_offset);
+ gstate->tolerance,
+ gstate->antialias);
return status;
@@ -1185,19 +1177,12 @@
_cairo_traps_init (&traps);
- status = _cairo_path_fixed_stroke_to_traps (path, &traps,
- gstate->tolerance,
+ status = _cairo_path_fixed_stroke_to_traps (path,
+ &gstate->stroke_style,
&gstate->ctm,
&gstate->ctm_inverse,
-
- gstate->line_width,
- gstate->line_cap,
- gstate->line_join,
- gstate->miter_limit,
-
- gstate->dash,
- gstate->num_dashes,
- gstate->dash_offset);
+ gstate->tolerance,
+ &traps);
if (status)
goto BAIL;
@@ -1508,14 +1493,13 @@
_cairo_gstate_copy_transformed_source (gstate, &pattern.base);
- status = _cairo_surface_fill_path (gstate->operator,
- &pattern.base,
- gstate->target,
- path,
- gstate->fill_rule,
- gstate->tolerance,
- &gstate->clip,
- gstate->antialias);
+ status = _cairo_surface_fill (gstate->target,
+ gstate->operator,
+ &pattern.base,
+ path,
+ gstate->fill_rule,
+ gstate->tolerance,
+ gstate->antialias);
return status;
}
@@ -1573,19 +1557,12 @@
_cairo_traps_init (&traps);
- status = _cairo_path_fixed_stroke_to_traps (path, &traps,
- gstate->tolerance,
+ status = _cairo_path_fixed_stroke_to_traps (path,
+ &gstate->stroke_style,
&gstate->ctm,
&gstate->ctm_inverse,
-
- gstate->line_width,
- gstate->line_cap,
- gstate->line_join,
- gstate->miter_limit,
-
- gstate->dash,
- gstate->num_dashes,
- gstate->dash_offset);
+ gstate->tolerance,
+ &traps);
if (status)
goto BAIL;
@@ -1971,12 +1948,12 @@
_cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
- status = _cairo_surface_show_glyphs (gstate->operator,
+ status = _cairo_surface_show_glyphs (gstate->target,
+ gstate->operator,
&source_pattern.base,
- gstate->target,
- gstate->scaled_font,
transformed_glyphs,
- num_glyphs);
+ num_glyphs,
+ gstate->scaled_font);
_cairo_pattern_fini (&source_pattern.base);
free (transformed_glyphs);
Index: cairo-meta-surface-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface-private.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo-meta-surface-private.h 13 Oct 2005 23:55:14 -0000 1.5
+++ cairo-meta-surface-private.h 4 Nov 2005 19:16:39 -0000 1.6
@@ -46,7 +46,7 @@
CAIRO_COMMAND_SET_CLIP_REGION,
CAIRO_COMMAND_INTERSECT_CLIP_PATH,
CAIRO_COMMAND_SHOW_GLYPHS,
- CAIRO_COMMAND_FILL_PATH
+ CAIRO_COMMAND_FILL
} cairo_command_type_t;
typedef struct _cairo_command_composite {
@@ -118,7 +118,7 @@
int num_glyphs;
} cairo_command_show_glyphs_t;
-typedef struct _cairo_command_fill_path {
+typedef struct _cairo_command_fill {
cairo_command_type_t type;
cairo_operator_t operator;
cairo_pattern_union_t pattern;
@@ -126,7 +126,7 @@
cairo_fill_rule_t fill_rule;
double tolerance;
cairo_antialias_t antialias;
-} cairo_command_fill_path_t;
+} cairo_command_fill_t;
typedef union _cairo_command {
cairo_command_type_t type;
@@ -136,7 +136,7 @@
cairo_command_set_clip_region_t set_clip_region;
cairo_command_intersect_clip_path_t intersect_clip_path;
cairo_command_show_glyphs_t show_glyphs;
- cairo_command_fill_path_t fill_path;
+ cairo_command_fill_t fill;
} cairo_command_t;
typedef struct _cairo_meta_surface {
Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cairo-meta-surface.c 2 Nov 2005 00:40:37 -0000 1.13
+++ cairo-meta-surface.c 4 Nov 2005 19:16:39 -0000 1.14
@@ -111,9 +111,9 @@
free (command);
break;
- case CAIRO_COMMAND_FILL_PATH:
- _cairo_pattern_fini (&command->fill_path.pattern.base);
- _cairo_path_fixed_fini (&command->fill_path.path);
+ case CAIRO_COMMAND_FILL:
+ _cairo_pattern_fini (&command->fill.pattern.base);
+ _cairo_path_fixed_fini (&command->fill.path);
free (command);
break;
@@ -401,23 +401,23 @@
}
static cairo_int_status_t
-_cairo_meta_surface_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_surface,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias)
+_cairo_meta_surface_fill (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias)
{
cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_fill_path_t *command;
+ cairo_command_fill_t *command;
cairo_status_t status;
- command = malloc (sizeof (cairo_command_fill_path_t));
+ command = malloc (sizeof (cairo_command_fill_t));
if (command == NULL)
return CAIRO_STATUS_NO_MEMORY;
- command->type = CAIRO_COMMAND_FILL_PATH;
+ command->type = CAIRO_COMMAND_FILL;
command->operator = operator;
_init_pattern_with_snapshot (&command->pattern.base, pattern);
status = _cairo_path_fixed_init_copy (&command->path, path);
@@ -471,7 +471,21 @@
_cairo_meta_surface_intersect_clip_path,
_cairo_meta_surface_get_extents,
_cairo_meta_surface_old_show_glyphs,
- _cairo_meta_surface_fill_path,
+ NULL, /* get_font_options */
+ NULL, /* flush */
+ NULL, /* mark_dirty_rectangle */
+ NULL, /* scaled_font_fini */
+ NULL, /* scaled_glyph_fini */
+
+ /* Here are the drawing functions, (which are in some sense the
+ * only things that cairo_meta_surface should need to
+ * implement). */
+
+ NULL, /* paint */
+ NULL, /* mask */
+ NULL, /* stroke */
+ _cairo_meta_surface_fill,
+ NULL /* show_glyphs */
};
cairo_int_status_t
@@ -599,39 +613,38 @@
break;
- case CAIRO_COMMAND_FILL_PATH:
+ case CAIRO_COMMAND_FILL:
status = _cairo_surface_set_clip (target, &clip);
if (status)
break;
- status = _cairo_surface_fill_path (command->fill_path.operator,
- &command->fill_path.pattern.base,
- target,
- &command->fill_path.path,
- command->fill_path.fill_rule,
- command->fill_path.tolerance,
- &clip,
- command->fill_path.antialias);
+ status = _cairo_surface_fill (target,
+ command->fill.operator,
+ &command->fill.pattern.base,
+ &command->fill.path,
+ command->fill.fill_rule,
+ command->fill.tolerance,
+ command->fill.antialias);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
break;
_cairo_traps_init (&traps);
- status = _cairo_path_fixed_fill_to_traps (&command->fill_path.path,
- command->fill_path.fill_rule,
- command->fill_path.tolerance,
+ status = _cairo_path_fixed_fill_to_traps (&command->fill.path,
+ command->fill.fill_rule,
+ command->fill.tolerance,
&traps);
if (status) {
_cairo_traps_fini (&traps);
break;
}
- status = _cairo_surface_clip_and_composite_trapezoids (&command->fill_path.pattern.base,
- command->fill_path.operator,
+ status = _cairo_surface_clip_and_composite_trapezoids (&command->fill.pattern.base,
+ command->fill.operator,
target,
&traps,
&clip,
- command->fill_path.antialias);
+ command->fill.antialias);
_cairo_traps_fini (&traps);
break;
Index: cairo-path-stroke.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-path-stroke.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cairo-path-stroke.c 1 Nov 2005 00:55:21 -0000 1.29
+++ cairo-path-stroke.c 4 Nov 2005 19:16:39 -0000 1.30
@@ -37,24 +37,15 @@
#include "cairoint.h"
typedef struct cairo_stroker {
- cairo_traps_t *traps;
-
- cairo_pen_t pen;
+ cairo_stroke_style_t *style;
cairo_matrix_t *ctm;
cairo_matrix_t *ctm_inverse;
double tolerance;
- /* stroke style */
- double line_width;
- cairo_line_cap_t line_cap;
- cairo_line_join_t line_join;
- double miter_limit;
-
- /* dash style */
- double *dash;
- int num_dashes;
- double dash_offset;
+ cairo_traps_t *traps;
+
+ cairo_pen_t pen;
cairo_bool_t has_current_point;
cairo_point_t current_point;
@@ -74,21 +65,12 @@
/* private functions */
static void
-_cairo_stroker_init (cairo_stroker_t *stroker,
- cairo_traps_t *traps,
-
- double tolerance,
- cairo_matrix_t *ctm,
- cairo_matrix_t *ctm_inverse,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset);
+_cairo_stroker_init (cairo_stroker_t *stroker,
+ cairo_stroke_style_t *stroke_style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_traps_t *traps);
static void
_cairo_stroker_fini (cairo_stroker_t *stroker);
@@ -133,17 +115,17 @@
int on = 1;
int i = 0;
- offset = stroker->dash_offset;
- while (offset >= stroker->dash[i]) {
- offset -= stroker->dash[i];
+ offset = stroker->style->dash_offset;
+ while (offset >= stroker->style->dash[i]) {
+ offset -= stroker->style->dash[i];
on = 1-on;
- if (++i == stroker->num_dashes)
+ if (++i == stroker->style->num_dashes)
i = 0;
}
stroker->dashed = TRUE;
stroker->dash_index = i;
stroker->dash_on = on;
- stroker->dash_remain = stroker->dash[i] - offset;
+ stroker->dash_remain = stroker->style->dash[i] - offset;
}
static void
@@ -152,52 +134,36 @@
stroker->dash_remain -= step;
if (stroker->dash_remain <= 0) {
stroker->dash_index++;
- if (stroker->dash_index == stroker->num_dashes)
+ if (stroker->dash_index == stroker->style->num_dashes)
stroker->dash_index = 0;
stroker->dash_on = 1-stroker->dash_on;
- stroker->dash_remain = stroker->dash[stroker->dash_index];
+ stroker->dash_remain = stroker->style->dash[stroker->dash_index];
}
}
static void
-_cairo_stroker_init (cairo_stroker_t *stroker,
- cairo_traps_t *traps,
-
- double tolerance,
- cairo_matrix_t *ctm,
- cairo_matrix_t *ctm_inverse,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset)
+_cairo_stroker_init (cairo_stroker_t *stroker,
+ cairo_stroke_style_t *stroke_style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_traps_t *traps)
{
- stroker->traps = traps;
-
- _cairo_pen_init (&stroker->pen, line_width / 2.0, tolerance, ctm);
-
- stroker->tolerance = tolerance;
+ stroker->style = stroke_style;
stroker->ctm = ctm;
stroker->ctm_inverse = ctm_inverse;
+ stroker->tolerance = tolerance;
+ stroker->traps = traps;
- stroker->line_width = line_width;
- stroker->line_cap = line_cap;
- stroker->line_join = line_join;
- stroker->miter_limit = miter_limit;
-
- stroker->dash = dash;
- stroker->num_dashes = num_dashes;
- stroker->dash_offset = dash_offset;
+ _cairo_pen_init (&stroker->pen,
+ stroke_style->line_width / 2.0,
+ tolerance, ctm);
stroker->has_current_point = FALSE;
stroker->has_current_face = FALSE;
stroker->has_first_face = FALSE;
- if (stroker->dash)
+ if (stroker->style->dash)
_cairo_stroker_start_dash (stroker);
else
stroker->dashed = FALSE;
@@ -249,7 +215,7 @@
outpt = &out->cw;
}
- switch (stroker->line_join) {
+ switch (stroker->style->line_join) {
case CAIRO_LINE_JOIN_ROUND: {
int i;
int start, step, stop;
@@ -290,7 +256,7 @@
/* dot product of incoming slope vector with outgoing slope vector */
double in_dot_out = ((-in->usr_vector.x * out->usr_vector.x)+
(-in->usr_vector.y * out->usr_vector.y));
- double ml = stroker->miter_limit;
+ double ml = stroker->style->miter_limit;
/*
* Check the miter limit -- lines meeting at an acute angle
@@ -398,10 +364,10 @@
{
cairo_status_t status;
- if (stroker->line_cap == CAIRO_LINE_CAP_BUTT)
+ if (stroker->style->line_cap == CAIRO_LINE_CAP_BUTT)
return CAIRO_STATUS_SUCCESS;
- switch (stroker->line_cap) {
+ switch (stroker->style->line_cap) {
case CAIRO_LINE_CAP_ROUND: {
int i;
int start, stop;
@@ -435,8 +401,8 @@
dx = f->usr_vector.x;
dy = f->usr_vector.y;
- dx *= stroker->line_width / 2.0;
- dy *= stroker->line_width / 2.0;
+ dx *= stroker->style->line_width / 2.0;
+ dy *= stroker->style->line_width / 2.0;
cairo_matrix_transform_distance (stroker->ctm, &dx, &dy);
fvector.dx = _cairo_fixed_from_double (dx);
fvector.dy = _cairo_fixed_from_double (dy);
@@ -549,13 +515,13 @@
_cairo_matrix_compute_determinant (stroker->ctm, &det);
if (det >= 0)
{
- face_dx = - line_dy * (stroker->line_width / 2.0);
- face_dy = line_dx * (stroker->line_width / 2.0);
+ face_dx = - line_dy * (stroker->style->line_width / 2.0);
+ face_dy = line_dx * (stroker->style->line_width / 2.0);
}
else
{
- face_dx = line_dy * (stroker->line_width / 2.0);
- face_dy = - line_dx * (stroker->line_width / 2.0);
+ face_dx = line_dy * (stroker->style->line_width / 2.0);
+ face_dy = - line_dx * (stroker->style->line_width / 2.0);
}
/* back to device space */
@@ -917,8 +883,8 @@
/* Temporarily modify the stroker to use round joins to guarantee
* smooth stroked curves. */
- line_join_save = stroker->line_join;
- stroker->line_join = CAIRO_LINE_JOIN_ROUND;
+ line_join_save = stroker->style->line_join;
+ stroker->style->line_join = CAIRO_LINE_JOIN_ROUND;
status = _cairo_spline_decompose (&spline, stroker->tolerance);
if (status)
@@ -934,7 +900,7 @@
}
CLEANUP_GSTATE:
- stroker->line_join = line_join_save;
+ stroker->style->line_join = line_join_save;
CLEANUP_SPLINE:
_cairo_spline_fini (&spline);
@@ -972,28 +938,20 @@
cairo_status_t
_cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path,
- cairo_traps_t *traps,
- double tolerance,
+ cairo_stroke_style_t *stroke_style,
cairo_matrix_t *ctm,
cairo_matrix_t *ctm_inverse,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset)
+ double tolerance,
+ cairo_traps_t *traps)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_stroker_t stroker;
- _cairo_stroker_init (&stroker, traps, tolerance, ctm, ctm_inverse,
- line_width, line_cap, line_join, miter_limit,
- dash, num_dashes, dash_offset);
+ _cairo_stroker_init (&stroker, stroke_style,
+ ctm, ctm_inverse, tolerance,
+ traps);
- if (stroker.dash)
+ if (stroker.style->dash)
status = _cairo_path_fixed_interpret (path,
CAIRO_DIRECTION_FORWARD,
_cairo_stroker_move_to,
Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- cairo-pdf-surface.c 2 Nov 2005 00:40:37 -0000 1.66
+++ cairo-pdf-surface.c 4 Nov 2005 19:16:39 -0000 1.67
@@ -1240,15 +1240,15 @@
}
static cairo_int_status_t
-_cairo_pdf_surface_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias)
+_cairo_pdf_surface_fill (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias)
{
- cairo_pdf_surface_t *surface = abstract_dst;
+ cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_document_t *document = surface->document;
const char *pdf_operator;
cairo_status_t status;
@@ -1574,8 +1574,19 @@
_cairo_pdf_surface_intersect_clip_path,
_cairo_pdf_surface_get_extents,
_cairo_pdf_surface_old_show_glyphs,
- _cairo_pdf_surface_fill_path,
- _cairo_pdf_surface_get_font_options
+ _cairo_pdf_surface_get_font_options,
+ NULL, /* flush */
+ NULL, /* mark_dirty_rectangle */
+ NULL, /* scaled_font_fini */
+ NULL, /* scaled_glyph_fini */
+
+ /* Here are the drawing functions */
+
+ NULL, /* paint */
+ NULL, /* mask */
+ NULL, /* stroke */
+ _cairo_pdf_surface_fill,
+ NULL /* show_glyphs */
};
static cairo_pdf_document_t *
Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- cairo-ps-surface.c 2 Nov 2005 00:40:37 -0000 1.56
+++ cairo-ps-surface.c 4 Nov 2005 19:16:39 -0000 1.57
@@ -463,36 +463,25 @@
}
static cairo_int_status_t
-_cairo_ps_surface_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias)
+_cairo_ps_surface_fill (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias)
{
- cairo_ps_surface_t *surface = abstract_dst;
+ cairo_ps_surface_t *surface = abstract_surface;
- /* XXX: This is rather fragile here. We want to call back up into
- * cairo-surface in order for it to farm things out to the
- * appropriate backend fill_path function. But that requires
- * having a clip parameter. We take advantage of the fact that we
- * "know" that the clip is only used for fallbacks and we "know"
- * that the meta surface backend never uses a fallback for
- * fill_path.
- *
- * Clearly there's an organizational problem here.
- */
assert (_cairo_surface_is_meta (surface->current_page));
- return _cairo_surface_fill_path (operator,
- pattern,
- surface->current_page,
- path,
- fill_rule,
- tolerance,
- NULL, /* See comment above. */
- antialias);
+ return _cairo_surface_fill (surface->current_page,
+ operator,
+ pattern,
+ path,
+ fill_rule,
+ tolerance,
+ antialias);
}
static const cairo_surface_backend_t cairo_ps_surface_backend = {
@@ -512,7 +501,19 @@
_cairo_ps_surface_intersect_clip_path,
_cairo_ps_surface_get_extents,
_cairo_ps_surface_old_show_glyphs,
- _cairo_ps_surface_fill_path
+ NULL, /* get_font_options */
+ NULL, /* flush */
+ NULL, /* mark_dirty_rectangle */
+ NULL, /* scaled_font_fini */
+ NULL, /* scaled_glyph_fini */
+
+ /* Here are the drawing functions */
+
+ NULL, /* paint */
+ NULL, /* mask */
+ NULL, /* stroke */
+ _cairo_ps_surface_fill,
+ NULL /* show_glyphs */
};
static cairo_int_status_t
@@ -1374,15 +1375,15 @@
}
static cairo_int_status_t
-_ps_output_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias)
+_ps_output_fill (void *abstract_surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias)
{
- ps_output_surface_t *surface = abstract_dst;
+ ps_output_surface_t *surface = abstract_surface;
cairo_output_stream_t *stream = surface->parent->stream;
cairo_int_status_t status;
ps_output_path_info_t info;
@@ -1394,7 +1395,7 @@
surface->parent->width,
surface->parent->height);
_cairo_output_stream_printf (stream,
- "%% _ps_output_fill_path\n");
+ "%% _ps_output_fill\n");
emit_pattern (surface->parent, pattern);
@@ -1443,7 +1444,19 @@
_ps_output_intersect_clip_path,
NULL, /* get_extents */
_ps_output_old_show_glyphs,
- _ps_output_fill_path
+ NULL, /* get_font_options */
+ NULL, /* flush */
+ NULL, /* mark_dirty_rectangle */
+ NULL, /* scaled_font_fini */
+ NULL, /* scaled_glyph_fini */
+
+ /* Here are the drawing functions */
+
+ NULL, /* paint */
+ NULL, /* mask */
+ NULL, /* stroke */
+ _ps_output_fill,
+ NULL /* show_glyphs */
};
static cairo_int_status_t
Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- cairo-surface.c 2 Nov 2005 00:40:37 -0000 1.110
+++ cairo-surface.c 4 Nov 2005 19:16:39 -0000 1.111
@@ -1144,29 +1144,29 @@
}
static cairo_status_t
-_fallback_paint (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst)
+_fallback_paint (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source)
{
cairo_status_t status;
cairo_rectangle_t extents;
cairo_box_t box;
cairo_traps_t traps;
- status = _cairo_surface_get_extents (dst, &extents);
+ status = _cairo_surface_get_extents (surface, &extents);
if (status)
return status;
if (_cairo_operator_bounded_by_source (operator)) {
cairo_rectangle_t source_extents;
- status = _cairo_pattern_get_extents (source_pattern, &source_extents);
+ status = _cairo_pattern_get_extents (source, &source_extents);
if (status)
return status;
_cairo_rectangle_intersect (&extents, &source_extents);
}
- status = _cairo_clip_intersect_to_rectangle (dst->clip, &extents);
+ status = _cairo_clip_intersect_to_rectangle (surface->clip, &extents);
if (status)
return status;
@@ -1179,11 +1179,11 @@
if (status)
return status;
- _cairo_surface_clip_and_composite_trapezoids (source_pattern,
+ _cairo_surface_clip_and_composite_trapezoids (source,
operator,
- dst,
+ surface,
&traps,
- dst->clip,
+ surface->clip,
CAIRO_ANTIALIAS_NONE);
_cairo_traps_fini (&traps);
@@ -1192,23 +1192,21 @@
}
cairo_status_t
-_cairo_surface_paint (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *dst)
+_cairo_surface_paint (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source)
{
- /* cairo_status_t status; */
+ cairo_status_t status;
- assert (! dst->is_snapshot);
+ assert (! surface->is_snapshot);
- /* XXX: Need to add this to the backend.
- if (dst->backend->paint) {
- status = dst->backend->paint (operator, pattern, dst);
+ if (surface->backend->paint) {
+ status = surface->backend->paint (surface, operator, source);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
}
- */
- return _fallback_paint (operator, pattern, dst);
+ return _fallback_paint (surface, operator, source);
}
static cairo_status_t
@@ -1239,20 +1237,20 @@
}
static cairo_status_t
-_fallback_mask (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_pattern_t *mask_pattern,
- cairo_surface_t *dst)
+_fallback_mask (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_pattern_t *mask)
{
cairo_status_t status;
cairo_rectangle_t extents, source_extents, mask_extents;
- status = _cairo_surface_get_extents (dst, &extents);
+ status = _cairo_surface_get_extents (surface, &extents);
if (status)
return status;
if (_cairo_operator_bounded_by_source (operator)) {
- status = _cairo_pattern_get_extents (source_pattern, &source_extents);
+ status = _cairo_pattern_get_extents (source, &source_extents);
if (status)
return status;
@@ -1260,89 +1258,77 @@
}
if (_cairo_operator_bounded_by_mask (operator)) {
- status = _cairo_pattern_get_extents (mask_pattern, &mask_extents);
+ status = _cairo_pattern_get_extents (mask, &mask_extents);
if (status)
return status;
_cairo_rectangle_intersect (&extents, &mask_extents);
}
- status = _cairo_clip_intersect_to_rectangle (dst->clip, &extents);
+ status = _cairo_clip_intersect_to_rectangle (surface->clip, &extents);
if (status)
return status;
- status = _cairo_gstate_clip_and_composite (dst->clip, operator,
- source_pattern,
+ status = _cairo_gstate_clip_and_composite (surface->clip, operator,
+ source,
_cairo_surface_mask_draw_func,
- mask_pattern,
- dst,
+ mask,
+ surface,
&extents);
return status;
}
cairo_status_t
-_cairo_surface_mask (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_pattern_t *mask_pattern,
- cairo_surface_t *dst)
+_cairo_surface_mask (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_pattern_t *mask)
{
- /* cairo_status_t status; */
+ cairo_status_t status;
- assert (! dst->is_snapshot);
+ assert (! surface->is_snapshot);
- /* XXX: Need to add this to the backend.
- if (dst->backend->mask) {
- status = dst->backend->mask (operator, pattern, dst);
+ if (surface->backend->mask) {
+ status = surface->backend->mask (surface, operator, source, mask);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
}
- */
- return _fallback_mask (operator, source_pattern, mask_pattern, dst);
+ return _fallback_mask (surface, operator, source, mask);
}
static cairo_status_t
-_fallback_stroke (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst,
+_fallback_stroke (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
cairo_path_fixed_t *path,
- double tolerance,
+ cairo_stroke_style_t *stroke_style,
cairo_matrix_t *ctm,
cairo_matrix_t *ctm_inverse,
- cairo_antialias_t antialias,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset)
+ double tolerance,
+ cairo_antialias_t antialias)
{
cairo_status_t status;
cairo_traps_t traps;
_cairo_traps_init (&traps);
- status = _cairo_path_fixed_stroke_to_traps (path, &traps, tolerance,
+ status = _cairo_path_fixed_stroke_to_traps (path,
+ stroke_style,
ctm, ctm_inverse,
- line_width, line_cap,
- line_join, miter_limit,
- dash, num_dashes,
- dash_offset);
-
+ tolerance,
+ &traps);
if (status) {
_cairo_traps_fini (&traps);
return status;
}
- _cairo_surface_clip_and_composite_trapezoids (source_pattern,
+ _cairo_surface_clip_and_composite_trapezoids (source,
operator,
- dst,
+ surface,
&traps,
- dst->clip,
+ surface->clip,
antialias);
_cairo_traps_fini (&traps);
@@ -1351,54 +1337,42 @@
}
cairo_status_t
-_cairo_surface_stroke (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst,
- cairo_path_fixed_t *path,
- double tolerance,
- cairo_matrix_t *ctm,
- cairo_matrix_t *ctm_inverse,
- cairo_antialias_t antialias,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset)
+_cairo_surface_stroke (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_stroke_style_t *stroke_style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias)
{
- assert (! dst->is_snapshot);
+ assert (! surface->is_snapshot);
- /* XXX: Need to add this to the backend.
- if (dst->backend->stroke) {
+ if (surface->backend->stroke) {
cairo_status_t status;
- status = dst->backend->stroke (operator, source_pattern, dst, path,
- tolerance, ctm, ctm_inverse, antialias,
- line_width, line_cap,
- line_join, miter_limit,
- dash, num_dashes, dash_offset);
+ status = surface->backend->stroke (surface, operator, source,
+ path, stroke_style,
+ ctm, ctm_inverse,
+ tolerance, antialias);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
}
- */
- return _fallback_stroke (operator, source_pattern, dst, path,
- tolerance, ctm, ctm_inverse, antialias,
- line_width, line_cap, line_join, miter_limit,
- dash, num_dashes, dash_offset);
+ return _fallback_stroke (surface, operator, source,
+ path, stroke_style,
+ ctm, ctm_inverse,
+ tolerance, antialias);
}
static cairo_status_t
-_fallback_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_clip_t *clip,
- cairo_antialias_t antialias)
+_fallback_fill (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias)
{
cairo_status_t status;
cairo_traps_t traps;
@@ -1414,11 +1388,11 @@
return status;
}
- status = _cairo_surface_clip_and_composite_trapezoids (pattern,
+ status = _cairo_surface_clip_and_composite_trapezoids (source,
operator,
- dst,
+ surface,
&traps,
- clip,
+ surface->clip,
antialias);
_cairo_traps_fini (&traps);
@@ -1427,28 +1401,29 @@
}
cairo_status_t
-_cairo_surface_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_clip_t *clip,
- cairo_antialias_t antialias)
+_cairo_surface_fill (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias)
{
cairo_status_t status;
- assert (! dst->is_snapshot);
+ assert (! surface->is_snapshot);
- if (dst->backend->fill_path) {
- status = dst->backend->fill_path (operator, pattern, dst, path,
- fill_rule, tolerance, antialias);
+ if (surface->backend->fill) {
+ status = surface->backend->fill (surface, operator, source,
+ path, fill_rule,
+ tolerance, antialias);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
}
- return _fallback_fill_path (operator, pattern, dst, path,
- fill_rule, tolerance, clip, antialias);
+ return _fallback_fill (surface, operator, source,
+ path, fill_rule,
+ tolerance, antialias);
}
static cairo_status_t
@@ -1915,18 +1890,18 @@
}
static cairo_status_t
-_fallback_show_glyphs (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst,
- cairo_scaled_font_t *scaled_font,
+_fallback_show_glyphs (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
cairo_glyph_t *glyphs,
- int num_glyphs)
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font)
{
cairo_status_t status;
cairo_rectangle_t extents, glyph_extents;
cairo_show_glyphs_info_t glyph_info;
- status = _cairo_surface_get_extents (dst, &extents);
+ status = _cairo_surface_get_extents (surface, &extents);
if (status)
return status;
@@ -1941,7 +1916,7 @@
_cairo_rectangle_intersect (&extents, &glyph_extents);
}
- status = _cairo_clip_intersect_to_rectangle (dst->clip, &extents);
+ status = _cairo_clip_intersect_to_rectangle (surface->clip, &extents);
if (status)
return status;
@@ -1949,42 +1924,40 @@
glyph_info.glyphs = glyphs;
glyph_info.num_glyphs = num_glyphs;
- status = _cairo_gstate_clip_and_composite (dst->clip,
+ status = _cairo_gstate_clip_and_composite (surface->clip,
operator,
- source_pattern,
+ source,
_cairo_surface_old_show_glyphs_draw_func,
&glyph_info,
- dst,
+ surface,
&extents);
return status;
}
cairo_status_t
-_cairo_surface_show_glyphs (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst,
- cairo_scaled_font_t *scaled_font,
+_cairo_surface_show_glyphs (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
cairo_glyph_t *glyphs,
- int num_glyphs)
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font)
{
- /* cairo_status_t status; */
+ cairo_status_t status;
- assert (! dst->is_snapshot);
+ assert (! surface->is_snapshot);
- /* XXX: Need to add this to the backend.
- if (dst->backend->show_glyphs) {
- status = dst->backend->show_glyphs (operator, source_pattern, dst,
- scaled_font,
- glyphs, num_glyphs);
+ if (surface->backend->show_glyphs) {
+ status = surface->backend->show_glyphs (surface, operator, source,
+ glyphs, num_glyphs,
+ scaled_font);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
}
- */
- return _fallback_show_glyphs (operator, source_pattern, dst,
- scaled_font,
- glyphs, num_glyphs);
+ return _fallback_show_glyphs (surface, operator, source,
+ glyphs, num_glyphs,
+ scaled_font);
}
/* XXX: Previously, we had a function named _cairo_surface_show_glyphs
Index: cairo-win32-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-surface.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- cairo-win32-surface.c 2 Nov 2005 00:40:37 -0000 1.37
+++ cairo-win32-surface.c 4 Nov 2005 19:16:40 -0000 1.38
@@ -1046,7 +1046,6 @@
NULL, /* intersect_clip_path */
_cairo_win32_surface_get_extents,
NULL, /* old_show_glyphs */
- NULL, /* fill_path */
NULL, /* get_font_options */
_cairo_win32_surface_flush,
NULL /* mark_dirty_rectangle */
Index: cairo-xcb-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xcb-surface.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- cairo-xcb-surface.c 2 Nov 2005 00:40:37 -0000 1.51
+++ cairo-xcb-surface.c 4 Nov 2005 19:16:40 -0000 1.52
@@ -1041,7 +1041,6 @@
NULL, /* intersect_clip_path */
_cairo_xcb_surface_get_extents,
NULL, /* old_show_glyphs */
- NULL, /* fill_path */
NULL, /* get_font_options */
NULL, /* flush */
NULL, /* mark_dirty_rectangle */
Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- cairo-xlib-surface.c 2 Nov 2005 00:40:37 -0000 1.126
+++ cairo-xlib-surface.c 4 Nov 2005 19:16:40 -0000 1.127
@@ -1691,7 +1691,6 @@
NULL, /* intersect_clip_path */
_cairo_xlib_surface_get_extents,
_cairo_xlib_surface_old_show_glyphs,
- NULL, /* fill_path */
_cairo_xlib_surface_get_font_options,
NULL, /* flush */
NULL, /* mark_dirty_rectangle */
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -d -r1.222 -r1.223
--- cairoint.h 2 Nov 2005 00:40:37 -0000 1.222
+++ cairoint.h 4 Nov 2005 19:16:40 -0000 1.223
@@ -556,6 +556,16 @@
#endif
+typedef struct _cairo_stroke_style {
+ double line_width;
+ cairo_line_cap_t line_cap;
+ cairo_line_join_t line_join;
+ double miter_limit;
+ double *dash;
+ int num_dashes;
+ double dash_offset;
+} cairo_stroke_style_t;
+
struct _cairo_surface_backend {
cairo_surface_t *
(*create_similar) (void *surface,
@@ -709,15 +719,6 @@
const cairo_glyph_t *glyphs,
int num_glyphs);
- cairo_int_status_t
- (*fill_path) (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias);
-
void
(*get_font_options) (void *surface,
cairo_font_options_t *options);
@@ -738,6 +739,48 @@
void
(*scaled_glyph_fini) (cairo_scaled_glyph_t *scaled_glyph,
cairo_scaled_font_t *scaled_font);
+
+ /* OK, I'm starting over somewhat by defining the 5 top-level
+ * drawing operators for the surface backend here with consistent
+ * naming and argument-order convensions. */
+ cairo_int_status_t
+ (*paint) (void *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source);
+
+ cairo_int_status_t
+ (*mask) (void *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_pattern_t *mask);
+
+ cairo_int_status_t
+ (*stroke) (void *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_stroke_style_t *stroke_style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias);
+
+ cairo_int_status_t
+ (*fill) (void *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias);
+
+ cairo_int_status_t
+ (*show_glyphs) (void *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font);
};
typedef struct _cairo_format_masks {
@@ -1420,19 +1463,11 @@
/* cairo_path_stroke.c */
cairo_private cairo_status_t
_cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path,
- cairo_traps_t *traps,
- double tolerance,
+ cairo_stroke_style_t *stroke_style,
cairo_matrix_t *ctm,
cairo_matrix_t *ctm_inverse,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset);
+ double tolerance,
+ cairo_traps_t *traps);
/* cairo-scaled-font.c */
@@ -1582,52 +1617,43 @@
int num_rects);
cairo_private cairo_status_t
-_cairo_surface_paint (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *dst);
+_cairo_surface_paint (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source);
cairo_private cairo_status_t
-_cairo_surface_mask (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_pattern_t *mask_pattern,
- cairo_surface_t *dst);
+_cairo_surface_mask (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_pattern_t *mask);
cairo_private cairo_status_t
-_cairo_surface_stroke (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst,
- cairo_path_fixed_t *path,
- double tolerance,
- cairo_matrix_t *ctm,
- cairo_matrix_t *ctm_inverse,
- cairo_antialias_t antialias,
-
- double line_width,
- cairo_line_cap_t line_cap,
- cairo_line_join_t line_join,
- double miter_limit,
-
- double *dash,
- int num_dashes,
- double dash_offset);
+_cairo_surface_stroke (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_stroke_style_t *stroke_style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias);
cairo_private cairo_status_t
-_cairo_surface_fill_path (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *dst,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_clip_t *clip,
- cairo_antialias_t antialias);
+_cairo_surface_fill (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias);
-cairo_status_t
-_cairo_surface_show_glyphs (cairo_operator_t operator,
- cairo_pattern_t *source_pattern,
- cairo_surface_t *dst,
- cairo_scaled_font_t *scaled_font,
+cairo_private cairo_status_t
+_cairo_surface_show_glyphs (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
cairo_glyph_t *glyphs,
- int num_glyphs);
+ int num_glyphs,
+ cairo_scaled_font_t *scaled_font);
cairo_private cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
More information about the cairo-commit
mailing list