From c29029ce436709fc3f3ce651a92eebcee11f3203 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 30 Jun 2008 22:11:48 -0400 Subject: [PATCH] Remove _cairo_surface_show_glyphs() in favor of _cairo_surface_show_text_glyphs() --- src/cairo-paginated-surface.c | 43 +++-------------------------- src/cairo-surface.c | 22 ++------------- src/cairoint.h | 8 ------ src/test-meta-surface.c | 50 ++++++++++++++++++++++++---------- src/test-paginated-surface.c | 51 ++++++++++++++++++++++++++--------- 5 files changed, 79 insertions(+), 95 deletions(-) diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c index f25e792c6..9deefc6e7 100644 --- a/src/cairo-paginated-surface.c +++ b/src/cairo-paginated-surface.c @@ -595,43 +595,6 @@ _cairo_paginated_surface_fill (void *abstract_surface, tolerance, antialias); } -static cairo_int_status_t -_cairo_paginated_surface_show_glyphs (void *abstract_surface, - cairo_operator_t op, - cairo_pattern_t *source, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_scaled_font_t *scaled_font, - int *remaining_glyphs) -{ - cairo_paginated_surface_t *surface = abstract_surface; - cairo_int_status_t status; - - /* Optimize away erasing of nothing. */ - if (surface->page_is_blank && op == CAIRO_OPERATOR_CLEAR) - return CAIRO_STATUS_SUCCESS; - - surface->page_is_blank = FALSE; - - /* Since this is a "wrapping" surface, we're calling back into - * _cairo_surface_show_glyphs from within a call to the same. - * Since _cairo_surface_show_glyphs acquires a mutex, we release - * and re-acquire the mutex around this nested call. - * - * Yes, this is ugly, but we consider it pragmatic as compared to - * adding locking code to all 18 surface-backend-specific - * show_glyphs functions, (which would get less testing and likely - * lead to bugs). - */ - CAIRO_MUTEX_UNLOCK (scaled_font->mutex); - status = _cairo_surface_show_glyphs (surface->meta, op, source, - glyphs, num_glyphs, - scaled_font); - CAIRO_MUTEX_LOCK (scaled_font->mutex); - - return status; -} - static cairo_bool_t _cairo_paginated_surface_has_show_text_glyphs (void *abstract_surface) { @@ -663,8 +626,8 @@ _cairo_paginated_surface_show_text_glyphs (void *abstract_surface, surface->page_is_blank = FALSE; /* Since this is a "wrapping" surface, we're calling back into - * _cairo_surface_show_glyphs from within a call to the same. - * Since _cairo_surface_show_glyphs acquires a mutex, we release + * _cairo_surface_show_text_glyphs from within a call to the same. + * Since _cairo_surface_show_text_glyphs acquires a mutex, we release * and re-acquire the mutex around this nested call. * * Yes, this is ugly, but we consider it pragmatic as compared to @@ -719,7 +682,7 @@ static const cairo_surface_backend_t cairo_paginated_surface_backend = { _cairo_paginated_surface_mask, _cairo_paginated_surface_stroke, _cairo_paginated_surface_fill, - _cairo_paginated_surface_show_glyphs, + NULL, /* show_glyphs */ _cairo_paginated_surface_snapshot, NULL, /* is_similar */ NULL, /* reset */ diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 6e6f7fc95..bceb7a330 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -2135,24 +2135,6 @@ _cairo_surface_get_extents (cairo_surface_t *surface, return status; } -cairo_status_t -_cairo_surface_show_glyphs (cairo_surface_t *surface, - cairo_operator_t op, - cairo_pattern_t *source, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_scaled_font_t *scaled_font) -{ - return _cairo_surface_show_text_glyphs (surface, - op, - source, - NULL, 0, - glyphs, num_glyphs, - NULL, 0, - FALSE, - scaled_font); -} - cairo_bool_t _cairo_surface_has_show_text_glyphs (cairo_surface_t *surface) { @@ -2301,8 +2283,8 @@ _cairo_surface_show_text_glyphs (cairo_surface_t *surface, } /* XXX: Previously, we had a function named _cairo_surface_show_glyphs - * with not-so-useful semantics. We've now got a new - * _cairo_surface_show_glyphs with the proper semantics, and its + * with not-so-useful semantics. We've now got a + * _cairo_surface_show_text_glyphs with the proper semantics, and its * fallback still uses this old function (which still needs to be * cleaned up in terms of both semantics and naming). */ cairo_status_t diff --git a/src/cairoint.h b/src/cairoint.h index bd33c4497..a377a6b5c 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1747,14 +1747,6 @@ _cairo_surface_fill (cairo_surface_t *surface, double tolerance, cairo_antialias_t antialias); -cairo_private cairo_status_t -_cairo_surface_show_glyphs (cairo_surface_t *surface, - cairo_operator_t op, - cairo_pattern_t *source, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_scaled_font_t *scaled_font); - cairo_private cairo_bool_t _cairo_surface_has_show_text_glyphs (cairo_surface_t *surface); diff --git a/src/test-meta-surface.c b/src/test-meta-surface.c index a6f8b97ea..5425c0c82 100644 --- a/src/test-meta-surface.c +++ b/src/test-meta-surface.c @@ -255,14 +255,26 @@ _test_meta_surface_fill (void *abstract_surface, tolerance, antialias); } +static cairo_bool_t +_test_meta_surface_has_show_text_glyphs (void *abstract_surface) +{ + test_meta_surface_t *surface = abstract_surface; + + return _cairo_surface_has_show_text_glyphs (surface->meta); +} + static cairo_int_status_t -_test_meta_surface_show_glyphs (void *abstract_surface, - cairo_operator_t op, - cairo_pattern_t *source, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_scaled_font_t *scaled_font, - int *remaining_glyphs) +_test_meta_surface_show_text_glyphs (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source, + const char *utf8, + int utf8_len, + cairo_glyph_t *glyphs, + int num_glyphs, + const cairo_text_cluster_t *clusters, + int num_clusters, + cairo_bool_t backward, + cairo_scaled_font_t *scaled_font) { test_meta_surface_t *surface = abstract_surface; cairo_int_status_t status; @@ -270,8 +282,8 @@ _test_meta_surface_show_glyphs (void *abstract_surface, surface->image_reflects_meta = FALSE; /* Since this is a "wrapping" surface, we're calling back into - * _cairo_surface_show_glyphs from within a call to the same. - * Since _cairo_surface_show_glyphs acquires a mutex, we release + * _cairo_surface_show_text_glyphs from within a call to the same. + * Since _cairo_surface_show_text_glyphs acquires a mutex, we release * and re-acquire the mutex around this nested call. * * Yes, this is ugly, but we consider it pragmatic as compared to @@ -280,14 +292,18 @@ _test_meta_surface_show_glyphs (void *abstract_surface, * lead to bugs). */ CAIRO_MUTEX_UNLOCK (scaled_font->mutex); - status = _cairo_surface_show_glyphs (surface->meta, op, source, - glyphs, num_glyphs, - scaled_font); + status = _cairo_surface_show_text_glyphs (surface->meta, op, source, + utf8, utf8_len, + glyphs, num_glyphs, + clusters, num_clusters, + backward, + scaled_font); CAIRO_MUTEX_LOCK (scaled_font->mutex); return status; } + static cairo_surface_t * _test_meta_surface_snapshot (void *abstract_other) { @@ -358,6 +374,12 @@ static const cairo_surface_backend_t test_meta_surface_backend = { _test_meta_surface_mask, _test_meta_surface_stroke, _test_meta_surface_fill, - _test_meta_surface_show_glyphs, - _test_meta_surface_snapshot + NULL, /* show_glyphs */ + _test_meta_surface_snapshot, + NULL, /* is_similar */ + NULL, /* reset */ + NULL, /* fill_stroke */ + NULL, /* create_solid_pattern_surface */ + _test_meta_surface_has_show_text_glyphs, + _test_meta_surface_show_text_glyphs }; diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c index 6b85a1323..48c730824 100644 --- a/src/test-paginated-surface.c +++ b/src/test-paginated-surface.c @@ -232,14 +232,26 @@ _test_paginated_surface_fill (void *abstract_surface, tolerance, antialias); } +static cairo_bool_t +_test_paginated_surface_has_show_text_glyphs (void *abstract_surface) +{ + test_paginated_surface_t *surface = abstract_surface; + + return _cairo_surface_has_show_text_glyphs (surface->target); +} + static cairo_int_status_t -_test_paginated_surface_show_glyphs (void *abstract_surface, - cairo_operator_t op, - cairo_pattern_t *source, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_scaled_font_t *scaled_font, - int *remaining_glyphs) +_test_paginated_surface_show_text_glyphs (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source, + const char *utf8, + int utf8_len, + cairo_glyph_t *glyphs, + int num_glyphs, + const cairo_text_cluster_t *clusters, + int num_clusters, + cairo_bool_t backward, + cairo_scaled_font_t *scaled_font) { test_paginated_surface_t *surface = abstract_surface; cairo_int_status_t status; @@ -248,8 +260,8 @@ _test_paginated_surface_show_glyphs (void *abstract_surface, return CAIRO_STATUS_SUCCESS; /* Since this is a "wrapping" surface, we're calling back into - * _cairo_surface_show_glyphs from within a call to the same. - * Since _cairo_surface_show_glyphs acquires a mutex, we release + * _cairo_surface_show_text_glyphs from within a call to the same. + * Since _cairo_surface_show_text_glyphs acquires a mutex, we release * and re-acquire the mutex around this nested call. * * Yes, this is ugly, but we consider it pragmatic as compared to @@ -258,13 +270,18 @@ _test_paginated_surface_show_glyphs (void *abstract_surface, * lead to bugs). */ CAIRO_MUTEX_UNLOCK (scaled_font->mutex); - status = _cairo_surface_show_glyphs (surface->target, op, source, - glyphs, num_glyphs, scaled_font); + status = _cairo_surface_show_text_glyphs (surface->target, op, source, + utf8, utf8_len, + glyphs, num_glyphs, + clusters, num_clusters, + backward, + scaled_font); CAIRO_MUTEX_LOCK (scaled_font->mutex); return status; } + static void _test_paginated_surface_set_paginated_mode (void *abstract_surface, cairo_paginated_mode_t mode) @@ -309,8 +326,16 @@ static const cairo_surface_backend_t test_paginated_surface_backend = { _test_paginated_surface_mask, _test_paginated_surface_stroke, _test_paginated_surface_fill, - _test_paginated_surface_show_glyphs, - NULL /* snapshot */ + NULL, /* show_glyphs */ + + NULL, /* snapshot */ + NULL, /* is_similar */ + NULL, /* reset */ + NULL, /* fill_stroke */ + NULL, /* create_solid_pattern_surface */ + + _test_paginated_surface_has_show_text_glyphs, + _test_paginated_surface_show_text_glyphs }; static const cairo_paginated_surface_backend_t test_paginated_surface_paginated_backend = {