Fix indentation.

This commit is contained in:
Carl Worth 2005-12-21 12:08:57 +00:00
parent 3eb2a252ad
commit 5280c09b7d
7 changed files with 64 additions and 33 deletions

View file

@ -1,3 +1,7 @@
2005-12-21 Carl Worth <cworth@cworth.org>
* src/test-meta-surface.h: Fix indentation.
2005-12-21 Carl Worth <cworth@cworth.org>
* src/cairo-meta-surface-private.h: Remove cruft from old commands

View file

@ -96,7 +96,10 @@ _cairo_array_fini (cairo_array_t *array)
if (array->is_snapshot)
return;
free (array->elements);
if (array->elements) {
free (* array->elements);
free (array->elements);
}
}
/**
@ -127,8 +130,15 @@ _cairo_array_grow_by (cairo_array_t *array, int additional)
while (new_size < required_size)
new_size = new_size * 2;
if (array->elements == NULL) {
array->elements = malloc (sizeof (char *));
if (array->elements == NULL)
return CAIRO_STATUS_NO_MEMORY;
*array->elements = NULL;
}
array->size = new_size;
new_elements = realloc (array->elements,
new_elements = realloc (*array->elements,
array->size * array->element_size);
if (new_elements == NULL) {
@ -136,7 +146,7 @@ _cairo_array_grow_by (cairo_array_t *array, int additional)
return CAIRO_STATUS_NO_MEMORY;
}
array->elements = new_elements;
*array->elements = new_elements;
return CAIRO_STATUS_SUCCESS;
}
@ -181,7 +191,7 @@ _cairo_array_index (cairo_array_t *array, int index)
{
assert (0 <= index && index < array->num_elements);
return (void *) &array->elements[index * array->element_size];
return (void *) &(*array->elements)[index * array->element_size];
}
/**
@ -276,7 +286,7 @@ _cairo_array_allocate (cairo_array_t *array,
assert (array->num_elements + num_elements <= array->size);
*elements = &array->elements[array->num_elements * array->element_size];
*elements = &(*array->elements)[array->num_elements * array->element_size];
array->num_elements += num_elements;
@ -331,7 +341,10 @@ _cairo_user_data_array_fini (cairo_user_data_array_t *array)
cairo_user_data_slot_t *slots;
num_slots = array->num_elements;
slots = (cairo_user_data_slot_t *) array->elements;
if (num_slots == 0)
return;
slots = (cairo_user_data_slot_t *) (*array->elements);
for (i = 0; i < num_slots; i++) {
if (slots[i].user_data != NULL && slots[i].destroy != NULL)
slots[i].destroy (slots[i].user_data);
@ -365,7 +378,10 @@ _cairo_user_data_array_get_data (cairo_user_data_array_t *array,
return NULL;
num_slots = array->num_elements;
slots = (cairo_user_data_slot_t *) array->elements;
if (num_slots == 0)
return NULL;
slots = (cairo_user_data_slot_t *) (*array->elements);
for (i = 0; i < num_slots; i++) {
if (slots[i].key == key)
return slots[i].user_data;
@ -412,16 +428,19 @@ _cairo_user_data_array_set_data (cairo_user_data_array_t *array,
slot = NULL;
num_slots = array->num_elements;
slots = (cairo_user_data_slot_t *) array->elements;
for (i = 0; i < num_slots; i++) {
if (slots[i].key == key) {
slot = &slots[i];
if (slot->destroy && slot->user_data)
slot->destroy (slot->user_data);
break;
}
if (user_data && slots[i].user_data == NULL) {
slot = &slots[i]; /* Have to keep searching for an exact match */
if (num_slots) {
slots = (cairo_user_data_slot_t *) (*array->elements);
for (i = 0; i < num_slots; i++) {
if (slots[i].key == key) {
slot = &slots[i];
if (slot->destroy && slot->user_data)
slot->destroy (slot->user_data);
break;
}
if (user_data && slots[i].user_data == NULL) {
slot = &slots[i]; /* Have to keep searching for an exact match */
}
}
}

View file

@ -104,7 +104,10 @@ _cairo_meta_surface_finish (void *abstract_surface)
}
num_elements = meta->commands.num_elements;
elements = (cairo_command_t **) meta->commands.elements;
if (num_elements == 0)
return CAIRO_STATUS_SUCCESS;
elements = (cairo_command_t **) *meta->commands.elements;
for (i = 0; i < num_elements; i++) {
command = elements[i];
switch (command->type) {
@ -596,16 +599,18 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
cairo_meta_surface_t *meta;
cairo_command_t *command, **elements;
int i, num_elements;
cairo_int_status_t status;
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
cairo_clip_t clip;
meta = (cairo_meta_surface_t *) surface;
status = CAIRO_STATUS_SUCCESS;
num_elements = meta->commands.num_elements;
if (num_elements == 0)
return CAIRO_STATUS_SUCCESS;
_cairo_clip_init (&clip, target);
num_elements = meta->commands.num_elements;
elements = (cairo_command_t **) meta->commands.elements;
elements = (cairo_command_t **) *meta->commands.elements;
for (i = 0; i < num_elements; i++) {
command = elements[i];
switch (command->type) {

View file

@ -898,14 +898,16 @@ _flush_glyphs (cairo_glyph_state_t *state)
if (status)
return status;
if (!ExtTextOutW (state->hdc,
state->start_x, state->last_y,
ETO_GLYPH_INDEX,
NULL,
(WCHAR *)state->glyphs.elements,
state->glyphs.num_elements,
(int *)state->dx.elements)) {
return _cairo_win32_print_gdi_error ("_flush_glyphs");
if (state->glyphs.elements) {
if (!ExtTextOutW (state->hdc,
state->start_x, state->last_y,
ETO_GLYPH_INDEX,
NULL,
(WCHAR *)*state->glyphs.elements,
state->glyphs.num_elements,
(int *)state->dx.elements)) {
return _cairo_win32_print_gdi_error ("_flush_glyphs");
}
}
_cairo_array_truncate (&state->glyphs, 0);

View file

@ -334,7 +334,7 @@ struct _cairo_array {
int size;
int num_elements;
int element_size;
char *elements;
char **elements;
cairo_bool_t is_snapshot;
};

View file

@ -42,8 +42,8 @@ CAIRO_BEGIN_DECLS
cairo_surface_t *
_test_meta_surface_create (cairo_format_t format,
int width,
int height);
int width,
int height);
CAIRO_END_DECLS

View file

@ -90,6 +90,7 @@ xlib-surface
*-svg-rgb24-out.svg
*-test-fallback-argb32-out.png
*-test-meta-argb32-out.png
*-test-paginated-argb32-out.png
*-xcb-out.png
*-xcb-argb32-out.png
*-xcb-rgb24-out.png