Add/remove const to cairo_glyph_t* arguments consistently

The rule is: cairo_glyph_t* is always passed as const for measurement
purposes.  This was not reflected in our public api previously.  Fixed

Showing glyphs used to have cairo_glyph_t* always as const.  With this
changed, it is only const on cairo_t and cairo_gstate_t operations.
cairo_surface_t, cairo_scaled_font_t, and individual backends receive
cairo_glyph_t* as non-const.  The desired semantics is that they may modify
the contents of the array as long as they do not return
CAIRO_STATUS_UNSUPPORTED.  This makes it possible to avoid copying the glyph
array again and again, and edit it in-place.  Backends are in fact free to use
the array as a generic buffer as they see fit.
This commit is contained in:
Behdad Esfahbod 2006-12-11 01:39:51 -05:00
parent 70695f5c62
commit 5a9642c574
24 changed files with 47 additions and 53 deletions

View file

@ -154,7 +154,7 @@ static cairo_int_status_t
_cairo_analysis_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -578,7 +578,7 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_atsui_font_t *font = abstract_font;

View file

@ -1450,7 +1450,7 @@ static cairo_int_status_t
_cairo_directfb_surface_show_glyphs ( void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *pattern,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -1909,7 +1909,7 @@ _cairo_glitz_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
int dst_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_glitz_surface_attributes_t attributes;

View file

@ -65,7 +65,7 @@ static void
_cairo_gstate_transform_glyphs_to_backend (cairo_gstate_t *gstate,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_glyph_t *transformed_glyphs);
cairo_glyph_t *transformed_glyphs);
/**
* _cairo_gstate_create:
@ -1447,7 +1447,7 @@ _cairo_gstate_set_font_face (cairo_gstate_t *gstate,
cairo_status_t
_cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
cairo_glyph_t *glyphs,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents)
{
@ -1507,10 +1507,10 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
}
cairo_status_t
_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_path_fixed_t *path)
_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_path_fixed_t *path)
{
cairo_status_t status;
cairo_glyph_t *transformed_glyphs = NULL;

View file

@ -416,7 +416,7 @@ static cairo_int_status_t
_cairo_meta_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -1304,7 +1304,7 @@ static cairo_int_status_t
_cairo_nquartz_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -437,7 +437,7 @@ static cairo_int_status_t
_cairo_paginated_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -2720,7 +2720,7 @@ static cairo_int_status_t
_cairo_pdf_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -2136,7 +2136,7 @@ static cairo_int_status_t
_cairo_ps_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -698,7 +698,7 @@ cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font,
**/
void
cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
cairo_glyph_t *glyphs,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents)
{
@ -891,7 +891,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_status_t status;

View file

@ -74,7 +74,7 @@ cairo_private cairo_status_t
_cairo_surface_fallback_show_glyphs (cairo_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);

View file

@ -839,7 +839,7 @@ _cairo_surface_fallback_fill (cairo_surface_t *surface,
typedef struct {
cairo_scaled_font_t *font;
const cairo_glyph_t *glyphs;
cairo_glyph_t *glyphs;
int num_glyphs;
} cairo_show_glyphs_info_t;
@ -907,7 +907,7 @@ cairo_status_t
_cairo_surface_fallback_show_glyphs (cairo_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -1795,7 +1795,7 @@ cairo_status_t
_cairo_surface_show_glyphs (cairo_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{
@ -1873,7 +1873,7 @@ _cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_status_t status;

View file

@ -1608,7 +1608,7 @@ static cairo_int_status_t
_cairo_svg_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *pattern,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -1151,7 +1151,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_win32_scaled_font_t *scaled_font = abstract_font;

View file

@ -1473,7 +1473,7 @@ static cairo_int_status_t
_cairo_win32_surface_show_glyphs (void *surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -1574,7 +1574,7 @@ static cairo_int_status_t
_cairo_xcb_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
@ -2260,7 +2260,7 @@ static cairo_int_status_t
_cairo_xcb_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -69,7 +69,7 @@ static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
@ -2689,7 +2689,7 @@ static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -2613,7 +2613,7 @@ cairo_text_extents (cairo_t *cr,
**/
void
cairo_glyph_extents (cairo_t *cr,
cairo_glyph_t *glyphs,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents)
{
@ -2749,7 +2749,7 @@ cairo_text_path (cairo_t *cr, const char *utf8)
}
void
cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs)
{
if (cr->status)
return;

View file

@ -954,7 +954,7 @@ cairo_text_extents (cairo_t *cr,
cairo_public void
cairo_glyph_extents (cairo_t *cr,
cairo_glyph_t *glyphs,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents);
@ -962,7 +962,7 @@ cairo_public void
cairo_text_path (cairo_t *cr, const char *utf8);
cairo_public void
cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
/* Generic identifier for a font style */
@ -1062,7 +1062,7 @@ cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font,
cairo_public void
cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
cairo_glyph_t *glyphs,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents);

View file

@ -632,7 +632,7 @@ struct _cairo_scaled_font_backend {
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs);
cairo_int_status_t
@ -855,7 +855,7 @@ struct _cairo_surface_backend {
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs);
void
@ -917,7 +917,7 @@ struct _cairo_surface_backend {
(*show_glyphs) (void *surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
@ -1428,7 +1428,7 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *font,
cairo_private cairo_status_t
_cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
cairo_glyph_t *glyphs,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents);
@ -1438,10 +1438,10 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
int num_glyphs);
cairo_private cairo_status_t
_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_path_fixed_t *path);
_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_path_fixed_t *path);
cairo_private cairo_bool_t
_cairo_operator_bounded_by_mask (cairo_operator_t op);
@ -1684,12 +1684,6 @@ _cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
cairo_glyph_t **glyphs,
int *num_glyphs);
cairo_private cairo_status_t
_cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents);
cairo_private cairo_status_t
_cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
const cairo_glyph_t *glyphs,
@ -1707,7 +1701,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs);
cairo_private cairo_status_t
@ -1858,7 +1852,7 @@ cairo_private cairo_status_t
_cairo_surface_show_glyphs (cairo_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
@ -1957,7 +1951,7 @@ _cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
int dest_y,
unsigned int width,
unsigned int height,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs);
cairo_private cairo_status_t

View file

@ -247,7 +247,7 @@ static cairo_int_status_t
_test_meta_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{

View file

@ -228,7 +228,7 @@ static cairo_int_status_t
_test_paginated_surface_show_glyphs (void *abstract_surface,
cairo_operator_t op,
cairo_pattern_t *source,
const cairo_glyph_t *glyphs,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font)
{