summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cairo-glitz-surface.c1
-rw-r--r--src/cairo-gstate-private.h10
-rw-r--r--src/cairo-gstate.c161
-rw-r--r--src/cairo-meta-surface-private.h8
-rw-r--r--src/cairo-meta-surface.c71
-rw-r--r--src/cairo-path-stroke.c142
-rw-r--r--src/cairo-pdf-surface.c31
-rw-r--r--src/cairo-ps-surface.c87
-rw-r--r--src/cairo-surface.c265
-rw-r--r--src/cairo-win32-surface.c1
-rw-r--r--src/cairo-xcb-surface.c1
-rw-r--r--src/cairo-xlib-surface.c1
-rw-r--r--src/cairoint.h142
13 files changed, 440 insertions, 481 deletions
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index c48be346..1f8763c1 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -2128,7 +2128,6 @@ static const cairo_surface_backend_t cairo_glitz_surface_backend = {
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 */
diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h
index b174115f..e96ba8dd 100644
--- a/src/cairo-gstate-private.h
+++ b/src/cairo-gstate-private.h
@@ -44,18 +44,10 @@ struct _cairo_gstate {
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;
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 37a2cf30..a96505f7 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -90,17 +90,16 @@ _cairo_gstate_init (cairo_gstate_t *gstate,
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 @@ _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
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_gstate_fini (cairo_gstate_t *gstate)
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_gstate_get_fill_rule (cairo_gstate_t *gstate)
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 @@ _cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width)
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_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap)
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_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join
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 @@ _cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, do
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 @@ _cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, do
/* 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 @@ _cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, do
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_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, do
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 @@ _cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit)
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_paint (cairo_gstate_t *gstate)
_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_mask (cairo_gstate_t *gstate,
_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 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
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_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
_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_gstate_in_stroke (cairo_gstate_t *gstate,
_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_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
_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_gstate_stroke_extents (cairo_gstate_t *gstate,
_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_show_glyphs (cairo_gstate_t *gstate,
_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);
diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h
index 975d596c..344312e6 100644
--- a/src/cairo-meta-surface-private.h
+++ b/src/cairo-meta-surface-private.h
@@ -46,7 +46,7 @@ typedef enum {
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 @@ typedef struct _cairo_command_show_glyphs {
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 @@ typedef struct _cairo_command_fill_path {
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 @@ typedef union _cairo_command {
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 {
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index 1b2bbec9..5e69909b 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -111,9 +111,9 @@ _cairo_meta_surface_finish (void *abstract_surface)
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 @@ _cairo_meta_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
}
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 @@ static const cairo_surface_backend_t cairo_meta_surface_backend = {
_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 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
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;
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index ad5c5101..96664cee 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -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 @@ typedef struct cairo_stroker {
/* 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 @@ _cairo_stroker_start_dash (cairo_stroker_t *stroker)
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 @@ _cairo_stroker_step_dash (cairo_stroker_t *stroker, double step)
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 @@ _cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_st
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 @@ _cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_st
/* 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_stroker_add_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f)
{
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 @@ _cairo_stroker_add_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f)
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 @@ _compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_stroker_t *stro
_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 @@ _cairo_stroker_curve_to_dashed (void *closure,
/* 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 @@ _cairo_stroker_curve_to_dashed (void *closure,
}
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_stroker_close_path (void *closure)
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,
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 1e9b577f..22bc7661 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1240,15 +1240,15 @@ _cairo_pdf_path_close_path (void *closure)
}
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 @@ static const cairo_surface_backend_t cairo_pdf_surface_backend = {
_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 *
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 0ff7c13b..37887548 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -463,36 +463,25 @@ _cairo_ps_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
}
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 @@ static const cairo_surface_backend_t cairo_ps_surface_backend = {
_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 @@ _ps_output_old_show_glyphs (cairo_scaled_font_t *scaled_font,
}
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 @@ _ps_output_fill_path (cairo_operator_t operator,
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 @@ static const cairo_surface_backend_t ps_output_backend = {
_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
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 64afe386..ca81918d 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1144,29 +1144,29 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface,
}
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 @@ _fallback_paint (cairo_operator_t operator,
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 @@ _fallback_paint (cairo_operator_t operator,
}
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 @@ _cairo_surface_mask_draw_func (void *closure,
}
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 @@ _fallback_mask (cairo_operator_t operator,
}
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 @@ _fallback_stroke (cairo_operator_t operator,
}
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 @@ _fallback_fill_path (cairo_operator_t operator,
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 @@ _fallback_fill_path (cairo_operator_t operator,
}
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 @@ _cairo_surface_old_show_glyphs_draw_func (void *closure,
}
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 @@ _fallback_show_glyphs (cairo_operator_t operator,
_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 @@ _fallback_show_glyphs (cairo_operator_t operator,
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
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index d0641771..dbb8e0fd 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1046,7 +1046,6 @@ static const cairo_surface_backend_t cairo_win32_surface_backend = {
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 */
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 2309b260..afb0ddb7 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -1041,7 +1041,6 @@ static const cairo_surface_backend_t cairo_xcb_surface_backend = {
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 */
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index f4aceb88..3176cbc9 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1691,7 +1691,6 @@ static const cairo_surface_backend_t cairo_xlib_surface_backend = {
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 */
diff --git a/src/cairoint.h b/src/cairoint.h
index 1fc4fe6d..fe17cbc8 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -556,6 +556,16 @@ extern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_
#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 @@ struct _cairo_surface_backend {
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 @@ struct _cairo_surface_backend {
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_fixed_fill_to_traps (cairo_path_fixed_t *path,
/* 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 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface,
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,