summaryrefslogtreecommitdiff
path: root/src/cairo-ps-surface.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2006-06-14 15:00:33 -0400
committerKristian Høgsberg <krh@redhat.com>2006-06-14 15:00:33 -0400
commit2cea3a2710cd4c6eb68e25eadaaf96cdc921ef14 (patch)
tree0259438aeebe5a85dc4f768902ec3b27c7e7655b /src/cairo-ps-surface.c
parent17ea7552355d9925fb99cd4ca98cf38946f99421 (diff)
parent4932d09a06228a08d1c8f4d2892378c004ff3313 (diff)
Merge branch 'svg-rewrite'
Diffstat (limited to 'src/cairo-ps-surface.c')
-rw-r--r--src/cairo-ps-surface.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 00e046855..729639e52 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -44,6 +44,7 @@
#include "cairo-paginated-surface-private.h"
#include "cairo-meta-surface-private.h"
#include "cairo-ft-private.h"
+#include "cairo-output-stream-private.h"
#include <time.h>
#include <zlib.h>
@@ -99,6 +100,7 @@ typedef struct cairo_ps_surface {
* max_column it will not be broken up.
*/
typedef struct _word_wrap_stream {
+ cairo_output_stream_t base;
cairo_output_stream_t *output;
int max_column;
int column;
@@ -121,11 +123,11 @@ _count_word_up_to (const unsigned char *s, int length)
}
static cairo_status_t
-_word_wrap_stream_write (void *closure,
+_word_wrap_stream_write (cairo_output_stream_t *base,
const unsigned char *data,
unsigned int length)
{
- word_wrap_stream_t *stream = closure;
+ word_wrap_stream_t *stream = (word_wrap_stream_t *) base;
cairo_bool_t newline;
int word;
@@ -166,16 +168,11 @@ _word_wrap_stream_write (void *closure,
}
static cairo_status_t
-_word_wrap_stream_close (void *closure)
+_word_wrap_stream_close (cairo_output_stream_t *base)
{
- cairo_status_t status;
- word_wrap_stream_t *stream = closure;
-
- status = _cairo_output_stream_get_status (stream->output);
-
- free (stream);
+ word_wrap_stream_t *stream = (word_wrap_stream_t *) base;
- return status;
+ return _cairo_output_stream_get_status (stream->output);
}
static cairo_output_stream_t *
@@ -187,13 +184,15 @@ _word_wrap_stream_create (cairo_output_stream_t *output, int max_column)
if (stream == NULL)
return (cairo_output_stream_t *) &cairo_output_stream_nil;
+ _cairo_output_stream_init (&stream->base,
+ _word_wrap_stream_write,
+ _word_wrap_stream_close);
stream->output = output;
stream->max_column = max_column;
stream->column = 0;
stream->last_write_was_space = FALSE;
- return _cairo_output_stream_create (_word_wrap_stream_write,
- _word_wrap_stream_close, stream);
+ return &stream->base;
}
static cairo_status_t
@@ -1271,17 +1270,18 @@ _analyze_operation (cairo_ps_surface_t *surface,
#define STRING_ARRAY_MAX_COLUMN 72
typedef struct _string_array_stream {
+ cairo_output_stream_t base;
cairo_output_stream_t *output;
int column;
int string_size;
} string_array_stream_t;
static cairo_status_t
-_string_array_stream_write (void *closure,
- const unsigned char *data,
- unsigned int length)
+_string_array_stream_write (cairo_output_stream_t *base,
+ const unsigned char *data,
+ unsigned int length)
{
- string_array_stream_t *stream = closure;
+ string_array_stream_t *stream = (string_array_stream_t *) base;
unsigned char c;
const unsigned char backslash = '\\';
@@ -1324,17 +1324,15 @@ _string_array_stream_write (void *closure,
}
static cairo_status_t
-_string_array_stream_close (void *closure)
+_string_array_stream_close (cairo_output_stream_t *base)
{
cairo_status_t status;
- string_array_stream_t *stream = closure;
+ string_array_stream_t *stream = (string_array_stream_t *) base;
_cairo_output_stream_printf (stream->output, ")\n");
status = _cairo_output_stream_get_status (stream->output);
- free (stream);
-
return status;
}
@@ -1361,13 +1359,14 @@ _string_array_stream_create (cairo_output_stream_t *output)
if (stream == NULL)
return (cairo_output_stream_t *) &cairo_output_stream_nil;
+ _cairo_output_stream_init (&stream->base,
+ _string_array_stream_write,
+ _string_array_stream_close);
stream->output = output;
stream->column = 0;
stream->string_size = 0;
- return _cairo_output_stream_create (_string_array_stream_write,
- _string_array_stream_close,
- stream);
+ return &stream->base;
}
/* PS Output - this section handles output of the parts of the meta