mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-27 02:20:16 +01:00
Rename surface->backend->show_glyphs to surface->backend->old_show_glyphs.
Move show_glyphs fallback from gstate to surface where it belongs. Reviewed by: keithp
This commit is contained in:
parent
a3ae0aecc4
commit
719334c52c
14 changed files with 372 additions and 276 deletions
29
ChangeLog
29
ChangeLog
|
|
@ -1,3 +1,32 @@
|
|||
2005-11-01 Carl Worth <cworth@cworth.org>
|
||||
|
||||
Reviewed by: keithp
|
||||
|
||||
* src/cairoint.h:
|
||||
* src/cairo-atsui-font.c: (_cairo_atsui_font_old_show_glyphs):
|
||||
* src/cairo-glitz-surface.c: (_cairo_glitz_surface_old_show_glyphs):
|
||||
* src/cairo-image-surface.c:
|
||||
* src/cairo-meta-surface.c: (_cairo_meta_surface_old_show_glyphs),
|
||||
(_cairo_meta_surface_replay):
|
||||
* src/cairo-pdf-surface.c: (_cairo_pdf_surface_old_show_glyphs):
|
||||
* src/cairo-ps-surface.c: (_cairo_ps_surface_old_show_glyphs),
|
||||
(_ps_output_old_show_glyphs):
|
||||
* src/cairo-quartz-surface.c:
|
||||
* src/cairo-win32-surface.c:
|
||||
* src/cairo-xcb-surface.c:
|
||||
* src/cairo-xlib-surface.c: (_cairo_xlib_surface_old_show_glyphs8),
|
||||
(_cairo_xlib_surface_old_show_glyphs16),
|
||||
(_cairo_xlib_surface_old_show_glyphs32),
|
||||
(_cairo_xlib_surface_old_show_glyphs):
|
||||
Rename surface->backend->show_glyphs to surface->backend->old_show_glyphs.
|
||||
|
||||
* src/cairoint.h:
|
||||
* src/cairo-gstate.c: (_cairo_gstate_show_glyphs):
|
||||
* src/cairo-surface.c: (_cairo_surface_old_show_glyphs_draw_func),
|
||||
(_fallback_show_glyphs), (_cairo_surface_show_glyphs),
|
||||
(_cairo_surface_old_show_glyphs):
|
||||
Move show_glyphs fallback from gstate to surface where it belongs.
|
||||
|
||||
2005-11-01 Keith Packard <keithp@keithp.com>
|
||||
|
||||
* src/cairo-surface.c: (_fallback_stroke), (_cairo_surface_stroke):
|
||||
|
|
|
|||
|
|
@ -541,18 +541,18 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font,
|
|||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_atsui_font_show_glyphs (void *abstract_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *generic_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_atsui_font_old_show_glyphs (void *abstract_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *generic_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_atsui_font_t *font = abstract_font;
|
||||
CGContextRef myBitmapContext;
|
||||
|
|
@ -641,6 +641,6 @@ const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = {
|
|||
_cairo_atsui_font_scaled_glyph_init,
|
||||
_cairo_atsui_font_text_to_glyphs,
|
||||
NULL, /* ucs4_to_index */
|
||||
_cairo_atsui_font_show_glyphs,
|
||||
_cairo_atsui_font_old_show_glyphs,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1859,18 +1859,18 @@ _cairo_glitz_surface_add_glyph (cairo_glitz_surface_t *surface,
|
|||
#define N_STACK_BUF 256
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_glitz_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t op,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_glitz_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t op,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_glitz_surface_attributes_t attributes;
|
||||
cairo_glitz_surface_glyph_private_t *glyph_private;
|
||||
|
|
@ -2127,7 +2127,7 @@ static const cairo_surface_backend_t cairo_glitz_surface_backend = {
|
|||
_cairo_glitz_surface_set_clip_region,
|
||||
NULL, /* intersect_clip_path */
|
||||
_cairo_glitz_surface_get_extents,
|
||||
_cairo_glitz_surface_show_glyphs,
|
||||
_cairo_glitz_surface_old_show_glyphs,
|
||||
NULL, /* fill_path */
|
||||
NULL, /* get_font_options */
|
||||
NULL, /* flush */
|
||||
|
|
|
|||
|
|
@ -1936,80 +1936,15 @@ _cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
cairo_scaled_font_t *font;
|
||||
cairo_glyph_t *glyphs;
|
||||
int num_glyphs;
|
||||
} cairo_show_glyphs_info_t;
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_gstate_show_glyphs_draw_func (void *closure,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *src,
|
||||
cairo_surface_t *dst,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
const cairo_rectangle_t *extents)
|
||||
{
|
||||
cairo_show_glyphs_info_t *glyph_info = closure;
|
||||
cairo_pattern_union_t pattern;
|
||||
cairo_status_t status;
|
||||
|
||||
/* Modifying the glyph array is fine because we know that this function
|
||||
* will be called only once, and we've already made a copy of the
|
||||
* glyphs in the wrapper.
|
||||
*/
|
||||
if (dst_x != 0 || dst_y != 0) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < glyph_info->num_glyphs; ++i)
|
||||
{
|
||||
glyph_info->glyphs[i].x -= dst_x;
|
||||
glyph_info->glyphs[i].y -= dst_y;
|
||||
}
|
||||
}
|
||||
|
||||
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
|
||||
if (!src)
|
||||
src = &pattern.base;
|
||||
|
||||
status = _cairo_surface_show_glyphs (glyph_info->font, operator, src,
|
||||
dst,
|
||||
extents->x, extents->y,
|
||||
extents->x - dst_x, extents->y - dst_y,
|
||||
extents->width, extents->height,
|
||||
glyph_info->glyphs,
|
||||
glyph_info->num_glyphs);
|
||||
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
return status;
|
||||
|
||||
status = _cairo_scaled_font_show_glyphs (glyph_info->font,
|
||||
operator,
|
||||
src, dst,
|
||||
extents->x, extents->y,
|
||||
extents->x - dst_x, extents->y - dst_y,
|
||||
extents->width, extents->height,
|
||||
glyph_info->glyphs,
|
||||
glyph_info->num_glyphs);
|
||||
|
||||
if (src == &pattern.base)
|
||||
_cairo_pattern_fini (&pattern.base);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
_cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
|
||||
cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_pattern_union_t source_pattern;
|
||||
cairo_glyph_t *transformed_glyphs;
|
||||
int i;
|
||||
cairo_glyph_t *transformed_glyphs = NULL;
|
||||
cairo_pattern_union_t pattern;
|
||||
cairo_rectangle_t extents;
|
||||
cairo_show_glyphs_info_t glyph_info;
|
||||
|
||||
if (gstate->source->status)
|
||||
return gstate->source->status;
|
||||
|
|
@ -2021,7 +1956,7 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
|
|||
status = _cairo_gstate_ensure_scaled_font (gstate);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
|
||||
transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
|
||||
if (transformed_glyphs == NULL)
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
|
|
@ -2034,38 +1969,18 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
|
|||
&transformed_glyphs[i].y);
|
||||
}
|
||||
|
||||
if (_cairo_operator_bounded_by_mask (gstate->operator))
|
||||
status = _cairo_scaled_font_glyph_device_extents (gstate->scaled_font,
|
||||
transformed_glyphs,
|
||||
num_glyphs,
|
||||
&extents);
|
||||
else
|
||||
status = _cairo_surface_get_extents (gstate->target, &extents);
|
||||
_cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
|
||||
|
||||
if (status)
|
||||
goto CLEANUP_GLYPHS;
|
||||
|
||||
status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &extents);
|
||||
if (status)
|
||||
goto CLEANUP_GLYPHS;
|
||||
|
||||
_cairo_gstate_copy_transformed_source (gstate, &pattern.base);
|
||||
status = _cairo_surface_show_glyphs (gstate->operator,
|
||||
&source_pattern.base,
|
||||
gstate->target,
|
||||
gstate->scaled_font,
|
||||
transformed_glyphs,
|
||||
num_glyphs);
|
||||
|
||||
glyph_info.font = gstate->scaled_font;
|
||||
glyph_info.glyphs = transformed_glyphs;
|
||||
glyph_info.num_glyphs = num_glyphs;
|
||||
|
||||
status = _cairo_gstate_clip_and_composite (&gstate->clip, gstate->operator,
|
||||
&pattern.base,
|
||||
_cairo_gstate_show_glyphs_draw_func, &glyph_info,
|
||||
gstate->target,
|
||||
&extents);
|
||||
|
||||
_cairo_pattern_fini (&pattern.base);
|
||||
|
||||
CLEANUP_GLYPHS:
|
||||
_cairo_pattern_fini (&source_pattern.base);
|
||||
free (transformed_glyphs);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -872,5 +872,5 @@ const cairo_surface_backend_t cairo_image_surface_backend = {
|
|||
_cairo_image_abstract_surface_set_clip_region,
|
||||
NULL, /* intersect_clip_path */
|
||||
_cairo_image_abstract_surface_get_extents,
|
||||
NULL /* show_glyphs */
|
||||
NULL /* old_show_glyphs */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -349,18 +349,18 @@ _cairo_meta_surface_get_extents (void *abstract_surface,
|
|||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_meta_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_meta_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_meta_surface_t *meta = abstract_surface;
|
||||
cairo_command_show_glyphs_t *command;
|
||||
|
|
@ -470,7 +470,7 @@ static const cairo_surface_backend_t cairo_meta_surface_backend = {
|
|||
NULL, /* set_clip_region */
|
||||
_cairo_meta_surface_intersect_clip_path,
|
||||
_cairo_meta_surface_get_extents,
|
||||
_cairo_meta_surface_show_glyphs,
|
||||
_cairo_meta_surface_old_show_glyphs,
|
||||
_cairo_meta_surface_fill_path,
|
||||
};
|
||||
|
||||
|
|
@ -567,7 +567,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
|
|||
if (status)
|
||||
break;
|
||||
|
||||
status = _cairo_surface_show_glyphs
|
||||
status = _cairo_surface_old_show_glyphs
|
||||
(command->show_glyphs.scaled_font,
|
||||
command->show_glyphs.operator,
|
||||
&command->show_glyphs.pattern.base,
|
||||
|
|
|
|||
|
|
@ -1426,18 +1426,18 @@ _cairo_pdf_document_get_font (cairo_pdf_document_t *document,
|
|||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_pdf_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_pdf_surface_t *surface = abstract_surface;
|
||||
cairo_pdf_document_t *document = surface->document;
|
||||
|
|
@ -1573,7 +1573,7 @@ static const cairo_surface_backend_t cairo_pdf_surface_backend = {
|
|||
NULL, /* set_clip_region */
|
||||
_cairo_pdf_surface_intersect_clip_path,
|
||||
_cairo_pdf_surface_get_extents,
|
||||
_cairo_pdf_surface_show_glyphs,
|
||||
_cairo_pdf_surface_old_show_glyphs,
|
||||
_cairo_pdf_surface_fill_path,
|
||||
_cairo_pdf_surface_get_font_options
|
||||
};
|
||||
|
|
|
|||
|
|
@ -419,18 +419,18 @@ _cairo_ps_surface_get_font (cairo_ps_surface_t *surface,
|
|||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_ps_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_ps_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_ps_surface_t *surface = abstract_surface;
|
||||
cairo_font_subset_t *subset;
|
||||
|
|
@ -448,18 +448,18 @@ _cairo_ps_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
|||
for (i = 0; i < num_glyphs; i++)
|
||||
_cairo_font_subset_use_glyph (subset, glyphs[i].index);
|
||||
|
||||
return _cairo_surface_show_glyphs (scaled_font,
|
||||
operator,
|
||||
pattern,
|
||||
surface->current_page,
|
||||
source_x,
|
||||
source_y,
|
||||
dest_x,
|
||||
dest_y,
|
||||
width,
|
||||
height,
|
||||
glyphs,
|
||||
num_glyphs);
|
||||
return _cairo_surface_old_show_glyphs (scaled_font,
|
||||
operator,
|
||||
pattern,
|
||||
surface->current_page,
|
||||
source_x,
|
||||
source_y,
|
||||
dest_x,
|
||||
dest_y,
|
||||
width,
|
||||
height,
|
||||
glyphs,
|
||||
num_glyphs);
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
|
|
@ -511,7 +511,7 @@ static const cairo_surface_backend_t cairo_ps_surface_backend = {
|
|||
NULL, /* set_clip_region */
|
||||
_cairo_ps_surface_intersect_clip_path,
|
||||
_cairo_ps_surface_get_extents,
|
||||
_cairo_ps_surface_show_glyphs,
|
||||
_cairo_ps_surface_old_show_glyphs,
|
||||
_cairo_ps_surface_fill_path
|
||||
};
|
||||
|
||||
|
|
@ -1309,18 +1309,18 @@ _ps_output_intersect_clip_path (void *abstract_surface,
|
|||
|
||||
|
||||
static cairo_int_status_t
|
||||
_ps_output_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_ps_output_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
ps_output_surface_t *surface = abstract_surface;
|
||||
cairo_output_stream_t *stream = surface->parent->stream;
|
||||
|
|
@ -1338,7 +1338,7 @@ _ps_output_show_glyphs (cairo_scaled_font_t *scaled_font,
|
|||
return _ps_output_add_fallback_area (surface, dest_x, dest_y, width, height);
|
||||
|
||||
_cairo_output_stream_printf (stream,
|
||||
"%% _ps_output_show_glyphs\n");
|
||||
"%% _ps_output_old_show_glyphs\n");
|
||||
|
||||
emit_pattern (surface->parent, pattern);
|
||||
|
||||
|
|
@ -1442,7 +1442,7 @@ static const cairo_surface_backend_t ps_output_backend = {
|
|||
NULL, /* set_clip_region */
|
||||
_ps_output_intersect_clip_path,
|
||||
NULL, /* get_extents */
|
||||
_ps_output_show_glyphs,
|
||||
_ps_output_old_show_glyphs,
|
||||
_ps_output_fill_path
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
|
|||
_cairo_quartz_surface_set_clip_region,
|
||||
NULL, /* intersect_clip_path */
|
||||
_cairo_quartz_surface_get_extents,
|
||||
NULL /* show_glyphs */
|
||||
NULL /* old_show_glyphs */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1849,19 +1849,162 @@ _cairo_surface_get_extents (cairo_surface_t *surface,
|
|||
return surface->backend->get_extents (surface, rectangle);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
cairo_scaled_font_t *font;
|
||||
cairo_glyph_t *glyphs;
|
||||
int num_glyphs;
|
||||
} cairo_show_glyphs_info_t;
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_surface_old_show_glyphs_draw_func (void *closure,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *src,
|
||||
cairo_surface_t *dst,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
const cairo_rectangle_t *extents)
|
||||
{
|
||||
cairo_show_glyphs_info_t *glyph_info = closure;
|
||||
cairo_pattern_union_t pattern;
|
||||
cairo_status_t status;
|
||||
|
||||
/* Modifying the glyph array is fine because we know that this function
|
||||
* will be called only once, and we've already made a copy of the
|
||||
* glyphs in the wrapper.
|
||||
*/
|
||||
if (dst_x != 0 || dst_y != 0) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < glyph_info->num_glyphs; ++i)
|
||||
{
|
||||
glyph_info->glyphs[i].x -= dst_x;
|
||||
glyph_info->glyphs[i].y -= dst_y;
|
||||
}
|
||||
}
|
||||
|
||||
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
|
||||
if (!src)
|
||||
src = &pattern.base;
|
||||
|
||||
status = _cairo_surface_old_show_glyphs (glyph_info->font, operator, src,
|
||||
dst,
|
||||
extents->x, extents->y,
|
||||
extents->x - dst_x,
|
||||
extents->y - dst_y,
|
||||
extents->width,
|
||||
extents->height,
|
||||
glyph_info->glyphs,
|
||||
glyph_info->num_glyphs);
|
||||
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
return status;
|
||||
|
||||
status = _cairo_scaled_font_show_glyphs (glyph_info->font,
|
||||
operator,
|
||||
src, dst,
|
||||
extents->x, extents->y,
|
||||
extents->x - dst_x, extents->y - dst_y,
|
||||
extents->width, extents->height,
|
||||
glyph_info->glyphs,
|
||||
glyph_info->num_glyphs);
|
||||
|
||||
if (src == &pattern.base)
|
||||
_cairo_pattern_fini (&pattern.base);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
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,
|
||||
cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_rectangle_t extents, glyph_extents;
|
||||
cairo_show_glyphs_info_t glyph_info;
|
||||
|
||||
status = _cairo_surface_get_extents (dst, &extents);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
if (_cairo_operator_bounded_by_mask (operator)) {
|
||||
status = _cairo_scaled_font_glyph_device_extents (scaled_font,
|
||||
glyphs,
|
||||
num_glyphs,
|
||||
&glyph_extents);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
_cairo_rectangle_intersect (&extents, &glyph_extents);
|
||||
}
|
||||
|
||||
status = _cairo_clip_intersect_to_rectangle (dst->clip, &extents);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
glyph_info.font = scaled_font;
|
||||
glyph_info.glyphs = glyphs;
|
||||
glyph_info.num_glyphs = num_glyphs;
|
||||
|
||||
status = _cairo_gstate_clip_and_composite (dst->clip,
|
||||
operator,
|
||||
source_pattern,
|
||||
_cairo_surface_old_show_glyphs_draw_func,
|
||||
&glyph_info,
|
||||
dst,
|
||||
&extents);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_surface_show_glyphs (cairo_operator_t operator,
|
||||
cairo_pattern_t *source_pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_scaled_font_t *scaled_font,
|
||||
cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
/* cairo_status_t status; */
|
||||
|
||||
assert (! dst->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 (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
return status;
|
||||
}
|
||||
*/
|
||||
|
||||
return _fallback_show_glyphs (operator, source_pattern, dst,
|
||||
scaled_font,
|
||||
glyphs, num_glyphs);
|
||||
}
|
||||
|
||||
/* 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
|
||||
* fallback still uses this old function (which still needs to be
|
||||
* cleaned up in terms of both semantics and naming). */
|
||||
cairo_status_t
|
||||
_cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_status_t status;
|
||||
|
||||
|
|
@ -1873,12 +2016,13 @@ _cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
|||
if (dst->finished)
|
||||
return CAIRO_STATUS_SURFACE_FINISHED;
|
||||
|
||||
if (dst->backend->show_glyphs)
|
||||
status = dst->backend->show_glyphs (scaled_font, operator, pattern, dst,
|
||||
source_x, source_y,
|
||||
dest_x, dest_y,
|
||||
width, height,
|
||||
glyphs, num_glyphs);
|
||||
if (dst->backend->old_show_glyphs)
|
||||
status = dst->backend->old_show_glyphs (scaled_font,
|
||||
operator, pattern, dst,
|
||||
source_x, source_y,
|
||||
dest_x, dest_y,
|
||||
width, height,
|
||||
glyphs, num_glyphs);
|
||||
else
|
||||
status = CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
|
|
|
|||
|
|
@ -1045,7 +1045,7 @@ static const cairo_surface_backend_t cairo_win32_surface_backend = {
|
|||
_cairo_win32_surface_set_clip_region,
|
||||
NULL, /* intersect_clip_path */
|
||||
_cairo_win32_surface_get_extents,
|
||||
NULL, /* show_glyphs */
|
||||
NULL, /* old_show_glyphs */
|
||||
NULL, /* fill_path */
|
||||
NULL, /* get_font_options */
|
||||
_cairo_win32_surface_flush,
|
||||
|
|
|
|||
|
|
@ -1040,7 +1040,7 @@ static const cairo_surface_backend_t cairo_xcb_surface_backend = {
|
|||
NULL, /* _cairo_xcb_surface_set_clip_region */
|
||||
NULL, /* intersect_clip_path */
|
||||
_cairo_xcb_surface_get_extents,
|
||||
NULL, /* show_glyphs */
|
||||
NULL, /* old_show_glyphs */
|
||||
NULL, /* fill_path */
|
||||
NULL, /* get_font_options */
|
||||
NULL, /* flush */
|
||||
|
|
|
|||
|
|
@ -1654,18 +1654,18 @@ _cairo_xlib_surface_get_font_options (void *abstract_surface,
|
|||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs);
|
||||
_cairo_xlib_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs);
|
||||
|
||||
static void
|
||||
_cairo_xlib_surface_scaled_font_fini (cairo_scaled_font_t *scaled_font);
|
||||
|
|
@ -1690,7 +1690,7 @@ static const cairo_surface_backend_t cairo_xlib_surface_backend = {
|
|||
_cairo_xlib_surface_set_clip_region,
|
||||
NULL, /* intersect_clip_path */
|
||||
_cairo_xlib_surface_get_extents,
|
||||
_cairo_xlib_surface_show_glyphs,
|
||||
_cairo_xlib_surface_old_show_glyphs,
|
||||
NULL, /* fill_path */
|
||||
_cairo_xlib_surface_get_font_options,
|
||||
NULL, /* flush */
|
||||
|
|
@ -2201,14 +2201,14 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
|
|||
#define N_STACK_BUF 1024
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_xlib_surface_t *src,
|
||||
cairo_xlib_surface_t *self,
|
||||
int source_x,
|
||||
int source_y,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_xlib_surface_old_show_glyphs8 (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_xlib_surface_t *src,
|
||||
cairo_xlib_surface_t *self,
|
||||
int source_x,
|
||||
int source_y,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
|
||||
XGlyphElt8 *elts = NULL;
|
||||
|
|
@ -2263,14 +2263,14 @@ _cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_xlib_surface_t *src,
|
||||
cairo_xlib_surface_t *self,
|
||||
int source_x,
|
||||
int source_y,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_xlib_surface_old_show_glyphs16 (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_xlib_surface_t *src,
|
||||
cairo_xlib_surface_t *self,
|
||||
int source_x,
|
||||
int source_y,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
|
||||
XGlyphElt16 *elts = NULL;
|
||||
|
|
@ -2325,14 +2325,14 @@ _cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font,
|
|||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_xlib_surface_t *src,
|
||||
cairo_xlib_surface_t *self,
|
||||
int source_x,
|
||||
int source_y,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_xlib_surface_old_show_glyphs32 (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_xlib_surface_t *src,
|
||||
cairo_xlib_surface_t *self,
|
||||
int source_x,
|
||||
int source_y,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
|
||||
XGlyphElt32 *elts = NULL;
|
||||
|
|
@ -2387,18 +2387,18 @@ _cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font,
|
|||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
_cairo_xlib_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs)
|
||||
{
|
||||
cairo_surface_attributes_t attributes;
|
||||
cairo_int_status_t status;
|
||||
|
|
@ -2461,17 +2461,17 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
|||
/* Call the appropriate sub-function. */
|
||||
|
||||
if (max_index < 256)
|
||||
status = _cairo_xlib_surface_show_glyphs8 (scaled_font, operator, src, self,
|
||||
status = _cairo_xlib_surface_old_show_glyphs8 (scaled_font, operator, src, self,
|
||||
source_x + attributes.x_offset - dest_x,
|
||||
source_y + attributes.y_offset - dest_y,
|
||||
glyphs, num_glyphs);
|
||||
else if (max_index < 65536)
|
||||
status = _cairo_xlib_surface_show_glyphs16 (scaled_font, operator, src, self,
|
||||
status = _cairo_xlib_surface_old_show_glyphs16 (scaled_font, operator, src, self,
|
||||
source_x + attributes.x_offset - dest_x,
|
||||
source_y + attributes.y_offset - dest_y,
|
||||
glyphs, num_glyphs);
|
||||
else
|
||||
status = _cairo_xlib_surface_show_glyphs32 (scaled_font, operator, src, self,
|
||||
status = _cairo_xlib_surface_old_show_glyphs32 (scaled_font, operator, src, self,
|
||||
source_x + attributes.x_offset - dest_x,
|
||||
source_y + attributes.y_offset - dest_y,
|
||||
glyphs, num_glyphs);
|
||||
|
|
|
|||
|
|
@ -696,7 +696,7 @@ struct _cairo_surface_backend {
|
|||
* surfaces as glyphs.
|
||||
*/
|
||||
cairo_int_status_t
|
||||
(*show_glyphs) (cairo_scaled_font_t *font,
|
||||
(*old_show_glyphs) (cairo_scaled_font_t *font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *surface,
|
||||
|
|
@ -1620,6 +1620,14 @@ _cairo_surface_fill_path (cairo_operator_t operator,
|
|||
double tolerance,
|
||||
cairo_clip_t *clip,
|
||||
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_glyph_t *glyphs,
|
||||
int num_glyphs);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
|
||||
|
|
@ -1710,18 +1718,18 @@ _cairo_surface_get_extents (cairo_surface_t *surface,
|
|||
cairo_rectangle_t *rectangle);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs);
|
||||
_cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
|
||||
cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *surface,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
const cairo_glyph_t *glyphs,
|
||||
int num_glyphs);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_composite_fixup_unbounded (cairo_surface_t *dst,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue