From 1889427e78f2501df78a42c5e75c696745b517a7 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Wed, 27 Feb 2008 12:35:56 -0500 Subject: [PATCH] Fix usage of rectangle_int16_t in ps surface, and rename types The rectangle_int16_t usage was causing failures on 24.8 (due to a wrong pointer used to get_extents); I removed all the specific int16/int32 typedefs to avoid this situation in the future. --- src/cairo-ps-surface.c | 2 +- src/cairo-types-private.h | 47 +++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 86d632ca0..03fa4f7c7 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -2261,7 +2261,7 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t *surface, int pattern_height = 0; /* squelch bogus compiler warning */ double xstep, ystep; cairo_matrix_t cairo_p2d, ps_p2d; - cairo_rectangle_int16_t surface_extents; + cairo_rectangle_int_t surface_extents; cairo_bool_t old_use_string_datasource; cairo_p2d = pattern->base.matrix; diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h index 9cb9882e0..2c98f0e25 100644 --- a/src/cairo-types-private.h +++ b/src/cairo-types-private.h @@ -1,3 +1,4 @@ +/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */ /* cairo - a vector graphics library with display and print output * * Copyright © 2002 University of Southern California @@ -183,51 +184,45 @@ typedef struct _cairo_trapezoid { cairo_line_t left, right; } cairo_trapezoid_t; -typedef struct _cairo_rectangle_int16 { +struct _cairo_rectangle_int16 { int16_t x, y; uint16_t width, height; -} cairo_rectangle_int16_t, cairo_glyph_size_t; +}; -typedef struct _cairo_rectangle_int32 { +struct _cairo_rectangle_int32 { int32_t x, y; uint32_t width, height; -} cairo_rectangle_int32_t; +}; -typedef struct _cairo_point_int16 { +typedef struct _cairo_rectangle_int16 cairo_glyph_size_t; + +struct _cairo_point_int16 { int16_t x, y; -} cairo_point_int16_t; +}; -typedef struct _cairo_point_int32 { +struct _cairo_point_int32 { int32_t x, y; -} cairo_point_int32_t; - -typedef struct _cairo_box_int16 { - cairo_point_int16_t p1; - cairo_point_int16_t p2; -} cairo_box_int16_t; - -typedef struct _cairo_box_int32 { - cairo_point_int32_t p1; - cairo_point_int32_t p2; -} cairo_box_int32_t; - +}; #if CAIRO_FIXED_BITS == 32 && CAIRO_FIXED_FRAC_BITS >= 16 -typedef cairo_rectangle_int16_t cairo_rectangle_int_t; -typedef cairo_point_int16_t cairo_point_int_t; -typedef cairo_box_int16_t cairo_box_int_t; +typedef struct _cairo_rectangle_int16 cairo_rectangle_int_t; +typedef struct _cairo_point_int16 cairo_point_int_t; #define CAIRO_RECT_INT_MIN INT16_MIN #define CAIRO_RECT_INT_MAX INT16_MAX #elif CAIRO_FIXED_BITS == 32 -typedef cairo_rectangle_int32_t cairo_rectangle_int_t; -typedef cairo_point_int32_t cairo_point_int_t; -typedef cairo_box_int32_t cairo_box_int_t; +typedef struct _cairo_rectangle_int32 cairo_rectangle_int_t; +typedef struct _cairo_point_int32 cairo_point_int_t; #define CAIRO_RECT_INT_MIN INT32_MIN #define CAIRO_RECT_INT_MAX INT32_MAX #else -#error Not sure how to pick a cairo_rectangle_int_t for your CAIRO_FIXED_BITS! +#error Not sure how to pick a cairo_rectangle_int_t and cairo_point_int_t for your CAIRO_FIXED_BITS! #endif +typedef struct _cairo_box_int { + cairo_point_int_t p1; + cairo_point_int_t p2; +} cairo_box_int_t; + typedef enum _cairo_direction { CAIRO_DIRECTION_FORWARD, CAIRO_DIRECTION_REVERSE