Rewrite postscript backend to generate more interesting output than the current big-image implementation, using meta surfaces for font subsetting and image fallbacks.

Remove obsolete comment.
Make a couple of stylistic changes and add _cairo_output_stream_write_hex_string.
Add _cairo_surface_intersect_clip_path so we can replay path clipping.
This commit is contained in:
Kristian Høgsberg 2005-07-01 12:45:35 +00:00
parent 7ab5dbfa75
commit 7a923e6ddd
6 changed files with 1185 additions and 189 deletions

View file

@ -1,3 +1,18 @@
2005-07-01 Kristian Høgsberg <krh@redhat.com>
* src/cairo-ps-surface.c: Rewrite postscript backend to generate
more interesting output than the current big-image implementation,
using meta surfaces for font subsetting and image fallbacks.
* src/cairo-meta-surface.c: Remove obsolete comment.
* src/cairoint.h:
* src/cairo-output-stream.c: Make a couple of stylistic changes
and add _cairo_output_stream_write_hex_string.
* src/cairo-surface.c: Add _cairo_surface_intersect_clip_path so
we can replay path clipping.
2005-07-01 Kristian Høgsberg <krh@redhat.com>
* src/cairo-meta-surface-private.h:

View file

@ -43,12 +43,6 @@
* fallbacks. For example, when determining the font subsets or the
* fallback areas. Hmm... but maybe those passes could be integrated
* into the delegation wrappers and the ps output pass, respectively.
*
* Don't want to mark a valid NULL pattern as a error object, which is
* what we do if we set pattern->status = CAIRO_STATUS_NULL_POINTER.
* We could make a CAIRO_PATTERN_TYPE_NULL alternatively. Btw. what
* about a CAIRO_PATTERN_TYPE_ERROR for pattern->status !=
* CAIRO_STATUS_SUCCESS cases?
*/
static const cairo_surface_backend_t cairo_meta_surface_backend;

View file

@ -90,6 +90,26 @@ _cairo_output_stream_write (cairo_output_stream_t *stream,
return stream->status;
}
void
_cairo_output_stream_write_hex_string (cairo_output_stream_t *stream,
const char *data,
size_t length)
{
const char hex_chars[] = "0123456789abcdef";
char buffer[2];
int i, column;
for (i = 0, column = 0; i < length; i++, column++) {
if (column == 38) {
_cairo_output_stream_write (stream, "\n", 1);
column = 0;
}
buffer[0] = hex_chars[(data[i] >> 4) & 0x0f];
buffer[1] = hex_chars[data[i] & 0x0f];
_cairo_output_stream_write (stream, buffer, 2);
}
}
/* Format a double in a locale independent way and trim trailing
* zeros. Based on code from Alex Larson <alexl@redhat.com>.
* http://mail.gnome.org/archives/gtk-devel-list/2001-October/msg00087.html
@ -187,8 +207,8 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream,
switch (*f | length_modifier) {
case '%':
p[0] = *f;
p[1] = 0;
buffer[0] = *f;
buffer[1] = 0;
break;
case 'd':
snprintf (buffer, sizeof buffer, "%d", va_arg (ap, int));
@ -211,6 +231,10 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream,
case 'f':
dtostr (buffer, sizeof buffer, va_arg (ap, double));
break;
case 'c':
buffer[0] = va_arg (ap, int);
buffer[1] = 0;
break;
default:
ASSERT_NOT_REACHED;
}

File diff suppressed because it is too large Load diff

View file

@ -889,6 +889,23 @@ _cairo_surface_set_clip_region (cairo_surface_t *surface,
return surface->backend->set_clip_region (surface, region);
}
cairo_private cairo_int_status_t
_cairo_surface_intersect_clip_path (cairo_surface_t *surface,
cairo_path_fixed_t *path,
cairo_fill_rule_t fill_rule,
double tolerance)
{
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
assert (surface->backend->intersect_clip_path != NULL);
return surface->backend->intersect_clip_path (surface,
path,
fill_rule,
tolerance);
}
static cairo_status_t
_cairo_surface_set_clip_path_recursive (cairo_surface_t *surface,
cairo_clip_path_t *clip_path)

View file

@ -1543,6 +1543,12 @@ _cairo_surface_set_clip_region (cairo_surface_t *surface,
pixman_region16_t *region,
unsigned int serial);
cairo_private cairo_int_status_t
_cairo_surface_intersect_clip_path (cairo_surface_t *surface,
cairo_path_fixed_t *path,
cairo_fill_rule_t fill_rule,
double tolerance);
typedef struct _cairo_clip_path cairo_clip_path_t;
cairo_private cairo_status_t
@ -1830,6 +1836,11 @@ cairo_private cairo_status_t
_cairo_output_stream_write (cairo_output_stream_t *stream,
const void *data, size_t length);
cairo_private void
_cairo_output_stream_write_hex_string (cairo_output_stream_t *stream,
const char *data,
size_t length);
cairo_private cairo_status_t
_cairo_output_stream_vprintf (cairo_output_stream_t *stream,
const char *fmt, va_list ap);