[cairo-commit] 5 commits - doc/public src/cairo-bentley-ottmann.c
src/cairo-cff-subset.c src/cairo-glitz-surface.c
src/cairoint.h src/cairo-pdf-surface.c src/cairo-ps-surface.c
src/cairo-svg-surface.c src/cairo-truetype-subset.c
src/cairo-type1-fallback.c src/cairo-type1-private.h
src/cairo-type1-subset.c src/Makefile.am
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Mar 7 13:02:18 PST 2007
doc/public/Headers.mk | 1
src/Makefile.am | 1
src/cairo-bentley-ottmann.c | 2
src/cairo-cff-subset.c | 28 ---------
src/cairo-glitz-surface.c | 8 +-
src/cairo-pdf-surface.c | 74 +++++++++++------------
src/cairo-ps-surface.c | 52 ++++++++--------
src/cairo-svg-surface.c | 136 ++++++++++++++++++++++----------------------
src/cairo-truetype-subset.c | 37 -----------
src/cairo-type1-fallback.c | 14 +---
src/cairo-type1-private.h | 45 ++++++++++++++
src/cairo-type1-subset.c | 18 ++---
src/cairoint.h | 35 +++++++++++
13 files changed, 230 insertions(+), 221 deletions(-)
New commits:
diff-tree c07867c545d7ab7c4a104944768f8a5b69ef9596 (from 88632575bfae348a63e3e6228d5ceaa64715ae5f)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Mar 7 15:55:02 2007 -0500
[glitz] Mark some constant static structures as const
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index 46c7989..b9e4f72 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -594,7 +594,7 @@ _cairo_glitz_pattern_acquire_surface (ca
unsigned int *pixels;
unsigned int i, n_base_params;
glitz_buffer_t *buffer;
- static glitz_pixel_format_t format = {
+ static const glitz_pixel_format_t format = {
GLITZ_FOURCC_RGB,
{
32,
@@ -976,7 +976,7 @@ _cairo_glitz_surface_fill_rectangles (vo
(glitz_rectangle_t *) rects, n_rects);
} break;
case CAIRO_OPERATOR_CLEAR: {
- static glitz_color_t glitz_color = { 0, 0, 0, 0 };
+ static const glitz_color_t glitz_color = { 0, 0, 0, 0 };
glitz_set_rectangles (dst->surface, &glitz_color,
(glitz_rectangle_t *) rects, n_rects);
@@ -1095,7 +1095,7 @@ _cairo_glitz_surface_composite_trapezoid
if (op == CAIRO_OPERATOR_ADD || n_traps <= 1)
{
- static glitz_color_t clear_black = { 0, 0, 0, 0 };
+ static const glitz_color_t clear_black = { 0, 0, 0, 0 };
glitz_color_t color;
glitz_geometry_format_t format;
int n_trap_added;
@@ -1941,7 +1941,7 @@ _cairo_glitz_surface_old_show_glyphs (ca
int i, cached_glyphs = 0;
int remaining_glyps = num_glyphs;
glitz_float_t x1, y1, x2, y2;
- static glitz_vertex_format_t format = {
+ static const glitz_vertex_format_t format = {
GLITZ_PRIMITIVE_QUADS,
GLITZ_DATA_TYPE_FLOAT,
sizeof (glitz_float_t) * 4,
diff-tree 88632575bfae348a63e3e6228d5ceaa64715ae5f (from 2cc1c73705d70f834b43996f70080860ac66e57d)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Mar 7 15:54:20 2007 -0500
[PS/PDF/SVG] Rename internal symbols to have _cairo_*_surface prefix
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index b4fa30e..924b80c 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -657,7 +657,7 @@ compress_dup (const void *data, unsigned
* no SMask object will be emitted and *id_ret will be set to 0.
*/
static cairo_status_t
-emit_smask (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_emit_smask (cairo_pdf_surface_t *surface,
cairo_image_surface_t *image,
cairo_pdf_resource_t *stream_ret)
{
@@ -728,7 +728,7 @@ emit_smask (cairo_pdf_surface_t *surfac
/* Emit image data into the given surface, providing a resource that
* can be used to reference the data in image_ret. */
static cairo_status_t
-emit_image (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_emit_image (cairo_pdf_surface_t *surface,
cairo_image_surface_t *image,
cairo_pdf_resource_t *image_ret)
{
@@ -747,7 +747,7 @@ emit_image (cairo_pdf_surface_t *surfac
/* These are the only image formats we currently support, (which
* makes things a lot simpler here). This is enforced through
- * _analyze_operation which only accept source surfaces of
+ * _cairo_pdf_surface_analyze_operation which only accept source surfaces of
* CONTENT_COLOR or CONTENT_COLOR_ALPHA.
*/
assert (image->format == CAIRO_FORMAT_RGB24 || image->format == CAIRO_FORMAT_ARGB32);
@@ -797,7 +797,7 @@ emit_image (cairo_pdf_surface_t *surfac
need_smask = FALSE;
if (image->format == CAIRO_FORMAT_ARGB32) {
- status = emit_smask (surface, image, &smask);
+ status = _cairo_pdf_surface_emit_smask (surface, image, &smask);
if (status)
goto CLEANUP_COMPRESSED;
@@ -841,7 +841,7 @@ emit_image (cairo_pdf_surface_t *surfac
}
static cairo_status_t
-emit_solid_pattern (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_emit_solid_pattern (cairo_pdf_surface_t *surface,
cairo_solid_pattern_t *pattern)
{
cairo_pdf_resource_t alpha;
@@ -866,7 +866,7 @@ emit_solid_pattern (cairo_pdf_surface_t
}
static cairo_status_t
-emit_surface_pattern (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_emit_surface_pattern (cairo_pdf_surface_t *surface,
cairo_surface_pattern_t *pattern)
{
cairo_pdf_resource_t stream;
@@ -896,7 +896,7 @@ emit_surface_pattern (cairo_pdf_surface_
if (status)
goto BAIL2;
- status = emit_image (surface, image, &image_resource);
+ status = _cairo_pdf_surface_emit_image (surface, image, &image_resource);
if (status)
goto BAIL;
@@ -1036,7 +1036,7 @@ typedef struct _cairo_pdf_color_stop {
} cairo_pdf_color_stop_t;
static cairo_pdf_resource_t
-emit_linear_colorgradient (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_emit_linear_colorgradient (cairo_pdf_surface_t *surface,
cairo_pdf_color_stop_t *stop1,
cairo_pdf_color_stop_t *stop2)
{
@@ -1065,7 +1065,7 @@ emit_linear_colorgradient (cairo_pdf_sur
}
static cairo_pdf_resource_t
-emit_stitched_colorgradient (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_emit_stitched_colorgradient (cairo_pdf_surface_t *surface,
unsigned int n_stops,
cairo_pdf_color_stop_t stops[])
{
@@ -1074,7 +1074,7 @@ emit_stitched_colorgradient (cairo_pdf_s
/* emit linear gradients between pairs of subsequent stops... */
for (i = 0; i < n_stops-1; i++) {
- stops[i].gradient = emit_linear_colorgradient (surface,
+ stops[i].gradient = _cairo_pdf_surface_emit_linear_colorgradient (surface,
&stops[i],
&stops[i+1]);
}
@@ -1127,7 +1127,7 @@ emit_stitched_colorgradient (cairo_pdf_s
#define COLOR_STOP_EPSILON 1e-6
static cairo_pdf_resource_t
-emit_pattern_stops (cairo_pdf_surface_t *surface, cairo_gradient_pattern_t *pattern)
+_cairo_pdf_surface_emit_pattern_stops (cairo_pdf_surface_t *surface, cairo_gradient_pattern_t *pattern)
{
cairo_pdf_resource_t function;
cairo_pdf_color_stop_t *allstops, *stops;
@@ -1170,11 +1170,11 @@ emit_pattern_stops (cairo_pdf_surface_t
if (n_stops == 2) {
/* no need for stitched function */
- function = emit_linear_colorgradient (surface, &stops[0], &stops[1]);
+ function = _cairo_pdf_surface_emit_linear_colorgradient (surface, &stops[0], &stops[1]);
} else {
/* multiple stops: stitch. XXX possible optimization: regulary spaced
* stops do not require stitching. XXX */
- function = emit_stitched_colorgradient (surface,
+ function = _cairo_pdf_surface_emit_stitched_colorgradient (surface,
n_stops,
stops);
}
@@ -1185,7 +1185,7 @@ emit_pattern_stops (cairo_pdf_surface_t
}
static cairo_status_t
-emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *pattern)
+_cairo_pdf_surface_emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *pattern)
{
cairo_pdf_resource_t function, pattern_resource, alpha;
double x0, y0, x1, y1;
@@ -1193,7 +1193,7 @@ emit_linear_pattern (cairo_pdf_surface_t
_cairo_pdf_surface_pause_content_stream (surface);
- function = emit_pattern_stops (surface, &pattern->base);
+ function = _cairo_pdf_surface_emit_pattern_stops (surface, &pattern->base);
if (function.id == 0)
return CAIRO_STATUS_NO_MEMORY;
@@ -1248,7 +1248,7 @@ emit_linear_pattern (cairo_pdf_surface_t
}
static cairo_status_t
-emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *pattern)
+_cairo_pdf_surface_emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *pattern)
{
cairo_pdf_resource_t function, pattern_resource, alpha;
double x0, y0, x1, y1, r0, r1;
@@ -1256,7 +1256,7 @@ emit_radial_pattern (cairo_pdf_surface_t
_cairo_pdf_surface_pause_content_stream (surface);
- function = emit_pattern_stops (surface, &pattern->base);
+ function = _cairo_pdf_surface_emit_pattern_stops (surface, &pattern->base);
if (function.id == 0)
return CAIRO_STATUS_NO_MEMORY;
@@ -1324,20 +1324,20 @@ emit_radial_pattern (cairo_pdf_surface_t
}
static cairo_status_t
-emit_pattern (cairo_pdf_surface_t *surface, cairo_pattern_t *pattern)
+_cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pattern_t *pattern)
{
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
- return emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
+ return _cairo_pdf_surface_emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
case CAIRO_PATTERN_TYPE_SURFACE:
- return emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern);
+ return _cairo_pdf_surface_emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern);
case CAIRO_PATTERN_TYPE_LINEAR:
- return emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern);
+ return _cairo_pdf_surface_emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern);
case CAIRO_PATTERN_TYPE_RADIAL:
- return emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern);
+ return _cairo_pdf_surface_emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern);
}
@@ -2615,7 +2615,7 @@ _cairo_pdf_test_force_fallbacks (void)
}
static cairo_int_status_t
-_operation_supported (cairo_pdf_surface_t *surface,
+__cairo_pdf_surface_operation_supported (cairo_pdf_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *pattern)
{
@@ -2634,11 +2634,11 @@ _operation_supported (cairo_pdf_surface_
}
static cairo_int_status_t
-_analyze_operation (cairo_pdf_surface_t *surface,
+_cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *pattern)
{
- if (_operation_supported (surface, op, pattern))
+ if (__cairo_pdf_surface_operation_supported (surface, op, pattern))
return CAIRO_STATUS_SUCCESS;
else
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -2653,7 +2653,7 @@ _cairo_pdf_surface_paint (void *abstra
cairo_status_t status;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_pdf_surface_analyze_operation (surface, op, source);
/* XXX: It would be nice to be able to assert this condition
* here. But, we actually allow one 'cheat' that is used when
@@ -2662,10 +2662,10 @@ _cairo_pdf_surface_paint (void *abstra
* possible only because there is nothing between the fallback
* images and the paper, nor is anything painted above. */
/*
- assert (_operation_supported (op, source));
+ assert (__cairo_pdf_surface_operation_supported (op, source));
*/
- status = emit_pattern (surface, source);
+ status = _cairo_pdf_surface_emit_pattern (surface, source);
if (status)
return status;
@@ -2774,11 +2774,11 @@ _cairo_pdf_surface_stroke (void *abstr
cairo_status_t status;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_pdf_surface_analyze_operation (surface, op, source);
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_pdf_surface_operation_supported (surface, op, source));
- status = emit_pattern (surface, source);
+ status = _cairo_pdf_surface_emit_pattern (surface, source);
if (status)
return status;
@@ -2823,11 +2823,11 @@ _cairo_pdf_surface_fill (void *abstrac
pdf_path_info_t info;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_pdf_surface_analyze_operation (surface, op, source);
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_pdf_surface_operation_supported (surface, op, source));
- status = emit_pattern (surface, source);
+ status = _cairo_pdf_surface_emit_pattern (surface, source);
if (status)
return status;
@@ -2876,11 +2876,11 @@ _cairo_pdf_surface_show_glyphs (void *
int i;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_pdf_surface_analyze_operation (surface, op, source);
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_pdf_surface_operation_supported (surface, op, source));
- status = emit_pattern (surface, source);
+ status = _cairo_pdf_surface_emit_pattern (surface, source);
if (status)
return status;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 522cdb6..5f43e98 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1404,7 +1404,7 @@ _cairo_ps_test_force_fallbacks (void)
}
static cairo_int_status_t
-operation_supported (cairo_ps_surface_t *surface,
+_cairo_ps_surface_operation_supported (cairo_ps_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern)
{
@@ -1424,11 +1424,11 @@ operation_supported (cairo_ps_surface_t
}
static cairo_int_status_t
-_analyze_operation (cairo_ps_surface_t *surface,
+_cairo_ps_surface_analyze_operation (cairo_ps_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern)
{
- if (operation_supported (surface, op, pattern))
+ if (_cairo_ps_surface_operation_supported (surface, op, pattern))
return CAIRO_STATUS_SUCCESS;
else
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1558,7 +1558,7 @@ _string_array_stream_create (cairo_outpu
* surface we can render natively in PS. */
static cairo_status_t
-emit_image (cairo_ps_surface_t *surface,
+_cairo_ps_surface_emit_image (cairo_ps_surface_t *surface,
cairo_image_surface_t *image,
const char *name)
{
@@ -1690,7 +1690,7 @@ emit_image (cairo_ps_surface_t *surfa
}
static void
-emit_solid_pattern (cairo_ps_surface_t *surface,
+_cairo_ps_surface_emit_solid_pattern (cairo_ps_surface_t *surface,
cairo_solid_pattern_t *pattern)
{
if (color_is_gray (&pattern->color))
@@ -1706,7 +1706,7 @@ emit_solid_pattern (cairo_ps_surface_t *
}
static void
-emit_surface_pattern (cairo_ps_surface_t *surface,
+_cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t *surface,
cairo_surface_pattern_t *pattern)
{
double bbox_width, bbox_height;
@@ -1733,7 +1733,7 @@ emit_surface_pattern (cairo_ps_surface_t
&image_extra);
assert (status == CAIRO_STATUS_SUCCESS);
- emit_image (surface, image, "MyPattern");
+ _cairo_ps_surface_emit_image (surface, image, "MyPattern");
bbox_width = image->width;
bbox_height = image->height;
@@ -1808,21 +1808,21 @@ emit_surface_pattern (cairo_ps_surface_t
}
static void
-emit_linear_pattern (cairo_ps_surface_t *surface,
+_cairo_ps_surface_emit_linear_pattern (cairo_ps_surface_t *surface,
cairo_linear_pattern_t *pattern)
{
/* XXX: NYI */
}
static void
-emit_radial_pattern (cairo_ps_surface_t *surface,
+_cairo_ps_surface_emit_radial_pattern (cairo_ps_surface_t *surface,
cairo_radial_pattern_t *pattern)
{
/* XXX: NYI */
}
static void
-emit_pattern (cairo_ps_surface_t *surface, cairo_pattern_t *pattern)
+_cairo_ps_surface_emit_pattern (cairo_ps_surface_t *surface, cairo_pattern_t *pattern)
{
/* FIXME: We should keep track of what pattern is currently set in
* the postscript file and only emit code if we're setting a
@@ -1830,19 +1830,19 @@ emit_pattern (cairo_ps_surface_t *surfac
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
- emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
+ _cairo_ps_surface_emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern);
break;
case CAIRO_PATTERN_TYPE_SURFACE:
- emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern);
+ _cairo_ps_surface_emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern);
break;
case CAIRO_PATTERN_TYPE_LINEAR:
- emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern);
+ _cairo_ps_surface_emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern);
break;
case CAIRO_PATTERN_TYPE_RADIAL:
- emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern);
+ _cairo_ps_surface_emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern);
break;
}
}
@@ -1932,7 +1932,7 @@ _cairo_ps_surface_paint (void *abstrac
cairo_rectangle_int16_t extents, pattern_extents;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_ps_surface_analyze_operation (surface, op, source);
/* XXX: It would be nice to be able to assert this condition
* here. But, we actually allow one 'cheat' that is used when
@@ -1941,7 +1941,7 @@ _cairo_ps_surface_paint (void *abstrac
* possible only because there is nothing between the fallback
* images and the paper, nor is anything painted above. */
/*
- assert (_operation_supported (op, source));
+ assert (__cairo_ps_surface_operation_supported (op, source));
*/
_cairo_output_stream_printf (stream,
@@ -1951,7 +1951,7 @@ _cairo_ps_surface_paint (void *abstrac
_cairo_pattern_get_extents (source, &pattern_extents);
_cairo_rectangle_intersect (&extents, &pattern_extents);
- emit_pattern (surface, source);
+ _cairo_ps_surface_emit_pattern (surface, source);
_cairo_output_stream_printf (stream, "%d %d M\n",
extents.x, extents.y);
@@ -2019,9 +2019,9 @@ _cairo_ps_surface_stroke (void *abstra
double dash_offset = style->dash_offset;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_ps_surface_analyze_operation (surface, op, source);
- assert (operation_supported (surface, op, source));
+ assert (_cairo_ps_surface_operation_supported (surface, op, source));
_cairo_output_stream_printf (stream,
@@ -2090,7 +2090,7 @@ _cairo_ps_surface_stroke (void *abstra
}
}
- emit_pattern (surface, source);
+ _cairo_ps_surface_emit_pattern (surface, source);
_cairo_output_stream_printf (stream,
"gsave\n");
@@ -2150,14 +2150,14 @@ _cairo_ps_surface_fill (void *abstract_
const char *ps_operator;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_ps_surface_analyze_operation (surface, op, source);
- assert (operation_supported (surface, op, source));
+ assert (_cairo_ps_surface_operation_supported (surface, op, source));
_cairo_output_stream_printf (stream,
"%% _cairo_ps_surface_fill\n");
- emit_pattern (surface, source);
+ _cairo_ps_surface_emit_pattern (surface, source);
/* We're filling not stroking, so we pass CAIRO_LINE_CAP_ROUND. */
status = _cairo_ps_surface_emit_path (surface, stream, path,
@@ -2208,9 +2208,9 @@ _cairo_ps_surface_show_glyphs (void
cairo_output_stream_t *word_wrap;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_ps_surface_analyze_operation (surface, op, source);
- assert (operation_supported (surface, op, source));
+ assert (_cairo_ps_surface_operation_supported (surface, op, source));
_cairo_output_stream_printf (stream,
"%% _cairo_ps_surface_show_glyphs\n");
@@ -2220,7 +2220,7 @@ _cairo_ps_surface_show_glyphs (void
num_glyphs_unsigned = num_glyphs;
- emit_pattern (surface, source);
+ _cairo_ps_surface_emit_pattern (surface, source);
glyph_ids = malloc (num_glyphs_unsigned*sizeof (cairo_ps_glyph_id_t));
if (glyph_ids == NULL)
return CAIRO_STATUS_NO_MEMORY;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 4e318c1..fdd4993 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -477,7 +477,7 @@ _cairo_svg_surface_show_page (void *abst
}
static void
-emit_transform (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_transform (cairo_output_stream_t *output,
char const *attribute_str,
char const *trailer,
cairo_matrix_t *matrix)
@@ -565,7 +565,7 @@ _cairo_svg_path_close_path (void *closur
}
static cairo_status_t
-emit_path (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_path (cairo_output_stream_t *output,
cairo_path_fixed_t *path,
cairo_matrix_t *ctm_inverse)
{
@@ -608,7 +608,7 @@ _cairo_svg_document_emit_outline_glyph_d
_cairo_output_stream_printf (document->xml_node_glyphs,
"<path style=\"stroke: none;\" ");
- status = emit_path (document->xml_node_glyphs, scaled_glyph->path, NULL);
+ status = _cairo_svg_surface_emit_path (document->xml_node_glyphs, scaled_glyph->path, NULL);
_cairo_output_stream_printf (document->xml_node_glyphs,
"/>\n");
@@ -644,7 +644,7 @@ _cairo_svg_document_emit_bitmap_glyph_da
}
_cairo_output_stream_printf (document->xml_node_glyphs, "<g");
- emit_transform (document->xml_node_glyphs, " transform", ">/n", &image->base.device_transform);
+ _cairo_svg_surface_emit_transform (document->xml_node_glyphs, " transform", ">/n", &image->base.device_transform);
for (y = 0, row = image->data, rows = image->height; rows; row += image->stride, rows--, y++) {
for (x = 0, byte = row, cols = (image->width + 7) / 8; cols; byte++, cols--) {
@@ -737,7 +737,7 @@ _cairo_svg_test_force_fallbacks (void)
}
static cairo_int_status_t
-_operation_supported (cairo_svg_surface_t *surface,
+__cairo_svg_surface_operation_supported (cairo_svg_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern)
{
@@ -754,11 +754,11 @@ _operation_supported (cairo_svg_surface_
}
static cairo_int_status_t
-_analyze_operation (cairo_svg_surface_t *surface,
+_cairo_svg_surface_analyze_operation (cairo_svg_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern)
{
- if (_operation_supported (surface, op, pattern))
+ if (__cairo_svg_surface_operation_supported (surface, op, pattern))
return CAIRO_STATUS_SUCCESS;
else
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -801,7 +801,7 @@ _cairo_svg_surface_finish (void *abstrac
}
static void
-emit_alpha_filter (cairo_svg_document_t *document)
+_cairo_svg_surface_emit_alpha_filter (cairo_svg_document_t *document)
{
if (document->alpha_filter)
return;
@@ -916,7 +916,7 @@ _cairo_surface_base64_encode (cairo_surf
}
static cairo_status_t
-emit_composite_image_pattern (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_composite_image_pattern (cairo_output_stream_t *output,
cairo_svg_surface_t *svg_surface,
cairo_surface_pattern_t *pattern,
int pattern_id,
@@ -950,7 +950,7 @@ emit_composite_image_pattern (cairo_outp
"width=\"%d\" height=\"%d\"",
pattern_id,
extents.width, extents.height);
- emit_transform (output, " patternTransform", ">\n", &p2u);
+ _cairo_svg_surface_emit_transform (output, " patternTransform", ">\n", &p2u);
}
_cairo_output_stream_printf (output,
@@ -958,7 +958,7 @@ emit_composite_image_pattern (cairo_outp
extents.width, extents.height);
if (pattern_id == invalid_pattern_id)
- emit_transform (output, " transform", "", &p2u);
+ _cairo_svg_surface_emit_transform (output, " transform", "", &p2u);
if (extra_attributes)
_cairo_output_stream_printf (output, " %s", extra_attributes);
@@ -979,7 +979,7 @@ emit_composite_image_pattern (cairo_outp
}
static int
-emit_meta_surface (cairo_svg_document_t *document,
+_cairo_svg_surface_emit_meta_surface (cairo_svg_document_t *document,
cairo_meta_surface_t *surface)
{
cairo_surface_t *paginated_surface;
@@ -1021,7 +1021,7 @@ emit_meta_surface (cairo_svg_document_t
_cairo_array_append (&document->meta_snapshots, &new_snapshot);
if (meta->content == CAIRO_CONTENT_ALPHA) {
- emit_alpha_filter (document);
+ _cairo_svg_surface_emit_alpha_filter (document);
_cairo_output_stream_printf (document->xml_node_defs,
"<g id=\"surface%d\" "
"clip-path=\"url(#clip%d)\" "
@@ -1066,7 +1066,7 @@ emit_meta_surface (cairo_svg_document_t
}
static cairo_status_t
-emit_composite_meta_pattern (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_composite_meta_pattern (cairo_output_stream_t *output,
cairo_svg_surface_t *surface,
cairo_surface_pattern_t *pattern,
int pattern_id,
@@ -1079,7 +1079,7 @@ emit_composite_meta_pattern (cairo_outpu
meta_surface = (cairo_meta_surface_t *) pattern->surface;
- id = emit_meta_surface (document, meta_surface);
+ id = _cairo_svg_surface_emit_meta_surface (document, meta_surface);
p2u = pattern->base.matrix;
cairo_matrix_invert (&p2u);
@@ -1092,7 +1092,7 @@ emit_composite_meta_pattern (cairo_outpu
pattern_id,
meta_surface->width_pixels,
meta_surface->height_pixels);
- emit_transform (output, " patternTransform", ">\n", &p2u);
+ _cairo_svg_surface_emit_transform (output, " patternTransform", ">\n", &p2u);
}
_cairo_output_stream_printf (output,
@@ -1100,7 +1100,7 @@ emit_composite_meta_pattern (cairo_outpu
id);
if (pattern_id == invalid_pattern_id)
- emit_transform (output, " transform", "", &p2u);
+ _cairo_svg_surface_emit_transform (output, " transform", "", &p2u);
if (extra_attributes)
_cairo_output_stream_printf (output, " %s", extra_attributes);
@@ -1114,7 +1114,7 @@ emit_composite_meta_pattern (cairo_outpu
}
static cairo_status_t
-emit_composite_pattern (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_composite_pattern (cairo_output_stream_t *output,
cairo_svg_surface_t *surface,
cairo_surface_pattern_t *pattern,
int pattern_id,
@@ -1122,16 +1122,16 @@ emit_composite_pattern (cairo_output_str
{
if (_cairo_surface_is_meta (pattern->surface)) {
- return emit_composite_meta_pattern (output, surface, pattern,
+ return _cairo_svg_surface_emit_composite_meta_pattern (output, surface, pattern,
pattern_id, extra_attributes);
}
- return emit_composite_image_pattern (output, surface, pattern,
+ return _cairo_svg_surface_emit_composite_image_pattern (output, surface, pattern,
pattern_id, extra_attributes);
}
static void
-emit_operator (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_operator (cairo_output_stream_t *output,
cairo_svg_surface_t *surface,
cairo_operator_t op)
{
@@ -1153,7 +1153,7 @@ emit_operator (cairo_output_stream_t *ou
}
static void
-emit_solid_pattern (cairo_svg_surface_t *surface,
+_cairo_svg_surface_emit_solid_pattern (cairo_svg_surface_t *surface,
cairo_solid_pattern_t *pattern,
cairo_output_stream_t *style,
cairo_bool_t is_stroke)
@@ -1169,7 +1169,7 @@ emit_solid_pattern (cairo_svg_surface_t
}
static void
-emit_surface_pattern (cairo_svg_surface_t *surface,
+_cairo_svg_surface_emit_surface_pattern (cairo_svg_surface_t *surface,
cairo_surface_pattern_t *pattern,
cairo_output_stream_t *style,
cairo_bool_t is_stroke)
@@ -1178,7 +1178,7 @@ emit_surface_pattern (cairo_svg_surface_
int pattern_id;
pattern_id = document->pattern_id++;
- emit_composite_pattern (document->xml_node_defs, surface, pattern,
+ _cairo_svg_surface_emit_composite_pattern (document->xml_node_defs, surface, pattern,
pattern_id, NULL);
_cairo_output_stream_printf (style,
@@ -1188,7 +1188,7 @@ emit_surface_pattern (cairo_svg_surface_
}
static void
-emit_pattern_stops (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t *output,
cairo_gradient_pattern_t const *pattern,
double start_offset,
cairo_bool_t reverse_stops,
@@ -1350,7 +1350,7 @@ emit_pattern_stops (cairo_output_stream_
}
static void
-emit_pattern_extend (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_pattern_extend (cairo_output_stream_t *output,
cairo_pattern_t *pattern)
{
switch (pattern->extend) {
@@ -1367,7 +1367,7 @@ emit_pattern_extend (cairo_output_stream
}
static void
-emit_linear_pattern (cairo_svg_surface_t *surface,
+_cairo_svg_surface_emit_linear_pattern (cairo_svg_surface_t *surface,
cairo_linear_pattern_t *pattern,
cairo_output_stream_t *style,
cairo_bool_t is_stroke)
@@ -1388,12 +1388,12 @@ emit_linear_pattern (cairo_svg_surface_t
document->linear_pattern_id,
x0, y0, x1, y1);
- emit_pattern_extend (document->xml_node_defs, &pattern->base.base),
+ _cairo_svg_surface_emit_pattern_extend (document->xml_node_defs, &pattern->base.base),
p2u = pattern->base.base.matrix;
cairo_matrix_invert (&p2u);
- emit_transform (document->xml_node_defs, "gradientTransform", ">\n", &p2u);
+ _cairo_svg_surface_emit_transform (document->xml_node_defs, "gradientTransform", ">\n", &p2u);
- emit_pattern_stops (document->xml_node_defs ,&pattern->base, 0.0, FALSE, FALSE);
+ _cairo_svg_surface_emit_pattern_stops (document->xml_node_defs ,&pattern->base, 0.0, FALSE, FALSE);
_cairo_output_stream_printf (document->xml_node_defs,
"</linearGradient>\n");
@@ -1407,7 +1407,7 @@ emit_linear_pattern (cairo_svg_surface_t
}
static void
-emit_radial_pattern (cairo_svg_surface_t *surface,
+_cairo_svg_surface_emit_radial_pattern (cairo_svg_surface_t *surface,
cairo_radial_pattern_t *pattern,
cairo_output_stream_t *style,
cairo_bool_t is_stroke)
@@ -1452,7 +1452,7 @@ emit_radial_pattern (cairo_svg_surface_t
x1, y1,
x1, y1, r1);
- emit_transform (document->xml_node_defs, "gradientTransform", ">\n", &p2u);
+ _cairo_svg_surface_emit_transform (document->xml_node_defs, "gradientTransform", ">\n", &p2u);
if (extend == CAIRO_EXTEND_NONE ||
pattern->base.n_stops < 1)
@@ -1535,8 +1535,8 @@ emit_radial_pattern (cairo_svg_surface_t
if (emulate_reflect)
_cairo_output_stream_printf (document->xml_node_defs, "spreadMethod=\"repeat\" ");
else
- emit_pattern_extend (document->xml_node_defs, &pattern->base.base);
- emit_transform (document->xml_node_defs, "gradientTransform", ">\n", &p2u);
+ _cairo_svg_surface_emit_pattern_extend (document->xml_node_defs, &pattern->base.base);
+ _cairo_svg_surface_emit_transform (document->xml_node_defs, "gradientTransform", ">\n", &p2u);
/* To support cairo's EXTEND_NONE, (for which SVG has no similar
* notion), we add transparent color stops on either end of the
@@ -1553,7 +1553,7 @@ emit_radial_pattern (cairo_svg_surface_t
"stop-opacity: 0;\"/>\n",
r0 / r1);
}
- emit_pattern_stops (document->xml_node_defs, &pattern->base, offset,
+ _cairo_svg_surface_emit_pattern_stops (document->xml_node_defs, &pattern->base, offset,
reverse_stops, emulate_reflect);
if (pattern->base.base.extend == CAIRO_EXTEND_NONE)
_cairo_output_stream_printf (document->xml_node_defs,
@@ -1574,24 +1574,24 @@ emit_radial_pattern (cairo_svg_surface_t
}
static void
-emit_pattern (cairo_svg_surface_t *surface, cairo_pattern_t *pattern,
+_cairo_svg_surface_emit_pattern (cairo_svg_surface_t *surface, cairo_pattern_t *pattern,
cairo_output_stream_t *output, cairo_bool_t is_stroke)
{
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
- emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern, output, is_stroke);
+ _cairo_svg_surface_emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern, output, is_stroke);
break;
case CAIRO_PATTERN_TYPE_SURFACE:
- emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern, output, is_stroke);
+ _cairo_svg_surface_emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern, output, is_stroke);
break;
case CAIRO_PATTERN_TYPE_LINEAR:
- emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern, output, is_stroke);
+ _cairo_svg_surface_emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern, output, is_stroke);
break;
case CAIRO_PATTERN_TYPE_RADIAL:
- emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern, output, is_stroke);
+ _cairo_svg_surface_emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern, output, is_stroke);
break;
}
}
@@ -1609,20 +1609,20 @@ _cairo_svg_surface_fill (void *abstrac
cairo_status_t status;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_svg_surface_analyze_operation (surface, op, source);
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_svg_surface_operation_supported (surface, op, source));
_cairo_output_stream_printf (surface->xml_node,
"<path style=\"stroke: none; "
"fill-rule: %s; ",
fill_rule == CAIRO_FILL_RULE_EVEN_ODD ?
"evenodd" : "nonzero");
- emit_operator (surface->xml_node, surface, op);
- emit_pattern (surface, source, surface->xml_node, FALSE);
+ _cairo_svg_surface_emit_operator (surface->xml_node, surface, op);
+ _cairo_svg_surface_emit_pattern (surface, source, surface->xml_node, FALSE);
_cairo_output_stream_printf (surface->xml_node, "\" ");
- status = emit_path (surface->xml_node, path, NULL);
+ status = _cairo_svg_surface_emit_path (surface->xml_node, path, NULL);
_cairo_output_stream_printf (surface->xml_node, "/>\n");
@@ -1649,7 +1649,7 @@ _cairo_svg_surface_get_extents (void
}
static cairo_status_t
-emit_paint (cairo_output_stream_t *output,
+_cairo_svg_surface_emit_paint (cairo_output_stream_t *output,
cairo_svg_surface_t *surface,
cairo_operator_t op,
cairo_pattern_t *source,
@@ -1657,7 +1657,7 @@ emit_paint (cairo_output_stream_t *outpu
{
if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
source->extend == CAIRO_EXTEND_NONE)
- return emit_composite_pattern (output,
+ return _cairo_svg_surface_emit_composite_pattern (output,
surface,
(cairo_surface_pattern_t *) source,
invalid_pattern_id,
@@ -1668,8 +1668,8 @@ emit_paint (cairo_output_stream_t *outpu
"width=\"%f\" height=\"%f\" "
"style=\"",
surface->width, surface->height);
- emit_operator (output, surface, op);
- emit_pattern (surface, source, output, FALSE);
+ _cairo_svg_surface_emit_operator (output, surface, op);
+ _cairo_svg_surface_emit_pattern (surface, source, output, FALSE);
_cairo_output_stream_printf (output, " stroke: none;\"");
if (extra_attributes)
@@ -1689,7 +1689,7 @@ _cairo_svg_surface_paint (void *abs
cairo_svg_surface_t *surface = abstract_surface;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_svg_surface_analyze_operation (surface, op, source);
/* XXX: It would be nice to be able to assert this condition
* here. But, we actually allow one 'cheat' that is used when
@@ -1698,7 +1698,7 @@ _cairo_svg_surface_paint (void *abs
* possible only because there is nothing between the fallback
* images and the paper, nor is anything painted above. */
/*
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_svg_surface_operation_supported (surface, op, source));
*/
/* Emulation of clear and source operators, when no clipping region
@@ -1729,7 +1729,7 @@ _cairo_svg_surface_paint (void *abs
}
}
- emit_paint (surface->xml_node, surface, op, source, NULL);
+ _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, NULL);
return CAIRO_STATUS_SUCCESS;
}
@@ -1746,13 +1746,13 @@ _cairo_svg_surface_mask (void *abst
char buffer[64];
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_svg_surface_analyze_operation (surface, op, source);
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_svg_surface_operation_supported (surface, op, source));
- emit_alpha_filter (document);
+ _cairo_svg_surface_emit_alpha_filter (document);
- /* emit_paint() will output a pattern definition to
+ /* _cairo_svg_surface_emit_paint() will output a pattern definition to
* document->xml_node_defs so we need to write the mask element to
* a temporary stream and then copy that to xml_node_defs. */
mask_stream = _cairo_memory_stream_create ();
@@ -1760,7 +1760,7 @@ _cairo_svg_surface_mask (void *abst
"<mask id=\"mask%d\">\n"
" <g filter=\"url(#alpha)\">\n",
document->mask_id);
- emit_paint (mask_stream, surface, op, mask, NULL);
+ _cairo_svg_surface_emit_paint (mask_stream, surface, op, mask, NULL);
_cairo_output_stream_printf (mask_stream,
" </g>\n"
"</mask>\n");
@@ -1769,7 +1769,7 @@ _cairo_svg_surface_mask (void *abst
snprintf (buffer, sizeof buffer, "mask=\"url(#mask%d);\"",
document->mask_id);
- emit_paint (surface->xml_node, surface, op, source, buffer);
+ _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, buffer);
document->mask_id++;
@@ -1793,9 +1793,9 @@ _cairo_svg_surface_stroke (void *abstr
unsigned int i;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, source);
+ return _cairo_svg_surface_analyze_operation (surface, op, source);
- assert (_operation_supported (surface, op, source));
+ assert (__cairo_svg_surface_operation_supported (surface, op, source));
switch (stroke_style->line_cap) {
case CAIRO_LINE_CAP_BUTT:
@@ -1834,8 +1834,8 @@ _cairo_svg_surface_stroke (void *abstr
line_cap,
line_join);
- emit_pattern (surface, source, surface->xml_node, TRUE);
- emit_operator (surface->xml_node, surface, op);
+ _cairo_svg_surface_emit_pattern (surface, source, surface->xml_node, TRUE);
+ _cairo_svg_surface_emit_operator (surface->xml_node, surface, op);
if (stroke_style->num_dashes > 0) {
_cairo_output_stream_printf (surface->xml_node, "stroke-dasharray: ");
@@ -1858,9 +1858,9 @@ _cairo_svg_surface_stroke (void *abstr
"stroke-miterlimit: %f;\" ",
stroke_style->miter_limit);
- status = emit_path (surface->xml_node, path, ctm_inverse);
+ status = _cairo_svg_surface_emit_path (surface->xml_node, path, ctm_inverse);
- emit_transform (surface->xml_node, " transform", "/>\n", ctm);
+ _cairo_svg_surface_emit_transform (surface->xml_node, " transform", "/>\n", ctm);
return status;
}
@@ -1881,9 +1881,9 @@ _cairo_svg_surface_show_glyphs (void *
int i;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
- return _analyze_operation (surface, op, pattern);
+ return _cairo_svg_surface_analyze_operation (surface, op, pattern);
- assert (_operation_supported (surface, op, pattern));
+ assert (__cairo_svg_surface_operation_supported (surface, op, pattern));
if (num_glyphs <= 0)
return CAIRO_STATUS_SUCCESS;
@@ -1895,7 +1895,7 @@ _cairo_svg_surface_show_glyphs (void *
goto FALLBACK;
_cairo_output_stream_printf (surface->xml_node, "<g style=\"");
- emit_pattern (surface, pattern, surface->xml_node, FALSE);
+ _cairo_svg_surface_emit_pattern (surface, pattern, surface->xml_node, FALSE);
_cairo_output_stream_printf (surface->xml_node, "\">\n");
for (i = 0; i < num_glyphs; i++) {
@@ -1960,7 +1960,7 @@ _cairo_svg_surface_intersect_clip_path (
"<clipPath id=\"clip%d\">\n"
" <path ",
document->clip_id);
- status = emit_path (document->xml_node_defs, path, NULL);
+ status = _cairo_svg_surface_emit_path (document->xml_node_defs, path, NULL);
_cairo_output_stream_printf (document->xml_node_defs,
"/>\n"
"</clipPath>\n");
diff-tree 2cc1c73705d70f834b43996f70080860ac66e57d (from 62e864e73cd1136b3c0e889dca43a1c0cc648b21)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Mar 7 15:53:27 2007 -0500
[cairoint] Move endian-conversion routines into cairoint.h
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index 5c924d9..b354989 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -125,34 +125,6 @@ typedef struct _cairo_cff_font {
} cairo_cff_font_t;
-#ifdef WORDS_BIGENDIAN
-
-#define cpu_to_be16(v) (v)
-#define be16_to_cpu(v) (v)
-#define cpu_to_be32(v) (v)
-
-#else
-
-static inline uint16_t
-cpu_to_be16(uint16_t v)
-{
- return (v << 8) | (v >> 8);
-}
-
-static inline uint16_t
-be16_to_cpu(uint16_t v)
-{
- return cpu_to_be16 (v);
-}
-
-static inline uint32_t
-cpu_to_be32(uint32_t v)
-{
- return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
-}
-
-#endif
-
/* Encoded integer using maximum sized encoding. This is required for
* operands that are later modified after encoding. */
static unsigned char *
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 1143dba..e4108a6 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -80,43 +80,6 @@ cairo_truetype_font_use_glyph (cairo_tru
#define SFNT_VERSION 0x00010000
#define SFNT_STRING_MAX_LENGTH 65535
-#ifdef WORDS_BIGENDIAN
-
-#define cpu_to_be16(v) (v)
-#define be16_to_cpu(v) (v)
-#define cpu_to_be32(v) (v)
-#define be32_to_cpu(v) (v)
-
-#else
-
-static inline uint16_t
-cpu_to_be16(uint16_t v)
-{
- return (v << 8) | (v >> 8);
-}
-
-static inline uint16_t
-be16_to_cpu(uint16_t v)
-{
- return cpu_to_be16 (v);
-}
-
-static inline uint32_t
-cpu_to_be32(uint32_t v)
-{
- return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
-}
-
-static inline uint32_t
-be32_to_cpu(uint32_t v)
-{
- return cpu_to_be32 (v);
-}
-
-#endif
-
-
-
static cairo_status_t
_cairo_truetype_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
cairo_truetype_font_t **font_return)
diff --git a/src/cairoint.h b/src/cairoint.h
index 19897ff..3e54857 100755
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -272,6 +272,41 @@ typedef cairo_fixed_16_16_t cairo_fixed_
#define CAIRO_BITSWAP8_IF_LITTLE_ENDIAN(c) CAIRO_BITSWAP8(c)
#endif
+#ifdef WORDS_BIGENDIAN
+
+#define cpu_to_be16(v) (v)
+#define be16_to_cpu(v) (v)
+#define cpu_to_be32(v) (v)
+#define be32_to_cpu(v) (v)
+
+#else
+
+static inline uint16_t
+cpu_to_be16(uint16_t v)
+{
+ return (v << 8) | (v >> 8);
+}
+
+static inline uint16_t
+be16_to_cpu(uint16_t v)
+{
+ return cpu_to_be16 (v);
+}
+
+static inline uint32_t
+cpu_to_be32(uint32_t v)
+{
+ return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
+}
+
+static inline uint32_t
+be32_to_cpu(uint32_t v)
+{
+ return cpu_to_be32 (v);
+}
+
+#endif
+
#include "cairo-hash-private.h"
#include "cairo-cache-private.h"
diff-tree 62e864e73cd1136b3c0e889dca43a1c0cc648b21 (from ef9799d596600aea334707d2ff00fcca82280d83)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Mar 7 15:51:35 2007 -0500
[Type1] Add cairo-type1-private.h that Type1 fallback and subset code share
diff --git a/doc/public/Headers.mk b/doc/public/Headers.mk
index d6d7718..638bcad 100644
--- a/doc/public/Headers.mk
+++ b/doc/public/Headers.mk
@@ -1,6 +1,7 @@
PRIVATE_TEST_HFILES = \
cairo-meta-surface-private.h \
cairo-truetype-subset-private.h \
+ cairo-type1-private.h \
cairo-hash-private.h \
cairo-cache-private.h \
cairo-output-stream-private.h \
diff --git a/src/Makefile.am b/src/Makefile.am
index 00b83cb..d2ec4cf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@ font_subset_sources = \
cairo-cff-subset.c \
cairo-truetype-subset.c \
cairo-type1-fallback.c \
+ cairo-type1-private.h \
cairo-truetype-subset-private.h \
cairo-scaled-font-subsets.c \
cairo-scaled-font-subsets-private.h
diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index 48cfaf2..a183b28 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -34,6 +34,7 @@
*/
#include "cairoint.h"
+#include "cairo-type1-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-path-fixed-private.h"
#include "cairo-output-stream-private.h"
@@ -116,11 +117,6 @@ fail:
return CAIRO_STATUS_NO_MEMORY;
}
-/* Magic constants for the type1 eexec encryption */
-static const unsigned short encrypt_c1 = 52845, encrypt_c2 = 22719;
-static const unsigned short private_dict_key = 55665;
-static const unsigned short charstring_key = 4330;
-
/* Charstring commands. If the high byte is 0 the command is encoded
* with a single byte. */
#define CHARSTRING_sbw 0x0c07
@@ -301,13 +297,13 @@ charstring_encrypt (cairo_array_t *data)
unsigned char *d, *end;
uint16_t c, p, r;
- r = charstring_key;
+ r = CAIRO_TYPE1_CHARSTRING_KEY;
d = (unsigned char *) _cairo_array_index (data, 0);
end = d + _cairo_array_num_elements (data);
while (d < end) {
p = *d;
c = p ^ (r >> 8);
- r = (c + r) * encrypt_c1 + encrypt_c2;
+ r = (c + r) * CAIRO_TYPE1_ENCRYPT_C1 + CAIRO_TYPE1_ENCRYPT_C2;
*d++ = c;
}
}
@@ -534,7 +530,7 @@ cairo_type1_write_stream_encrypted (void
while (in < end) {
p = *in++;
c = p ^ (font->eexec_key >> 8);
- font->eexec_key = (c + font->eexec_key) * encrypt_c1 + encrypt_c2;
+ font->eexec_key = (c + font->eexec_key) * CAIRO_TYPE1_ENCRYPT_C1 + CAIRO_TYPE1_ENCRYPT_C2;
if (font->hex_encode) {
digits[0] = hex_digits[c >> 4];
@@ -564,7 +560,7 @@ cairo_type1_font_write_private_dict (cai
cairo_int_status_t status;
cairo_output_stream_t *encrypted_output;
- font->eexec_key = private_dict_key;
+ font->eexec_key = CAIRO_TYPE1_PRIVATE_DICT_KEY;
font->hex_column = 0;
encrypted_output = _cairo_output_stream_create (
cairo_type1_write_stream_encrypted,
diff --git a/src/cairo-type1-private.h b/src/cairo-type1-private.h
new file mode 100644
index 0000000..ae28e05
--- /dev/null
+++ b/src/cairo-type1-private.h
@@ -0,0 +1,45 @@
+/* Cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Adrian Johnson <ajohnson at redneon.com>
+ */
+
+#ifndef CAIRO_TYPE1_PRIVATE_H
+#define CAIRO_TYPE1_PRIVATE_H
+
+/* Magic constants for the type1 eexec encryption */
+#define CAIRO_TYPE1_ENCRYPT_C1 ((unsigned short) 52845)
+#define CAIRO_TYPE1_ENCRYPT_C2 ((unsigned short) 22719)
+#define CAIRO_TYPE1_PRIVATE_DICT_KEY ((unsigned short) 55665)
+#define CAIRO_TYPE1_CHARSTRING_KEY ((unsigned short) 4330)
+
+#endif /* CAIRO_TYPE1_PRIVATE_H */
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 73b0b90..e4f5015 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -34,6 +34,7 @@
*/
#include "cairoint.h"
+#include "cairo-type1-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-output-stream-private.h"
@@ -191,11 +192,6 @@ cairo_type1_font_subset_use_glyph (cairo
return font->glyphs[glyph].subset_index;
}
-/* Magic constants for the type1 eexec encryption */
-static const unsigned short c1 = 52845, c2 = 22719;
-static const unsigned short private_dict_key = 55665;
-static const unsigned short charstring_key = 4330;
-
static cairo_bool_t
is_ps_delimiter(int c)
{
@@ -337,7 +333,7 @@ cairo_type1_font_subset_write_encrypted
while (in < end) {
p = *in++;
c = p ^ (font->eexec_key >> 8);
- font->eexec_key = (c + font->eexec_key) * c1 + c2;
+ font->eexec_key = (c + font->eexec_key) * CAIRO_TYPE1_ENCRYPT_C1 + CAIRO_TYPE1_ENCRYPT_C2;
if (font->hex_encode) {
digits[0] = hex_digits[c >> 4];
@@ -361,7 +357,7 @@ cairo_type1_font_subset_write_encrypted
static cairo_status_t
cairo_type1_font_subset_decrypt_eexec_segment (cairo_type1_font_subset_t *font)
{
- unsigned short r = private_dict_key;
+ unsigned short r = CAIRO_TYPE1_PRIVATE_DICT_KEY;
unsigned char *in, *end;
char *out;
int c, p;
@@ -384,7 +380,7 @@ cairo_type1_font_subset_decrypt_eexec_se
c = *in++;
}
p = c ^ (r >> 8);
- r = (c + r) * c1 + c2;
+ r = (c + r) * CAIRO_TYPE1_ENCRYPT_C1 + CAIRO_TYPE1_ENCRYPT_C2;
*out++ = p;
}
@@ -464,13 +460,13 @@ cairo_type1_font_subset_get_glyph_names_
static void
cairo_type1_font_subset_decrypt_charstring (const unsigned char *in, int size, unsigned char *out)
{
- unsigned short r = charstring_key;
+ unsigned short r = CAIRO_TYPE1_CHARSTRING_KEY;
int c, p, i;
for (i = 0; i < size; i++) {
c = *in++;
p = c ^ (r >> 8);
- r = (c + r) * c1 + c2;
+ r = (c + r) * CAIRO_TYPE1_ENCRYPT_C1 + CAIRO_TYPE1_ENCRYPT_C2;
*out++ = p;
}
}
@@ -1016,7 +1012,7 @@ cairo_type1_font_subset_write (cairo_typ
return font->status = CAIRO_INT_STATUS_UNSUPPORTED;
}
- font->eexec_key = private_dict_key;
+ font->eexec_key = CAIRO_TYPE1_PRIVATE_DICT_KEY;
font->hex_column = 0;
cairo_type1_font_subset_write_private_dict (font, name);
diff-tree ef9799d596600aea334707d2ff00fcca82280d83 (from 92d331a23407c79d83bf0b2a7d003ba3525641d4)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Mar 7 15:49:51 2007 -0500
[cosmetic] Remove static var from testing code in bentley-ottman.
diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c
index 4a72a8d..b4f7066 100644
--- a/src/cairo-bentley-ottmann.c
+++ b/src/cairo-bentley-ottmann.c
@@ -1767,7 +1767,7 @@ int
main (void)
{
char random_name[] = "random-XX";
- static cairo_bo_edge_t random_edges[MAX_RANDOM], *edge;
+ cairo_bo_edge_t random_edges[MAX_RANDOM], *edge;
unsigned int i, num_random;
test_t *test;
More information about the cairo-commit
mailing list