[cairo-commit] 3 commits - src/cairoint.h src/cairo-pdf-surface.c src/cairo-surface.c
Andrea Canciani
ranma42 at kemper.freedesktop.org
Fri Dec 10 01:45:57 PST 2010
src/cairo-pdf-surface.c | 63 +++++++++++----
src/cairo-surface.c | 201 ------------------------------------------------
src/cairoint.h | 58 -------------
3 files changed, 47 insertions(+), 275 deletions(-)
New commits:
commit f317a31b3fd14949edaca70f896c8a3cdecfce18
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Tue Nov 23 23:36:14 2010 +0100
surface: Remove _cairo_surface_*_extents
They have been replaced by cairo_composite_rect_t functions.
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index e1162bb..8b95741 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2952,168 +2952,6 @@ _cairo_surface_set_resolution (cairo_surface_t *surface,
surface->y_resolution = y_res;
}
-/* Generic methods for determining operation extents. */
-
-static void
-_rectangle_intersect_clip (cairo_rectangle_int_t *extents, cairo_clip_t *clip)
-{
- const cairo_rectangle_int_t *clip_extents;
- cairo_bool_t is_empty;
-
- clip_extents = NULL;
- if (clip != NULL)
- clip_extents = _cairo_clip_get_extents (clip);
-
- if (clip_extents != NULL)
- is_empty = _cairo_rectangle_intersect (extents, clip_extents);
-}
-
-static void
-_cairo_surface_operation_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents)
-{
- cairo_bool_t is_empty;
-
- is_empty = _cairo_surface_get_extents (surface, extents);
-
- if (_cairo_operator_bounded_by_source (op)) {
- cairo_rectangle_int_t source_extents;
-
- _cairo_pattern_get_extents (source, &source_extents);
- is_empty = _cairo_rectangle_intersect (extents, &source_extents);
- }
-
- _rectangle_intersect_clip (extents, clip);
-}
-
-cairo_status_t
-_cairo_surface_paint_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents)
-{
- _cairo_surface_operation_extents (surface, op, source, clip, extents);
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_surface_mask_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_pattern_t *mask,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents)
-{
- cairo_bool_t is_empty;
-
- _cairo_surface_operation_extents (surface, op, source, clip, extents);
-
- if (_cairo_operator_bounded_by_mask (op)) {
- cairo_rectangle_int_t mask_extents;
-
- _cairo_pattern_get_extents (mask, &mask_extents);
- is_empty = _cairo_rectangle_intersect (extents, &mask_extents);
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_surface_stroke_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_path_fixed_t *path,
- const cairo_stroke_style_t *style,
- const cairo_matrix_t *ctm,
- const cairo_matrix_t *ctm_inverse,
- double tolerance,
- cairo_antialias_t antialias,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents)
-{
- cairo_status_t status;
- cairo_bool_t is_empty;
-
- _cairo_surface_operation_extents (surface, op, source, clip, extents);
-
- if (_cairo_operator_bounded_by_mask (op)) {
- cairo_rectangle_int_t mask_extents;
-
- status = _cairo_path_fixed_stroke_extents (path, style,
- ctm, ctm_inverse,
- tolerance,
- &mask_extents);
- if (unlikely (status))
- return status;
-
- is_empty = _cairo_rectangle_intersect (extents, &mask_extents);
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_surface_fill_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents)
-{
- cairo_bool_t is_empty;
-
- _cairo_surface_operation_extents (surface, op, source, clip, extents);
-
- if (_cairo_operator_bounded_by_mask (op)) {
- cairo_rectangle_int_t mask_extents;
-
- _cairo_path_fixed_fill_extents (path, fill_rule, tolerance,
- &mask_extents);
- is_empty = _cairo_rectangle_intersect (extents, &mask_extents);
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_surface_glyphs_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_scaled_font_t *scaled_font,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents)
-{
- cairo_status_t status;
- cairo_bool_t is_empty;
-
- _cairo_surface_operation_extents (surface, op, source, clip, extents);
-
- if (_cairo_operator_bounded_by_mask (op)) {
- cairo_rectangle_int_t glyph_extents;
-
- status = _cairo_scaled_font_glyph_device_extents (scaled_font,
- glyphs,
- num_glyphs,
- &glyph_extents,
- NULL);
- if (unlikely (status))
- return status;
-
- is_empty = _cairo_rectangle_intersect (extents, &glyph_extents);
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
cairo_surface_t *
_cairo_surface_create_in_error (cairo_status_t status)
{
diff --git a/src/cairoint.h b/src/cairoint.h
index d004180..c40dc9b 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1675,55 +1675,6 @@ _cairo_surface_show_text_glyphs (cairo_surface_t *surface,
cairo_clip_t *clip);
cairo_private cairo_status_t
-_cairo_surface_paint_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents);
-
-cairo_private cairo_status_t
-_cairo_surface_mask_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_pattern_t *mask,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents);
-
-cairo_private cairo_status_t
-_cairo_surface_stroke_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_path_fixed_t *path,
- const cairo_stroke_style_t *style,
- const cairo_matrix_t *ctm,
- const cairo_matrix_t *ctm_inverse,
- double tolerance,
- cairo_antialias_t antialias,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents);
-
-cairo_private cairo_status_t
-_cairo_surface_fill_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents);
-
-cairo_private cairo_status_t
-_cairo_surface_glyphs_extents (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_scaled_font_t *scaled_font,
- cairo_clip_t *clip,
- cairo_rectangle_int_t *extents);
-
-cairo_private cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t op,
const cairo_pattern_t *pattern,
cairo_surface_t *dst,
commit 0ae9b547415a71126848f61f76f895d38584435c
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Tue Nov 23 23:58:09 2010 +0100
pdf: Use composite rectangles in fill_stroke
All other pdf drawing functions have been updated to use
cairo_composite_rectangles_t to compute the extents affected by the
operation in 3a5d71c431dfb251308c3e4e02d2ea4acec90a91, but fill_stroke
was not changed.
This removes the last usage of the old _cairo_surface_*_extents()
functions.
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 39dd395..cb7f7ba 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -6208,7 +6208,7 @@ _cairo_pdf_surface_fill_stroke (void *abstract_surface,
cairo_pdf_surface_t *surface = abstract_surface;
cairo_status_t status;
cairo_pdf_resource_t fill_pattern_res, stroke_pattern_res, gstate_res;
- cairo_rectangle_int_t extents;
+ cairo_composite_rectangles_t extents;
/* During analysis we return unsupported and let the _fill and
* _stroke functions that are on the fallback path do the analysis
@@ -6240,18 +6240,32 @@ _cairo_pdf_surface_fill_stroke (void *abstract_surface,
if (unlikely (status))
return status;
- status = _cairo_surface_fill_extents (&surface->base,
- fill_op, fill_source, path, fill_rule,
- fill_tolerance, fill_antialias,
- clip, &extents);
- if (unlikely (status))
- return status;
+ status = _cairo_composite_rectangles_init_for_fill (&extents,
+ surface->width,
+ surface->height,
+ fill_op, fill_source, path,
+ clip);
+ if (unlikely (status)) {
+ if (status != CAIRO_INT_STATUS_NOTHING_TO_DO)
+ return status;
+ }
+
+ /* use the more accurate extents */
+ if (extents.is_bounded) {
+ cairo_bool_t is_empty;
+
+ _cairo_path_fixed_fill_extents (path,
+ fill_rule,
+ fill_tolerance,
+ &extents.mask);
+ is_empty = ! _cairo_rectangle_intersect (&extents.bounded, &extents.mask);
+ }
fill_pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, fill_source,
- &extents,
+ &extents.bounded,
&fill_pattern_res,
&gstate_res);
if (unlikely (status))
@@ -6259,19 +6273,36 @@ _cairo_pdf_surface_fill_stroke (void *abstract_surface,
assert (gstate_res.id == 0);
- status = _cairo_surface_stroke_extents (&surface->base,
- stroke_op, stroke_source, path,
- stroke_style, stroke_ctm, stroke_ctm_inverse,
- stroke_tolerance, stroke_antialias,
- clip, &extents);
- if (unlikely (status))
- return status;
+ status = _cairo_composite_rectangles_init_for_stroke (&extents,
+ surface->width,
+ surface->height,
+ stroke_op, stroke_source,
+ path, stroke_style, stroke_ctm,
+ clip);
+ if (unlikely (status)) {
+ if (status != CAIRO_INT_STATUS_NOTHING_TO_DO)
+ return status;
+ }
+
+ /* use the more accurate extents */
+ if (extents.is_bounded) {
+ cairo_bool_t is_empty;
+
+ status = _cairo_path_fixed_stroke_extents (path, stroke_style,
+ stroke_ctm, stroke_ctm_inverse,
+ stroke_tolerance,
+ &extents.mask);
+ if (unlikely (status))
+ return status;
+
+ is_empty = ! _cairo_rectangle_intersect (&extents.bounded, &extents.mask);
+ }
stroke_pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface,
stroke_source,
- &extents,
+ &extents.bounded,
&stroke_pattern_res,
&gstate_res);
if (unlikely (status))
commit 71e6520fa6a695710482eafd022f9e44c45c0610
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Mon Nov 15 21:08:06 2010 +0100
surface: Remove _cairo_surface_fill_rectangle
It is not used anymore.
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index ea9b0fe..e1162bb 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1857,45 +1857,6 @@ _cairo_surface_composite (cairo_operator_t op,
}
/**
- * _cairo_surface_fill_rectangle:
- * @surface: a #cairo_surface_t
- * @op: the operator to apply to the rectangle
- * @color: the source color
- * @x: X coordinate of rectangle, in backend coordinates
- * @y: Y coordinate of rectangle, in backend coordinates
- * @width: width of rectangle, in backend coordinates
- * @height: height of rectangle, in backend coordinates
- *
- * Applies an operator to a rectangle using a solid color as the source.
- * See _cairo_surface_fill_rectangles() for full details.
- *
- * Return value: %CAIRO_STATUS_SUCCESS or the error that occurred
- **/
-cairo_status_t
-_cairo_surface_fill_rectangle (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_color_t *color,
- int x,
- int y,
- int width,
- int height)
-{
- cairo_rectangle_int_t rect;
-
- if (surface->status)
- return surface->status;
-
- assert (_cairo_surface_is_writable (surface));
-
- rect.x = x;
- rect.y = y;
- rect.width = width;
- rect.height = height;
-
- return _cairo_surface_fill_rectangles (surface, op, color, &rect, 1);
-}
-
-/**
* _cairo_surface_fill_region:
* @surface: a #cairo_surface_t
* @op: the operator to apply to the region
diff --git a/src/cairoint.h b/src/cairoint.h
index f2c2e0f..d004180 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1596,15 +1596,6 @@ _cairo_surface_composite (cairo_operator_t op,
cairo_region_t *clip_region);
cairo_private cairo_status_t
-_cairo_surface_fill_rectangle (cairo_surface_t *surface,
- cairo_operator_t op,
- const cairo_color_t *color,
- int x,
- int y,
- int width,
- int height);
-
-cairo_private cairo_status_t
_cairo_surface_fill_region (cairo_surface_t *surface,
cairo_operator_t op,
const cairo_color_t *color,
More information about the cairo-commit
mailing list