summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-01 15:33:05 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-01 15:36:34 +0100
commite955b7399ef5741c8f2fda1c4aa73e02c2ce39d0 (patch)
tree4d5fc0950666dc42ce85c997155fc9d6ccb12e42
parentd756a4d6323d23cecb928822cdac7528859e7cf3 (diff)
Check that lvalue of BITSWAP8() is a uint8_t.
The bit-swapping macro uses the full register for intermediate storage so we need to be careful to only read the low byte when using the result. [Only the use in ps-surface.c was incorrect, I just converted the other unsigned chars to uint8_t for consistency.]
-rw-r--r--src/cairo-ft-font.c2
-rw-r--r--src/cairo-pdf-surface.c2
-rw-r--r--src/cairo-ps-surface.c23
-rw-r--r--src/cairo-scaled-font.c2
-rw-r--r--src/cairo-svg-surface.c4
5 files changed, 16 insertions, 17 deletions
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 99d5a1e5..1ad71453 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1095,7 +1095,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
#ifndef WORDS_BIGENDIAN
{
- unsigned char *d = data;
+ uint8_t *d = data;
int count = stride * height;
while (count--) {
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 676eb142..de64c0c0 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -3444,7 +3444,7 @@ static cairo_status_t
_cairo_pdf_emit_imagemask (cairo_image_surface_t *image,
cairo_output_stream_t *stream)
{
- unsigned char *byte, output_byte;
+ uint8_t *byte, output_byte;
int row, col, num_cols;
/* The only image type supported by Type 3 fonts are 1-bit image
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 8fcf89e8..3937cfc8 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -388,7 +388,7 @@ static cairo_status_t
_cairo_ps_emit_imagemask (cairo_image_surface_t *image,
cairo_output_stream_t *stream)
{
- unsigned char *row, *byte;
+ uint8_t *row, *byte;
int rows, cols;
/* The only image type supported by Type 3 fonts are 1-bit image
@@ -410,18 +410,15 @@ _cairo_ps_emit_imagemask (cairo_image_surface_t *image,
image->height);
_cairo_output_stream_printf (stream,
- " /DataSource {<");
+ " /DataSource {<\n ");
for (row = image->data, rows = image->height; rows; row += image->stride, rows--) {
for (byte = row, cols = (image->width + 7) / 8; cols; byte++, cols--) {
- unsigned int output_byte = CAIRO_BITSWAP8_IF_LITTLE_ENDIAN (*byte);
+ uint8_t output_byte = CAIRO_BITSWAP8_IF_LITTLE_ENDIAN (*byte);
_cairo_output_stream_printf (stream, "%02x ", output_byte);
}
_cairo_output_stream_printf (stream, "\n ");
}
- _cairo_output_stream_printf (stream,
- " >}\n");
- _cairo_output_stream_printf (stream,
- ">>\n");
+ _cairo_output_stream_printf (stream, ">}\n>>\n");
_cairo_output_stream_printf (stream,
"imagemask\n");
@@ -2238,11 +2235,13 @@ _cairo_ps_surface_paint_surface (cairo_ps_surface_t *surface,
cairo_matrix_translate (&ps_p2d, 0.0, height);
cairo_matrix_scale (&ps_p2d, 1.0, -1.0);
- _cairo_output_stream_printf (surface->stream,
- "[ %f %f %f %f %f %f ] concat\n",
- ps_p2d.xx, ps_p2d.yx,
- ps_p2d.xy, ps_p2d.yy,
- ps_p2d.x0, ps_p2d.y0);
+ if (! _cairo_matrix_is_identity (&ps_p2d)) {
+ _cairo_output_stream_printf (surface->stream,
+ "[ %f %f %f %f %f %f ] concat\n",
+ ps_p2d.xx, ps_p2d.yx,
+ ps_p2d.xy, ps_p2d.yy,
+ ps_p2d.x0, ps_p2d.y0);
+ }
status = _cairo_ps_surface_emit_surface (surface, pattern, op);
_cairo_ps_surface_release_surface (surface, pattern);
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 73d1eb49..385bdf03 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2023,7 +2023,7 @@ _trace_mask_to_path (cairo_image_surface_t *mask,
{
cairo_status_t status;
cairo_image_surface_t *a1_mask;
- unsigned char *row, *byte_ptr, byte;
+ uint8_t *row, *byte_ptr, byte;
int rows, cols, bytes_per_row;
int x, y, bit;
double xoff, yoff;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 8d17cadc..97ceedd5 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -651,7 +651,7 @@ _cairo_svg_document_emit_bitmap_glyph_data (cairo_svg_document_t *document,
cairo_image_surface_t *image;
cairo_scaled_glyph_t *scaled_glyph;
cairo_status_t status;
- unsigned char *row, *byte;
+ uint8_t *row, *byte;
int rows, cols;
int x, y, bit;
@@ -677,7 +677,7 @@ _cairo_svg_document_emit_bitmap_glyph_data (cairo_svg_document_t *document,
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--) {
- unsigned char output_byte = CAIRO_BITSWAP8_IF_LITTLE_ENDIAN (*byte);
+ uint8_t output_byte = CAIRO_BITSWAP8_IF_LITTLE_ENDIAN (*byte);
for (bit = 7; bit >= 0 && x < image->width; bit--, x++) {
if (output_byte & (1 << bit)) {
_cairo_output_stream_printf (document->xml_node_glyphs,