diff --git a/src/Makefile.sources b/src/Makefile.sources index 0e7b54b58..156bae263 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -82,6 +82,7 @@ cairo_private = \ cairo-region-private.h \ cairo-rtree-private.h \ cairo-scaled-font-private.h \ + cairo-slope-private.h \ cairo-spans-private.h \ cairo-surface-fallback-private.h \ cairo-surface-private.h \ diff --git a/src/cairo-hull.c b/src/cairo-hull.c index 1fa919bf3..8a1a31e24 100644 --- a/src/cairo-hull.c +++ b/src/cairo-hull.c @@ -36,6 +36,8 @@ #include "cairoint.h" +#include "cairo-slope-private.h" + typedef struct cairo_hull { cairo_point_t point; cairo_slope_t slope; diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index b71603087..7ade8b24d 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -39,6 +39,7 @@ #include "cairoint.h" #include "cairo-path-fixed-private.h" +#include "cairo-slope-private.h" static cairo_status_t _cairo_path_fixed_add (cairo_path_fixed_t *path, diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c index 33fed4fc3..ba169ae72 100644 --- a/src/cairo-path-stroke.c +++ b/src/cairo-path-stroke.c @@ -38,7 +38,9 @@ #define _BSD_SOURCE /* for hypot() */ #include "cairoint.h" + #include "cairo-path-fixed-private.h" +#include "cairo-slope-private.h" typedef struct _cairo_stroker_dash { cairo_bool_t dashed; diff --git a/src/cairo-pen.c b/src/cairo-pen.c index 8db8fcb36..cfb67cae4 100644 --- a/src/cairo-pen.c +++ b/src/cairo-pen.c @@ -38,6 +38,8 @@ #include "cairoint.h" +#include "cairo-slope-private.h" + static int _cairo_pen_vertices_needed (double tolerance, double radius, diff --git a/src/cairo-polygon.c b/src/cairo-polygon.c index fdc5c92d3..9de92bfae 100644 --- a/src/cairo-polygon.c +++ b/src/cairo-polygon.c @@ -36,6 +36,8 @@ #include "cairoint.h" +#include "cairo-slope-private.h" + void _cairo_polygon_init (cairo_polygon_t *polygon) { diff --git a/src/cairo-slope-private.h b/src/cairo-slope-private.h new file mode 100644 index 000000000..4148c686b --- /dev/null +++ b/src/cairo-slope-private.h @@ -0,0 +1,65 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * Copyright © 2005 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 University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#ifndef _CAIRO_SLOPE_PRIVATE_H +#define _CAIRO_SLOPE_PRIVATE_H + +#include "cairo-types-private.h" +#include "cairo-fixed-private.h" + +static inline void +_cairo_slope_init (cairo_slope_t *slope, + const cairo_point_t *a, + const cairo_point_t *b) +{ + slope->dx = b->x - a->x; + slope->dy = b->y - a->y; +} + +static inline cairo_bool_t +_cairo_slope_equal (const cairo_slope_t *a, const cairo_slope_t *b) +{ + return _cairo_int64_eq (_cairo_int32x32_64_mul (a->dy, b->dx), + _cairo_int32x32_64_mul (b->dy, a->dx)); +} + +cairo_private int +_cairo_slope_compare (const cairo_slope_t *a, + const cairo_slope_t *b) cairo_pure; + + +#endif /* _CAIRO_SLOPE_PRIVATE_H */ diff --git a/src/cairo-slope.c b/src/cairo-slope.c index 15685b789..bb3b411e6 100644 --- a/src/cairo-slope.c +++ b/src/cairo-slope.c @@ -36,14 +36,7 @@ #include "cairoint.h" -void -_cairo_slope_init (cairo_slope_t *slope, - const cairo_point_t *a, - const cairo_point_t *b) -{ - slope->dx = b->x - a->x; - slope->dy = b->y - a->y; -} +#include "cairo-slope-private.h" /* Compare two slopes. Slope angles begin at 0 in the direction of the positive X axis and increase in the direction of the positive Y diff --git a/src/cairo-spline.c b/src/cairo-spline.c index 45eedbd6a..780c21fe3 100644 --- a/src/cairo-spline.c +++ b/src/cairo-spline.c @@ -36,6 +36,8 @@ #include "cairoint.h" +#include "cairo-slope-private.h" + cairo_bool_t _cairo_spline_init (cairo_spline_t *spline, cairo_spline_add_point_func_t add_point_func, diff --git a/src/cairo-traps.c b/src/cairo-traps.c index c6709de37..d5b41e5d4 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -40,6 +40,7 @@ #include "cairoint.h" #include "cairo-region-private.h" +#include "cairo-slope-private.h" /* private functions */ diff --git a/src/cairoint.h b/src/cairoint.h index bbeb8e090..9fd789da5 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -2427,16 +2427,6 @@ _cairo_trapezoid_array_translate_and_scale (cairo_trapezoid_t *offset_traps, double tx, double ty, double sx, double sy); -/* cairo-slope.c */ -cairo_private void -_cairo_slope_init (cairo_slope_t *slope, - const cairo_point_t *a, - const cairo_point_t *b); - -cairo_private int -_cairo_slope_compare (const cairo_slope_t *a, - const cairo_slope_t *b) cairo_pure; - /* cairo-pattern.c */ cairo_private cairo_pattern_t * @@ -2758,13 +2748,6 @@ CAIRO_END_DECLS #include "cairo-malloc-private.h" #include "cairo-hash-private.h" -static inline cairo_bool_t -_cairo_slope_equal (const cairo_slope_t *a, const cairo_slope_t *b) -{ - return _cairo_int64_eq (_cairo_int32x32_64_mul (a->dy, b->dx), - _cairo_int32x32_64_mul (b->dy, a->dx)); -} - #if HAVE_VALGRIND #include