mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-08 07:10:25 +01:00
Remove _cairo_surface_show_glyphs() in favor of _cairo_surface_show_text_glyphs()
This commit is contained in:
parent
17a5f10f53
commit
c29029ce43
5 changed files with 79 additions and 95 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue