aboutsummaryrefslogtreecommitdiffstats
path: root/libart_lgpl
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-20 18:56:06 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-20 20:06:19 +0800
commit5d0878967ee21a039ef599222b1cf3eb606354d4 (patch)
tree790cfcbf63fea7292740f182dd612ab20244f6e8 /libart_lgpl
parentf5f2132d60cdd1884c6343f759aadfd38a159e04 (diff)
downloadgsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.gz
gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.tar.zst
gsoc2013-evolution-5d0878967ee21a039ef599222b1cf3eb606354d4.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'libart_lgpl')
-rw-r--r--libart_lgpl/art_affine.c98
-rw-r--r--libart_lgpl/art_affine.h20
-rw-r--r--libart_lgpl/art_alphagamma.h6
-rw-r--r--libart_lgpl/art_bpath.c9
-rw-r--r--libart_lgpl/art_bpath.h14
-rw-r--r--libart_lgpl/art_filterlevel.h1
-rw-r--r--libart_lgpl/art_gray_svp.c20
-rw-r--r--libart_lgpl/art_gray_svp.h4
-rw-r--r--libart_lgpl/art_misc.c10
-rw-r--r--libart_lgpl/art_misc.h16
-rw-r--r--libart_lgpl/art_point.h4
-rw-r--r--libart_lgpl/art_rect.c12
-rw-r--r--libart_lgpl/art_rect.h12
-rw-r--r--libart_lgpl/art_rect_svp.c4
-rw-r--r--libart_lgpl/art_rect_uta.c21
-rw-r--r--libart_lgpl/art_rect_uta.h4
-rw-r--r--libart_lgpl/art_render.c161
-rw-r--r--libart_lgpl/art_render.h28
-rw-r--r--libart_lgpl/art_rgb.c14
-rw-r--r--libart_lgpl/art_rgb.h6
-rw-r--r--libart_lgpl/art_rgb_affine.c14
-rw-r--r--libart_lgpl/art_rgb_affine.h6
-rw-r--r--libart_lgpl/art_rgb_affine_private.c14
-rw-r--r--libart_lgpl/art_rgb_affine_private.h8
-rw-r--r--libart_lgpl/art_rgb_rgba_affine.c22
-rw-r--r--libart_lgpl/art_rgb_rgba_affine.h6
-rw-r--r--libart_lgpl/art_rgb_svp.c76
-rw-r--r--libart_lgpl/art_rgb_svp.h8
-rw-r--r--libart_lgpl/art_svp.c13
-rw-r--r--libart_lgpl/art_svp.h10
-rw-r--r--libart_lgpl/art_svp_intersect.c239
-rw-r--r--libart_lgpl/art_svp_intersect.h12
-rw-r--r--libart_lgpl/art_svp_ops.c84
-rw-r--r--libart_lgpl/art_svp_point.c42
-rw-r--r--libart_lgpl/art_svp_point.h11
-rw-r--r--libart_lgpl/art_svp_render_aa.c95
-rw-r--r--libart_lgpl/art_svp_render_aa.h22
-rw-r--r--libart_lgpl/art_svp_vpath.c19
-rw-r--r--libart_lgpl/art_svp_vpath_stroke.c220
-rw-r--r--libart_lgpl/art_svp_vpath_stroke.h12
-rw-r--r--libart_lgpl/art_uta.c4
-rw-r--r--libart_lgpl/art_uta.h12
-rw-r--r--libart_lgpl/art_uta_rect.c8
-rw-r--r--libart_lgpl/art_uta_vpath.c82
-rw-r--r--libart_lgpl/art_uta_vpath.h4
-rw-r--r--libart_lgpl/art_vpath.c10
-rw-r--r--libart_lgpl/art_vpath.h8
-rw-r--r--libart_lgpl/art_vpath_bpath.c94
-rw-r--r--libart_lgpl/art_vpath_bpath.h12
-rw-r--r--libart_lgpl/art_vpath_dash.c37
-rw-r--r--libart_lgpl/art_vpath_dash.h6
-rw-r--r--libart_lgpl/art_vpath_svp.c36
52 files changed, 679 insertions, 1031 deletions
diff --git a/libart_lgpl/art_affine.c b/libart_lgpl/art_affine.c
index 8f3973de8e..dd6866ca86 100644
--- a/libart_lgpl/art_affine.c
+++ b/libart_lgpl/art_affine.c
@@ -27,7 +27,6 @@
#include <stdio.h> /* for sprintf */
#include <string.h> /* for strcpy */
-
/* According to a strict interpretation of the libart structure, this
routine should go into its own module, art_point_affine. However,
it's only two lines of code, and it can be argued that it is one of
@@ -42,9 +41,9 @@
**/
void
art_affine_point (ArtPoint *dst, const ArtPoint *src,
- const double affine[6])
+ const gdouble affine[6])
{
- double x, y;
+ gdouble x, y;
x = src->x;
y = src->y;
@@ -64,9 +63,9 @@ art_affine_point (ArtPoint *dst, const ArtPoint *src,
* will be (to within roundoff error) the identity affine.
**/
void
-art_affine_invert (double dst[6], const double src[6])
+art_affine_invert (gdouble dst[6], const gdouble src[6])
{
- double r_det;
+ gdouble r_det;
r_det = 1.0 / (src[0] * src[3] - src[1] * src[2]);
dst[0] = src[3] * r_det;
@@ -77,80 +76,6 @@ art_affine_invert (double dst[6], const double src[6])
dst[5] = -src[4] * dst[1] - src[5] * dst[3];
}
-#define EPSILON 1e-6
-
-/* It's ridiculous I have to write this myself. This is hardcoded to
- six digits of precision, which is good enough for PostScript.
-
- The return value is the number of characters (i.e. strlen (str)).
- It is no more than 12. */
-static int
-art_ftoa (char str[80], double x)
-{
- char *p = str;
- int i, j;
-
- p = str;
- if (fabs (x) < EPSILON / 2)
- {
- strcpy (str, "0");
- return 1;
- }
- if (x < 0)
- {
- *p++ = '-';
- x = -x;
- }
- if ((int)floor ((x + EPSILON / 2) < 1))
- {
- *p++ = '0';
- *p++ = '.';
- i = sprintf (p, "%06d", (int)floor ((x + EPSILON / 2) * 1e6));
- while (i && p[i - 1] == '0')
- i--;
- if (i == 0)
- i--;
- p += i;
- }
- else if (x < 1e6)
- {
- i = sprintf (p, "%d", (int)floor (x + EPSILON / 2));
- p += i;
- if (i < 6)
- {
- int ix;
-
- *p++ = '.';
- x -= floor (x + EPSILON / 2);
- for (j = i; j < 6; j++)
- x *= 10;
- ix = floor (x + 0.5);
-
- for (j = 0; j < i; j++)
- ix *= 10;
-
- /* A cheap hack, this routine can round wrong for fractions
- near one. */
- if (ix == 1000000)
- ix = 999999;
-
- sprintf (p, "%06d", ix);
- i = 6 - i;
- while (i && p[i - 1] == '0')
- i--;
- if (i == 0)
- i--;
- p += i;
- }
- }
- else
- p += sprintf (p, "%g", x);
-
- *p = '\0';
- return p - str;
-}
-
-
/**
* art_affine_multiply: Multiply two affine transformation matrices.
* @dst: Where to store the result.
@@ -165,9 +90,9 @@ art_ftoa (char str[80], double x)
* It is safe to call this function with @dst equal to @src1 or @src2.
**/
void
-art_affine_multiply (double dst[6], const double src1[6], const double src2[6])
+art_affine_multiply (gdouble dst[6], const gdouble src1[6], const gdouble src2[6])
{
- double d0, d1, d2, d3, d4, d5;
+ gdouble d0, d1, d2, d3, d4, d5;
d0 = src1[0] * src2[0] + src1[1] * src2[2];
d1 = src1[0] * src2[1] + src1[1] * src2[3];
@@ -190,7 +115,7 @@ art_affine_multiply (double dst[6], const double src1[6], const double src2[6])
* Sets up an identity matrix.
**/
void
-art_affine_identity (double dst[6])
+art_affine_identity (gdouble dst[6])
{
dst[0] = 1;
dst[1] = 0;
@@ -200,7 +125,6 @@ art_affine_identity (double dst[6])
dst[5] = 0;
}
-
/**
* art_affine_scale: Set up a scaling matrix.
* @dst: Where to store the resulting affine transform.
@@ -210,7 +134,7 @@ art_affine_identity (double dst[6])
* Sets up a scaling matrix.
**/
void
-art_affine_scale (double dst[6], double sx, double sy)
+art_affine_scale (gdouble dst[6], gdouble sx, gdouble sy)
{
dst[0] = sx;
dst[1] = 0;
@@ -229,7 +153,7 @@ art_affine_scale (double dst[6], double sx, double sy)
* Sets up a translation matrix.
**/
void
-art_affine_translate (double dst[6], double tx, double ty)
+art_affine_translate (gdouble dst[6], gdouble tx, gdouble ty)
{
dst[0] = 1;
dst[1] = 0;
@@ -250,8 +174,8 @@ art_affine_translate (double dst[6], double tx, double ty)
*
* Return value: the expansion factor.
**/
-double
-art_affine_expansion (const double src[6])
+gdouble
+art_affine_expansion (const gdouble src[6])
{
return sqrt (fabs (src[0] * src[3] - src[1] * src[2]));
}
diff --git a/libart_lgpl/art_affine.h b/libart_lgpl/art_affine.h
index 44326d1388..2c50df1382 100644
--- a/libart_lgpl/art_affine.h
+++ b/libart_lgpl/art_affine.h
@@ -28,32 +28,30 @@ extern "C" {
void
art_affine_point (ArtPoint *dst, const ArtPoint *src,
- const double affine[6]);
+ const gdouble affine[6]);
void
-art_affine_invert (double dst_affine[6], const double src_affine[6]);
+art_affine_invert (gdouble dst_affine[6], const gdouble src_affine[6]);
void
-art_affine_multiply (double dst[6],
- const double src1[6], const double src2[6]);
+art_affine_multiply (gdouble dst[6],
+ const gdouble src1[6], const gdouble src2[6]);
/* set up the identity matrix */
void
-art_affine_identity (double dst[6]);
+art_affine_identity (gdouble dst[6]);
/* set up a scaling matrix */
void
-art_affine_scale (double dst[6], double sx, double sy);
+art_affine_scale (gdouble dst[6], gdouble sx, gdouble sy);
/* set up a translation matrix */
void
-art_affine_translate (double dst[6], double tx, double ty);
-
+art_affine_translate (gdouble dst[6], gdouble tx, gdouble ty);
/* find the affine's "expansion factor", i.e. the scale amount */
-double
-art_affine_expansion (const double src[6]);
-
+gdouble
+art_affine_expansion (const gdouble src[6]);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_alphagamma.h b/libart_lgpl/art_alphagamma.h
index f3ee35765f..a779ae86a8 100644
--- a/libart_lgpl/art_alphagamma.h
+++ b/libart_lgpl/art_alphagamma.h
@@ -32,9 +32,9 @@ typedef struct _ArtAlphaGamma ArtAlphaGamma;
struct _ArtAlphaGamma {
/*< private >*/
- double gamma;
- int invtable_size;
- int table[256];
+ gdouble gamma;
+ gint invtable_size;
+ gint table[256];
art_u8 invtable[1];
};
diff --git a/libart_lgpl/art_bpath.c b/libart_lgpl/art_bpath.c
index a25acbf95d..8c8dad0480 100644
--- a/libart_lgpl/art_bpath.c
+++ b/libart_lgpl/art_bpath.c
@@ -24,7 +24,6 @@
#include <math.h>
-
/**
* art_bpath_affine_transform: Affine transform an #ArtBpath.
* @src: The source #ArtBpath.
@@ -39,13 +38,13 @@
* Return value: the transformed #ArtBpath.
**/
ArtBpath *
-art_bpath_affine_transform (const ArtBpath *src, const double matrix[6])
+art_bpath_affine_transform (const ArtBpath *src, const gdouble matrix[6])
{
- int i;
- int size;
+ gint i;
+ gint size;
ArtBpath *new;
ArtPathcode code;
- double x, y;
+ gdouble x, y;
for (i = 0; src[i].code != ART_END; i++);
size = i;
diff --git a/libart_lgpl/art_bpath.h b/libart_lgpl/art_bpath.h
index ce73c0b03d..e6362d41de 100644
--- a/libart_lgpl/art_bpath.h
+++ b/libart_lgpl/art_bpath.h
@@ -35,16 +35,16 @@ typedef struct _ArtBpath ArtBpath;
struct _ArtBpath {
/*< public >*/
ArtPathcode code;
- double x1;
- double y1;
- double x2;
- double y2;
- double x3;
- double y3;
+ gdouble x1;
+ gdouble y1;
+ gdouble x2;
+ gdouble y2;
+ gdouble x3;
+ gdouble y3;
};
ArtBpath *
-art_bpath_affine_transform (const ArtBpath *src, const double matrix[6]);
+art_bpath_affine_transform (const ArtBpath *src, const gdouble matrix[6]);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_filterlevel.h b/libart_lgpl/art_filterlevel.h
index 1f4be484b4..97d9abb400 100644
--- a/libart_lgpl/art_filterlevel.h
+++ b/libart_lgpl/art_filterlevel.h
@@ -60,7 +60,6 @@ typedef enum {
*/
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/libart_lgpl/art_gray_svp.c b/libart_lgpl/art_gray_svp.c
index e5d5df9d74..f076a69f99 100644
--- a/libart_lgpl/art_gray_svp.c
+++ b/libart_lgpl/art_gray_svp.c
@@ -32,20 +32,20 @@ typedef struct _ArtGraySVPData ArtGraySVPData;
struct _ArtGraySVPData {
art_u8 *buf;
- int rowstride;
- int x0, x1;
+ gint rowstride;
+ gint x0, x1;
};
static void
-art_gray_svp_callback (void *callback_data, int y,
- int start, ArtSVPRenderAAStep *steps, int n_steps)
+art_gray_svp_callback (gpointer callback_data, gint y,
+ gint start, ArtSVPRenderAAStep *steps, gint n_steps)
{
ArtGraySVPData *data = (ArtGraySVPData *)callback_data;
art_u8 *linebuf;
- int run_x0, run_x1;
- int running_sum = start;
- int x0, x1;
- int k;
+ gint run_x0, run_x1;
+ gint running_sum = start;
+ gint x0, x1;
+ gint k;
#if 0
printf ("start = %d", start);
@@ -110,8 +110,8 @@ art_gray_svp_callback (void *callback_data, int y,
**/
void
art_gray_svp_aa (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
- art_u8 *buf, int rowstride)
+ gint x0, gint y0, gint x1, gint y1,
+ art_u8 *buf, gint rowstride)
{
ArtGraySVPData data;
diff --git a/libart_lgpl/art_gray_svp.h b/libart_lgpl/art_gray_svp.h
index 52ab2239e3..1a3c5d9c9a 100644
--- a/libart_lgpl/art_gray_svp.h
+++ b/libart_lgpl/art_gray_svp.h
@@ -31,8 +31,8 @@ extern "C" {
void
art_gray_svp_aa (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
- art_u8 *buf, int rowstride);
+ gint x0, gint y0, gint x1, gint y1,
+ art_u8 *buf, gint rowstride);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_misc.c b/libart_lgpl/art_misc.c
index 777ad702a6..713522b580 100644
--- a/libart_lgpl/art_misc.c
+++ b/libart_lgpl/art_misc.c
@@ -35,7 +35,7 @@
* Used for dealing with severe errors.
**/
void
-art_die (const char *fmt, ...)
+art_die (const gchar *fmt, ...)
{
va_list ap;
@@ -52,7 +52,7 @@ art_die (const char *fmt, ...)
* Used for generating warnings.
**/
void
-art_warn (const char *fmt, ...)
+art_warn (const gchar *fmt, ...)
{
va_list ap;
@@ -61,17 +61,17 @@ art_warn (const char *fmt, ...)
va_end (ap);
}
-void *art_alloc(size_t size)
+gpointer art_alloc(gsize size)
{
return malloc(size);
}
-void art_free(void *ptr)
+void art_free(gpointer ptr)
{
free(ptr);
}
-void *art_realloc(void *ptr, size_t size)
+gpointer art_realloc(gpointer ptr, gsize size)
{
return realloc(ptr, size);
}
diff --git a/libart_lgpl/art_misc.h b/libart_lgpl/art_misc.h
index b0a445b238..054b912dbd 100644
--- a/libart_lgpl/art_misc.h
+++ b/libart_lgpl/art_misc.h
@@ -29,9 +29,9 @@
#ifdef __cplusplus
extern "C" {
#endif
-void *art_alloc(size_t size);
-void art_free(void *ptr);
-void *art_realloc(void *ptr, size_t size);
+gpointer art_alloc(gsize size);
+void art_free(gpointer ptr);
+gpointer art_realloc(gpointer ptr, gsize size);
#ifdef __cplusplus
}
#endif /* __cplusplus */
@@ -45,9 +45,11 @@ void *art_realloc(void *ptr, size_t size);
/* This one must be used carefully - in particular, p and max should
be variables. They can also be pstruct->el lvalues. */
-#define art_expand(p, type, max) do { if(max) { p = art_renew (p, type, max <<= 1); } else { max = 1; p = art_new(type, 1); } } while (0)
+#define art_expand(p, type, max) \
+ do { if(max) { p = art_renew (p, type, max <<= 1); } \
+ else { max = 1; p = art_new(type, 1); } } while (0)
-typedef int art_boolean;
+typedef gint art_boolean;
#define ART_FALSE 0
#define ART_TRUE 1
@@ -81,10 +83,10 @@ typedef guint16 art_u16;
typedef guint32 art_u32;
void ART_GNUC_NORETURN
-art_die (const char *fmt, ...) ART_GNUC_PRINTF (1, 2);
+art_die (const gchar *fmt, ...) ART_GNUC_PRINTF (1, 2);
void
-art_warn (const char *fmt, ...) ART_GNUC_PRINTF (1, 2);
+art_warn (const gchar *fmt, ...) ART_GNUC_PRINTF (1, 2);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_point.h b/libart_lgpl/art_point.h
index 1efcda67aa..a5486d22c6 100644
--- a/libart_lgpl/art_point.h
+++ b/libart_lgpl/art_point.h
@@ -20,6 +20,8 @@
#ifndef __ART_POINT_H__
#define __ART_POINT_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -28,7 +30,7 @@ typedef struct _ArtPoint ArtPoint;
struct _ArtPoint {
/*< public >*/
- double x, y;
+ gdouble x, y;
};
#ifdef __cplusplus
diff --git a/libart_lgpl/art_rect.c b/libart_lgpl/art_rect.c
index bd1cd6e229..ec53d2d70f 100644
--- a/libart_lgpl/art_rect.c
+++ b/libart_lgpl/art_rect.c
@@ -54,7 +54,7 @@ art_irect_intersect (ArtIRect *dest, const ArtIRect *src1, const ArtIRect *src2)
*
* Return value: TRUE if @src is an empty rectangle, FALSE otherwise.
**/
-int
+gint
art_irect_empty (const ArtIRect *src) {
return (src->x1 <= src->x0 || src->y1 <= src->y0);
}
@@ -102,7 +102,7 @@ art_drect_union (ArtDRect *dest, const ArtDRect *src1, const ArtDRect *src2) {
*
* Return value: TRUE if @src is an empty rectangle, FALSE otherwise.
**/
-int
+gint
art_drect_empty (const ArtDRect *src) {
return (src->x1 <= src->x0 || src->y1 <= src->y0);
}
@@ -119,10 +119,12 @@ art_drect_empty (const ArtDRect *src) {
* is a conservative approximation.
**/
void
-art_drect_affine_transform (ArtDRect *dst, const ArtDRect *src, const double matrix[6])
+art_drect_affine_transform (ArtDRect *dst,
+ const ArtDRect *src,
+ const gdouble matrix[6])
{
- double x00, y00, x10, y10;
- double x01, y01, x11, y11;
+ gdouble x00, y00, x10, y10;
+ gdouble x01, y01, x11, y11;
x00 = src->x0 * matrix[0] + src->y0 * matrix[2] + matrix[4];
y00 = src->x0 * matrix[1] + src->y0 * matrix[3] + matrix[5];
diff --git a/libart_lgpl/art_rect.h b/libart_lgpl/art_rect.h
index 247cbea3e9..fb3ebb762b 100644
--- a/libart_lgpl/art_rect.h
+++ b/libart_lgpl/art_rect.h
@@ -20,6 +20,8 @@
#ifndef __ART_RECT_H__
#define __ART_RECT_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -29,12 +31,12 @@ typedef struct _ArtIRect ArtIRect;
struct _ArtDRect {
/*< public >*/
- double x0, y0, x1, y1;
+ gdouble x0, y0, x1, y1;
};
struct _ArtIRect {
/*< public >*/
- int x0, y0, x1, y1;
+ gint x0, y0, x1, y1;
};
/* Make a copy of the rectangle. */
@@ -45,7 +47,7 @@ void art_irect_intersect (ArtIRect *dest,
const ArtIRect *src1, const ArtIRect *src2);
/* Return true if the rectangle is empty. */
-int art_irect_empty (const ArtIRect *src);
+gint art_irect_empty (const ArtIRect *src);
/* Make a copy of the rectangle. */
void art_drect_copy (ArtDRect *dest, const ArtDRect *src);
@@ -55,11 +57,11 @@ void art_drect_union (ArtDRect *dest,
const ArtDRect *src1, const ArtDRect *src2);
/* Return true if the rectangle is empty. */
-int art_drect_empty (const ArtDRect *src);
+gint art_drect_empty (const ArtDRect *src);
void
art_drect_affine_transform (ArtDRect *dst, const ArtDRect *src,
- const double matrix[6]);
+ const gdouble matrix[6]);
void art_drect_to_irect (ArtIRect *dst, ArtDRect *src);
diff --git a/libart_lgpl/art_rect_svp.c b/libart_lgpl/art_rect_svp.c
index d9819963a9..5d92100179 100644
--- a/libart_lgpl/art_rect_svp.c
+++ b/libart_lgpl/art_rect_svp.c
@@ -42,7 +42,7 @@
void
art_drect_svp (ArtDRect *bbox, const ArtSVP *svp)
{
- int i;
+ gint i;
if (svp->n_segs == 0)
{
@@ -54,7 +54,7 @@ art_drect_svp (ArtDRect *bbox, const ArtSVP *svp)
}
art_drect_copy (bbox, &svp->segs[0].bbox);
-
+
for (i = 1; i < svp->n_segs; i++)
{
bbox->x0 = MIN (bbox->x0, svp->segs[i].bbox.x0);
diff --git a/libart_lgpl/art_rect_uta.c b/libart_lgpl/art_rect_uta.c
index cd002f81af..e7d1c77a5c 100644
--- a/libart_lgpl/art_rect_uta.c
+++ b/libart_lgpl/art_rect_uta.c
@@ -43,20 +43,20 @@
* Return value: An array containing the resulting rectangles.
**/
ArtIRect *
-art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height,
- int *p_nrects)
+art_rect_list_from_uta (ArtUta *uta, gint max_width, gint max_height,
+ gint *p_nrects)
{
ArtIRect *rects;
- int n_rects, n_rects_max;
- int x, y;
- int width, height;
- int ix;
- int left_ix;
+ gint n_rects, n_rects_max;
+ gint x, y;
+ gint width, height;
+ gint ix;
+ gint left_ix;
ArtUtaBbox *utiles;
ArtUtaBbox bb;
- int x0, y0, x1, y1;
- int *glom;
- int glom_rect;
+ gint x0, y0, x1, y1;
+ gint *glom;
+ gint glom_rect;
n_rects = 0;
n_rects_max = 1;
@@ -96,7 +96,6 @@ art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height,
}
x1 = ((uta->x0 + x) << ART_UTILE_SHIFT) + ART_UTA_BBOX_X1(bb);
-
/* if rectangle nonempty */
if ((x1 ^ x0) | (y1 ^ y0))
{
diff --git a/libart_lgpl/art_rect_uta.h b/libart_lgpl/art_rect_uta.h
index 39a1880782..7b07d89ad9 100644
--- a/libart_lgpl/art_rect_uta.h
+++ b/libart_lgpl/art_rect_uta.h
@@ -28,8 +28,8 @@ extern "C" {
#endif /* __cplusplus */
ArtIRect *
-art_rect_list_from_uta (ArtUta *uta, int max_width, int max_height,
- int *p_nrects);
+art_rect_list_from_uta (ArtUta *uta, gint max_width, gint max_height,
+ gint *p_nrects);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_render.c b/libart_lgpl/art_render.c
index 8792908158..6c71e4a260 100644
--- a/libart_lgpl/art_render.c
+++ b/libart_lgpl/art_render.c
@@ -32,10 +32,10 @@ struct _ArtRenderPriv {
ArtImageSource *image_source;
- int n_mask_source;
+ gint n_mask_source;
ArtMaskSource **mask_source;
- int n_callbacks;
+ gint n_callbacks;
ArtRenderCallback **callbacks;
};
@@ -46,9 +46,9 @@ art_render_nop_done (ArtRenderCallback *self, ArtRender *render)
static void
art_render_clear_render_rgb8 (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
- int width = render->x1 - render->x0;
+ gint width = render->x1 - render->x0;
art_u8 r, g, b;
ArtPixMaxDepth color_max;
@@ -64,12 +64,12 @@ art_render_clear_render_rgb8 (ArtRenderCallback *self, ArtRender *render,
static void
art_render_clear_render_8 (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
- int width = render->x1 - render->x0;
- int i, j;
- int n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE);
- int ix;
+ gint width = render->x1 - render->x0;
+ gint i, j;
+ gint n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE);
+ gint ix;
art_u8 color[ART_MAX_CHAN + 1];
for (j = 0; j < n_ch; j++)
@@ -100,18 +100,18 @@ const ArtRenderCallback art_render_clear_8_obj =
static void
art_render_clear_render_16 (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
- int width = render->x1 - render->x0;
- int i, j;
- int n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE);
- int ix;
+ gint width = render->x1 - render->x0;
+ gint i, j;
+ gint n_ch = render->n_chan + (render->alpha_type != ART_ALPHA_NONE);
+ gint ix;
art_u16 *dest_16 = (art_u16 *)dest;
art_u8 color[ART_MAX_CHAN + 1];
for (j = 0; j < n_ch; j++)
{
- int color_16 = render->clear_color[j];
+ gint color_16 = render->clear_color[j];
color[j] = color_16;
}
@@ -135,31 +135,31 @@ const ArtRenderCallback art_render_clear_16_obj =
lead to overflow. */
static void
art_render_composite (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
ArtRenderMaskRun *run = render->run;
art_u32 depth = render->depth;
- int n_run = render->n_run;
- int x0 = render->x0;
- int x;
- int run_x0, run_x1;
+ gint n_run = render->n_run;
+ gint x0 = render->x0;
+ gint x;
+ gint run_x0, run_x1;
art_u8 *alpha_buf = render->alpha_buf;
art_u8 *image_buf = render->image_buf;
- int i, j;
+ gint i, j;
art_u32 tmp;
art_u32 run_alpha;
art_u32 alpha;
- int image_ix;
+ gint image_ix;
art_u16 src[ART_MAX_CHAN + 1];
art_u16 dst[ART_MAX_CHAN + 1];
- int n_chan = render->n_chan;
+ gint n_chan = render->n_chan;
ArtAlphaType alpha_type = render->alpha_type;
- int n_ch = n_chan + (alpha_type != ART_ALPHA_NONE);
- int dst_pixstride = n_ch * (depth >> 3);
- int buf_depth = render->buf_depth;
+ gint n_ch = n_chan + (alpha_type != ART_ALPHA_NONE);
+ gint dst_pixstride = n_ch * (depth >> 3);
+ gint buf_depth = render->buf_depth;
ArtAlphaType buf_alpha = render->buf_alpha;
- int buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE);
- int buf_pixstride = buf_n_ch * (buf_depth >> 3);
+ gint buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE);
+ gint buf_pixstride = buf_n_ch * (buf_depth >> 3);
art_u8 *bufptr;
art_u32 src_alpha;
art_u32 src_mul;
@@ -176,7 +176,7 @@ art_render_composite (ArtRenderCallback *self, ArtRender *render,
if (tmp < 0x8100)
continue;
- run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */
+ run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8;
bufptr = image_buf + (run_x0 - x0) * buf_pixstride;
dstptr = dest + (run_x0 - x0) * dst_pixstride;
for (x = run_x0; x < run_x1; x++)
@@ -356,27 +356,27 @@ const ArtRenderCallback art_render_composite_obj =
static void
art_render_composite_8 (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
ArtRenderMaskRun *run = render->run;
- int n_run = render->n_run;
- int x0 = render->x0;
- int x;
- int run_x0, run_x1;
+ gint n_run = render->n_run;
+ gint x0 = render->x0;
+ gint x;
+ gint run_x0, run_x1;
art_u8 *alpha_buf = render->alpha_buf;
art_u8 *image_buf = render->image_buf;
- int i, j;
+ gint i, j;
art_u32 tmp;
art_u32 run_alpha;
art_u32 alpha;
- int image_ix;
- int n_chan = render->n_chan;
+ gint image_ix;
+ gint n_chan = render->n_chan;
ArtAlphaType alpha_type = render->alpha_type;
- int n_ch = n_chan + (alpha_type != ART_ALPHA_NONE);
- int dst_pixstride = n_ch;
+ gint n_ch = n_chan + (alpha_type != ART_ALPHA_NONE);
+ gint dst_pixstride = n_ch;
ArtAlphaType buf_alpha = render->buf_alpha;
- int buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE);
- int buf_pixstride = buf_n_ch;
+ gint buf_n_ch = n_chan + (buf_alpha != ART_ALPHA_NONE);
+ gint buf_pixstride = buf_n_ch;
art_u8 *bufptr;
art_u32 src_alpha;
art_u32 src_mul;
@@ -393,7 +393,7 @@ art_render_composite_8 (ArtRenderCallback *self, ArtRender *render,
if (tmp < 0x10000)
continue;
- run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */
+ run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8;
bufptr = image_buf + (run_x0 - x0) * buf_pixstride;
dstptr = dest + (run_x0 - x0) * dst_pixstride;
for (x = run_x0; x < run_x1; x++)
@@ -497,7 +497,6 @@ const ArtRenderCallback art_render_composite_8_obj =
art_render_nop_done
};
-
/* Assumes:
* alpha_buf is NULL
* buf_alpha = ART_ALPHA_NONE (source)
@@ -506,18 +505,18 @@ const ArtRenderCallback art_render_composite_8_obj =
*/
static void
art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
ArtRenderMaskRun *run = render->run;
- int n_run = render->n_run;
- int x0 = render->x0;
- int x;
- int run_x0, run_x1;
+ gint n_run = render->n_run;
+ gint x0 = render->x0;
+ gint x;
+ gint run_x0, run_x1;
art_u8 *image_buf = render->image_buf;
- int i, j;
+ gint i, j;
art_u32 tmp;
art_u32 run_alpha;
- int image_ix;
+ gint image_ix;
art_u8 *bufptr;
art_u32 src_mul;
art_u8 *dstptr;
@@ -533,7 +532,7 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render,
if (tmp < 0x10000)
continue;
- run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */
+ run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8;
bufptr = image_buf + (run_x0 - x0) * 3;
dstptr = dest + (run_x0 - x0) * 4;
if (run_alpha == 0x10000)
@@ -551,27 +550,27 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render,
for (x = run_x0; x < run_x1; x++)
{
src_mul = run_alpha * 0x101;
-
+
tmp = dstptr[3];
/* range 0..0xff */
dst_alpha = (tmp << 8) + tmp + (tmp >> 7);
dst_mul = dst_alpha;
/* dst_alpha is the alpha of the dest pixel,
range 0..0x10000 */
-
+
dst_mul *= 0x101;
-
+
dst_alpha += ((((0x10000 - dst_alpha) * run_alpha) >> 8) + 0x80) >> 8;
if (dst_alpha == 0)
dst_save_mul = 0xff;
else /* (dst_alpha != 0) */
dst_save_mul = 0xff0000 / dst_alpha;
-
+
for (j = 0; j < 3; j++)
{
art_u32 src, dst;
art_u32 tmp;
-
+
src = (bufptr[j] * src_mul + 0x8000) >> 16;
dst = (dstptr[j] * dst_mul + 0x8000) >> 16;
tmp = ((dst * (0x10000 - run_alpha) + 0x8000) >> 16) + src;
@@ -579,7 +578,7 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render,
dstptr[j] = (tmp * dst_save_mul + 0x8000) >> 16;
}
dstptr[3] = (dst_alpha * 0xff + 0x8000) >> 16;
-
+
bufptr += 3;
dstptr += 4;
}
@@ -587,7 +586,6 @@ art_render_composite_8_opt1 (ArtRenderCallback *self, ArtRender *render,
}
}
-
const ArtRenderCallback art_render_composite_8_opt1_obj =
{
art_render_composite_8_opt1,
@@ -602,18 +600,18 @@ const ArtRenderCallback art_render_composite_8_opt1_obj =
*/
static void
art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y)
+ art_u8 *dest, gint y)
{
ArtRenderMaskRun *run = render->run;
- int n_run = render->n_run;
- int x0 = render->x0;
- int x;
- int run_x0, run_x1;
+ gint n_run = render->n_run;
+ gint x0 = render->x0;
+ gint x;
+ gint run_x0, run_x1;
art_u8 *image_buf = render->image_buf;
- int i, j;
+ gint i, j;
art_u32 tmp;
art_u32 run_alpha;
- int image_ix;
+ gint image_ix;
art_u8 *bufptr;
art_u32 src_alpha;
art_u32 src_mul;
@@ -630,7 +628,7 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
if (tmp < 0x10000)
continue;
- run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8; /* range [0 .. 0x10000] */
+ run_alpha = (tmp + (tmp >> 8) + (tmp >> 16) - 0x8000) >> 8;
bufptr = image_buf + (run_x0 - x0) * 4;
dstptr = dest + (run_x0 - x0) * 4;
if (run_alpha == 0x10000)
@@ -640,28 +638,28 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
src_alpha = (bufptr[3] << 8) + bufptr[3] + (bufptr[3] >> 7);
/* src_alpha is the (alpha of the source pixel),
range 0..0x10000 */
-
+
dst_alpha = (dstptr[3] << 8) + dstptr[3] + (dstptr[3] >> 7);
/* dst_alpha is the alpha of the dest pixel,
range 0..0x10000 */
-
+
dst_mul = dst_alpha*0x101;
-
+
if (src_alpha >= 0x10000)
dst_alpha = 0x10000;
else
dst_alpha += ((((0x10000 - dst_alpha) * src_alpha) >> 8) + 0x80) >> 8;
-
+
if (dst_alpha == 0)
dst_save_mul = 0xff;
else /* dst_alpha != 0) */
dst_save_mul = 0xff0000 / dst_alpha;
-
+
for (j = 0; j < 3; j++)
{
art_u32 src, dst;
art_u32 tmp;
-
+
src = (bufptr[j] << 8) | bufptr[j];
dst = (dstptr[j] * dst_mul + 0x8000) >> 16;
tmp = ((dst * (0x10000 - src_alpha) + 0x8000) >> 16) + src;
@@ -669,7 +667,7 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
dstptr[j] = (tmp * dst_save_mul + 0x8000) >> 16;
}
dstptr[3] = (dst_alpha * 0xff + 0x8000) >> 16;
-
+
bufptr += 4;
dstptr += 4;
}
@@ -683,23 +681,23 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
src_alpha = (tmp + (tmp >> 8) + (tmp >> 16)) >> 8;
/* src_alpha is the (alpha of the source pixel * alpha),
range 0..0x10000 */
-
+
src_mul = run_alpha * 0x101;
-
+
tmp = dstptr[3];
/* range 0..0xff */
dst_alpha = (tmp << 8) + tmp + (tmp >> 7);
dst_mul = dst_alpha;
/* dst_alpha is the alpha of the dest pixel,
range 0..0x10000 */
-
+
dst_mul *= 0x101;
-
+
if (src_alpha >= 0x10000)
dst_alpha = 0x10000;
else
dst_alpha += ((((0x10000 - dst_alpha) * src_alpha) >> 8) + 0x80) >> 8;
-
+
if (dst_alpha == 0)
{
dst_save_mul = 0xff;
@@ -708,12 +706,12 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
{
dst_save_mul = 0xff0000 / dst_alpha;
}
-
+
for (j = 0; j < 3; j++)
{
art_u32 src, dst;
art_u32 tmp;
-
+
src = (bufptr[j] * src_mul + 0x8000) >> 16;
dst = (dstptr[j] * dst_mul + 0x8000) >> 16;
tmp = ((dst * (0x10000 - src_alpha) + 0x8000) >> 16) + src;
@@ -721,7 +719,7 @@ art_render_composite_8_opt2 (ArtRenderCallback *self, ArtRender *render,
dstptr[j] = (tmp * dst_save_mul + 0x8000) >> 16;
}
dstptr[3] = (dst_alpha * 0xff + 0x8000) >> 16;
-
+
bufptr += 4;
dstptr += 4;
}
@@ -735,4 +733,3 @@ const ArtRenderCallback art_render_composite_8_opt2_obj =
art_render_nop_done
};
-
diff --git a/libart_lgpl/art_render.h b/libart_lgpl/art_render.h
index 69e1d9346e..e97d3bbddc 100644
--- a/libart_lgpl/art_render.h
+++ b/libart_lgpl/art_render.h
@@ -76,13 +76,13 @@ typedef enum {
} ArtImageSourceFlags;
struct _ArtRenderMaskRun {
- int x;
- int alpha;
+ gint x;
+ gint alpha;
};
struct _ArtRenderCallback {
void (*render) (ArtRenderCallback *self, ArtRender *render,
- art_u8 *dest, int y);
+ art_u8 *dest, gint y);
void (*done) (ArtRenderCallback *self, ArtRender *render);
};
@@ -90,12 +90,12 @@ struct _ArtImageSource {
ArtRenderCallback super;
void (*negotiate) (ArtImageSource *self, ArtRender *render,
ArtImageSourceFlags *p_flags,
- int *p_buf_depth, ArtAlphaType *p_alpha_type);
+ gint *p_buf_depth, ArtAlphaType *p_alpha_type);
};
struct _ArtMaskSource {
ArtRenderCallback super;
- int (*can_drive) (ArtMaskSource *self, ArtRender *render);
+ gint (*can_drive) (ArtMaskSource *self, ArtRender *render);
/* For each mask source, ::prepare() is invoked if it is not
a driver, or ::invoke_driver() if it is. */
void (*invoke_driver) (ArtMaskSource *self, ArtRender *render);
@@ -104,12 +104,12 @@ struct _ArtMaskSource {
struct _ArtRender {
/* parameters of destination image */
- int x0, y0;
- int x1, y1;
+ gint x0, y0;
+ gint x1, y1;
art_u8 *pixels;
- int rowstride;
- int n_chan;
- int depth;
+ gint rowstride;
+ gint n_chan;
+ gint depth;
ArtAlphaType alpha_type;
art_boolean clear;
@@ -123,18 +123,18 @@ struct _ArtRender {
art_u8 *alpha_buf;
/* parameters of intermediate buffer */
- int buf_depth;
+ gint buf_depth;
ArtAlphaType buf_alpha;
art_u8 *image_buf;
/* driving alpha scanline data */
/* A "run" is a contiguous sequence of x values with the same alpha value. */
- int n_run;
+ gint n_run;
ArtRenderMaskRun *run;
/* A "span" is a contiguous sequence of x values with non-zero alpha. */
- int n_span;
- int *span_x;
+ gint n_span;
+ gint *span_x;
art_boolean need_span;
};
diff --git a/libart_lgpl/art_rgb.c b/libart_lgpl/art_rgb.c
index 05bfa02289..34e6d237f9 100644
--- a/libart_lgpl/art_rgb.c
+++ b/libart_lgpl/art_rgb.c
@@ -50,7 +50,7 @@
void
art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n)
{
- int i;
+ gint i;
if (r == g && g == b)
{
@@ -87,10 +87,10 @@ art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n)
* The implementation of this routine is very highly optimized.
**/
void
-art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n)
+art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n)
{
- int i;
- unsigned int v1, v2, v3;
+ gint i;
+ guint v1, v2, v3;
if (r == g && g == b)
{
@@ -157,10 +157,10 @@ art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n)
* opacity @alpha.
**/
void
-art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n)
+art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint alpha, gint n)
{
- int i;
- int v;
+ gint i;
+ gint v;
for (i = 0; i < n; i++)
{
diff --git a/libart_lgpl/art_rgb.h b/libart_lgpl/art_rgb.h
index c195a5c43f..d7581b4402 100644
--- a/libart_lgpl/art_rgb.h
+++ b/libart_lgpl/art_rgb.h
@@ -27,11 +27,11 @@ extern "C" {
#endif
void
-art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int n);
+art_rgb_fill_run (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint n);
void
-art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, int alpha,
- int n);
+art_rgb_run_alpha (art_u8 *buf, art_u8 r, art_u8 g, art_u8 b, gint alpha,
+ gint n);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_rgb_affine.c b/libart_lgpl/art_rgb_affine.c
index 1d826672d1..61cdb1e9a8 100644
--- a/libart_lgpl/art_rgb_affine.c
+++ b/libart_lgpl/art_rgb_affine.c
@@ -61,23 +61,23 @@
* implemented.
**/
void
-art_rgb_affine (art_u8 *dst, int x0, int y0, int x1, int y1, int dst_rowstride,
+art_rgb_affine (art_u8 *dst, gint x0, gint y0, gint x1, gint y1, gint dst_rowstride,
const art_u8 *src,
- int src_width, int src_height, int src_rowstride,
- const double affine[6],
+ gint src_width, gint src_height, gint src_rowstride,
+ const gdouble affine[6],
ArtFilterLevel level,
ArtAlphaGamma *alphagamma)
{
/* Note: this is a slow implementation, and is missing all filter
levels other than NEAREST. It is here for clarity of presentation
and to establish the interface. */
- int x, y;
- double inv[6];
+ gint x, y;
+ gdouble inv[6];
art_u8 *dst_p, *dst_linestart;
const art_u8 *src_p;
ArtPoint pt, src_pt;
- int src_x, src_y;
- int run_x0, run_x1;
+ gint src_x, src_y;
+ gint run_x0, run_x1;
dst_linestart = dst;
art_affine_invert (inv, affine);
diff --git a/libart_lgpl/art_rgb_affine.h b/libart_lgpl/art_rgb_affine.h
index 1bf146ae70..9f1414753a 100644
--- a/libart_lgpl/art_rgb_affine.h
+++ b/libart_lgpl/art_rgb_affine.h
@@ -31,10 +31,10 @@ extern "C" {
#endif
void
-art_rgb_affine (art_u8 *dst, int x0, int y0, int x1, int y1, int dst_rowstride,
+art_rgb_affine (art_u8 *dst, gint x0, gint y0, gint x1, gint y1, gint dst_rowstride,
const art_u8 *src,
- int src_width, int src_height, int src_rowstride,
- const double affine[6],
+ gint src_width, gint src_height, gint src_rowstride,
+ const gdouble affine[6],
ArtFilterLevel level,
ArtAlphaGamma *alphagamma);
diff --git a/libart_lgpl/art_rgb_affine_private.c b/libart_lgpl/art_rgb_affine_private.c
index 679e114c14..9f2d12026f 100644
--- a/libart_lgpl/art_rgb_affine_private.c
+++ b/libart_lgpl/art_rgb_affine_private.c
@@ -40,14 +40,14 @@
#define EPSILON 1e-6
void
-art_rgb_affine_run (int *p_x0, int *p_x1, int y,
- int src_width, int src_height,
- const double affine[6])
+art_rgb_affine_run (gint *p_x0, gint *p_x1, gint y,
+ gint src_width, gint src_height,
+ const gdouble affine[6])
{
- int x0, x1;
- double z;
- double x_intercept;
- int xi;
+ gint x0, x1;
+ gdouble z;
+ gdouble x_intercept;
+ gint xi;
x0 = *p_x0;
x1 = *p_x1;
diff --git a/libart_lgpl/art_rgb_affine_private.h b/libart_lgpl/art_rgb_affine_private.h
index edaf0e3aaa..a01ad770f1 100644
--- a/libart_lgpl/art_rgb_affine_private.h
+++ b/libart_lgpl/art_rgb_affine_private.h
@@ -23,14 +23,16 @@
/* This module handles compositing of affine-transformed rgb images
over rgb pixel buffers. */
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
void
-art_rgb_affine_run (int *p_x0, int *p_x1, int y,
- int src_width, int src_height,
- const double affine[6]);
+art_rgb_affine_run (gint *p_x0, gint *p_x1, gint y,
+ gint src_width, gint src_height,
+ const gdouble affine[6]);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_rgb_rgba_affine.c b/libart_lgpl/art_rgb_rgba_affine.c
index 41c7397270..a6da49ed91 100644
--- a/libart_lgpl/art_rgb_rgba_affine.c
+++ b/libart_lgpl/art_rgb_rgba_affine.c
@@ -64,27 +64,27 @@
**/
void
art_rgb_rgba_affine (art_u8 *dst,
- int x0, int y0, int x1, int y1, int dst_rowstride,
+ gint x0, gint y0, gint x1, gint y1, gint dst_rowstride,
const art_u8 *src,
- int src_width, int src_height, int src_rowstride,
- const double affine[6],
+ gint src_width, gint src_height, gint src_rowstride,
+ const gdouble affine[6],
ArtFilterLevel level,
ArtAlphaGamma *alphagamma)
{
/* Note: this is a slow implementation, and is missing all filter
levels other than NEAREST. It is here for clarity of presentation
and to establish the interface. */
- int x, y;
- double inv[6];
+ gint x, y;
+ gdouble inv[6];
art_u8 *dst_p, *dst_linestart;
const art_u8 *src_p;
ArtPoint pt, src_pt;
- int src_x, src_y;
- int alpha;
+ gint src_x, src_y;
+ gint alpha;
art_u8 bg_r, bg_g, bg_b;
art_u8 fg_r, fg_g, fg_b;
- int tmp;
- int run_x0, run_x1;
+ gint tmp;
+ gint run_x0, run_x1;
dst_linestart = dst;
art_affine_invert (inv, affine);
@@ -121,14 +121,14 @@ art_rgb_rgba_affine (art_u8 *dst,
bg_r = dst_p[0];
bg_g = dst_p[1];
bg_b = dst_p[2];
-
+
tmp = (src_p[0] - bg_r) * alpha;
fg_r = bg_r + ((tmp + (tmp >> 8) + 0x80) >> 8);
tmp = (src_p[1] - bg_g) * alpha;
fg_g = bg_g + ((tmp + (tmp >> 8) + 0x80) >> 8);
tmp = (src_p[2] - bg_b) * alpha;
fg_b = bg_b + ((tmp + (tmp >> 8) + 0x80) >> 8);
-
+
dst_p[0] = fg_r;
dst_p[1] = fg_g;
dst_p[2] = fg_b;
diff --git a/libart_lgpl/art_rgb_rgba_affine.h b/libart_lgpl/art_rgb_rgba_affine.h
index 9428231798..154084b670 100644
--- a/libart_lgpl/art_rgb_rgba_affine.h
+++ b/libart_lgpl/art_rgb_rgba_affine.h
@@ -32,10 +32,10 @@ extern "C" {
void
art_rgb_rgba_affine (art_u8 *dst,
- int x0, int y0, int x1, int y1, int dst_rowstride,
+ gint x0, gint y0, gint x1, gint y1, gint dst_rowstride,
const art_u8 *src,
- int src_width, int src_height, int src_rowstride,
- const double affine[6],
+ gint src_width, gint src_height, gint src_rowstride,
+ const gdouble affine[6],
ArtFilterLevel level,
ArtAlphaGamma *alphagamma);
diff --git a/libart_lgpl/art_rgb_svp.c b/libart_lgpl/art_rgb_svp.c
index d03101653d..afd57aeed6 100644
--- a/libart_lgpl/art_rgb_svp.c
+++ b/libart_lgpl/art_rgb_svp.c
@@ -32,29 +32,29 @@ typedef struct _ArtRgbSVPAlphaData ArtRgbSVPAlphaData;
struct _ArtRgbSVPData {
art_u32 rgbtab[256];
art_u8 *buf;
- int rowstride;
- int x0, x1;
+ gint rowstride;
+ gint x0, x1;
};
struct _ArtRgbSVPAlphaData {
- int alphatab[256];
+ gint alphatab[256];
art_u8 r, g, b, alpha;
art_u8 *buf;
- int rowstride;
- int x0, x1;
+ gint rowstride;
+ gint x0, x1;
};
static void
-art_rgb_svp_callback (void *callback_data, int y,
- int start, ArtSVPRenderAAStep *steps, int n_steps)
+art_rgb_svp_callback (gpointer callback_data, gint y,
+ gint start, ArtSVPRenderAAStep *steps, gint n_steps)
{
ArtRgbSVPData *data = (ArtRgbSVPData *)callback_data;
art_u8 *linebuf;
- int run_x0, run_x1;
+ gint run_x0, run_x1;
art_u32 running_sum = start;
art_u32 rgb;
- int x0, x1;
- int k;
+ gint x0, x1;
+ gint k;
linebuf = data->buf;
x0 = data->x0;
@@ -137,18 +137,18 @@ art_rgb_svp_callback (void *callback_data, int y,
**/
void
art_rgb_svp_aa (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
+ gint x0, gint y0, gint x1, gint y1,
art_u32 fg_color, art_u32 bg_color,
- art_u8 *buf, int rowstride,
+ art_u8 *buf, gint rowstride,
ArtAlphaGamma *alphagamma)
{
ArtRgbSVPData data;
- int r_fg, g_fg, b_fg;
- int r_bg, g_bg, b_bg;
- int r, g, b;
- int dr, dg, db;
- int i;
+ gint r_fg, g_fg, b_fg;
+ gint r_bg, g_bg, b_bg;
+ gint r, g, b;
+ gint dr, dg, db;
+ gint i;
if (alphagamma == NULL)
{
@@ -177,7 +177,7 @@ art_rgb_svp_aa (const ArtSVP *svp,
}
else
{
- int *table;
+ gint *table;
art_u8 *invtab;
table = alphagamma->table;
@@ -216,18 +216,18 @@ art_rgb_svp_aa (const ArtSVP *svp,
}
static void
-art_rgb_svp_alpha_callback (void *callback_data, int y,
- int start, ArtSVPRenderAAStep *steps, int n_steps)
+art_rgb_svp_alpha_callback (gpointer callback_data, gint y,
+ gint start, ArtSVPRenderAAStep *steps, gint n_steps)
{
ArtRgbSVPAlphaData *data = (ArtRgbSVPAlphaData *)callback_data;
art_u8 *linebuf;
- int run_x0, run_x1;
+ gint run_x0, run_x1;
art_u32 running_sum = start;
- int x0, x1;
- int k;
+ gint x0, x1;
+ gint k;
art_u8 r, g, b;
- int *alphatab;
- int alpha;
+ gint *alphatab;
+ gint alpha;
linebuf = data->buf;
x0 = data->x0;
@@ -287,19 +287,19 @@ art_rgb_svp_alpha_callback (void *callback_data, int y,
}
static void
-art_rgb_svp_alpha_opaque_callback (void *callback_data, int y,
- int start,
- ArtSVPRenderAAStep *steps, int n_steps)
+art_rgb_svp_alpha_opaque_callback (gpointer callback_data, gint y,
+ gint start,
+ ArtSVPRenderAAStep *steps, gint n_steps)
{
ArtRgbSVPAlphaData *data = (ArtRgbSVPAlphaData *)callback_data;
art_u8 *linebuf;
- int run_x0, run_x1;
+ gint run_x0, run_x1;
art_u32 running_sum = start;
- int x0, x1;
- int k;
+ gint x0, x1;
+ gint k;
art_u8 r, g, b;
- int *alphatab;
- int alpha;
+ gint *alphatab;
+ gint alpha;
linebuf = data->buf;
x0 = data->x0;
@@ -415,15 +415,15 @@ art_rgb_svp_alpha_opaque_callback (void *callback_data, int y,
**/
void
art_rgb_svp_alpha (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
+ gint x0, gint y0, gint x1, gint y1,
art_u32 rgba,
- art_u8 *buf, int rowstride,
+ art_u8 *buf, gint rowstride,
ArtAlphaGamma *alphagamma)
{
ArtRgbSVPAlphaData data;
- int r, g, b, alpha;
- int i;
- int a, da;
+ gint r, g, b, alpha;
+ gint i;
+ gint a, da;
r = rgba >> 24;
g = (rgba >> 16) & 0xff;
diff --git a/libart_lgpl/art_rgb_svp.h b/libart_lgpl/art_rgb_svp.h
index c76aa40ef1..5d68616255 100644
--- a/libart_lgpl/art_rgb_svp.h
+++ b/libart_lgpl/art_rgb_svp.h
@@ -31,16 +31,16 @@ extern "C" {
void
art_rgb_svp_aa (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
+ gint x0, gint y0, gint x1, gint y1,
art_u32 fg_color, art_u32 bg_color,
- art_u8 *buf, int rowstride,
+ art_u8 *buf, gint rowstride,
ArtAlphaGamma *alphagamma);
void
art_rgb_svp_alpha (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
+ gint x0, gint y0, gint x1, gint y1,
art_u32 rgba,
- art_u8 *buf, int rowstride,
+ art_u8 *buf, gint rowstride,
ArtAlphaGamma *alphagamma);
#ifdef __cplusplus
diff --git a/libart_lgpl/art_svp.c b/libart_lgpl/art_svp.c
index 09def996b6..69814cca00 100644
--- a/libart_lgpl/art_svp.c
+++ b/libart_lgpl/art_svp.c
@@ -24,18 +24,17 @@
#include "art_misc.h"
-
/**
* art_svp_free: Free an #ArtSVP structure.
* @svp: #ArtSVP to free.
- *
+ *
* Frees an #ArtSVP structure and all the segments in it.
**/
void
art_svp_free (ArtSVP *svp)
{
- int n_segs = svp->n_segs;
- int i;
+ gint n_segs = svp->n_segs;
+ gint i;
for (i = 0; i < n_segs; i++)
art_free (svp->segs[i].points);
@@ -52,12 +51,12 @@ art_svp_free (ArtSVP *svp)
* art_svp_seg_compare: Compare two segments of an svp.
* @seg1: First segment to compare.
* @seg2: Second segment to compare.
- *
+ *
* Compares two segments of an svp. Return 1 if @seg2 is below or to the
* right of @seg1, -1 otherwise.
**/
-int
-art_svp_seg_compare (const void *s1, const void *s2)
+gint
+art_svp_seg_compare (gconstpointer s1, gconstpointer s2)
{
const ArtSVPSeg *seg1 = s1;
const ArtSVPSeg *seg2 = s2;
diff --git a/libart_lgpl/art_svp.h b/libart_lgpl/art_svp.h
index fde6c22e64..f1627c70ef 100644
--- a/libart_lgpl/art_svp.h
+++ b/libart_lgpl/art_svp.h
@@ -33,22 +33,22 @@ typedef struct _ArtSVP ArtSVP;
typedef struct _ArtSVPSeg ArtSVPSeg;
struct _ArtSVPSeg {
- int n_points;
- int dir; /* == 0 for "up", 1 for "down" */
+ gint n_points;
+ gint dir; /* == 0 for "up", 1 for "down" */
ArtDRect bbox;
ArtPoint *points;
};
struct _ArtSVP {
- int n_segs;
+ gint n_segs;
ArtSVPSeg segs[1];
};
void
art_svp_free (ArtSVP *svp);
-int
-art_svp_seg_compare (const void *s1, const void *s2);
+gint
+art_svp_seg_compare (gconstpointer s1, gconstpointer s2);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_svp_intersect.c b/libart_lgpl/art_svp_intersect.c
index 470c16e7ff..f79216c13a 100644
--- a/libart_lgpl/art_svp_intersect.c
+++ b/libart_lgpl/art_svp_intersect.c
@@ -35,8 +35,6 @@
should not be necessary. */
#define CHEAP_SANITYCHECK
-#define noVERBOSE
-
#include "art_misc.h"
/* A priority queue - perhaps move to a separate file if it becomes
@@ -48,15 +46,15 @@ typedef struct _ArtPriQ ArtPriQ;
typedef struct _ArtPriPoint ArtPriPoint;
struct _ArtPriQ {
- int n_items;
- int n_items_max;
+ gint n_items;
+ gint n_items_max;
ArtPriPoint **items;
};
struct _ArtPriPoint {
- double x;
- double y;
- void *user_data;
+ gdouble x;
+ gdouble y;
+ gpointer user_data;
};
static ArtPriQ *
@@ -89,10 +87,10 @@ art_pri_empty (ArtPriQ *pq)
http://www.cs.rutgers.edu/~chvatal/notes/pq.html#heap */
static void
-art_pri_bubble_up (ArtPriQ *pq, int vacant, ArtPriPoint *missing)
+art_pri_bubble_up (ArtPriQ *pq, gint vacant, ArtPriPoint *missing)
{
ArtPriPoint **items = pq->items;
- int parent;
+ gint parent;
parent = (vacant - 1) >> 1;
while (vacant > 0 && (missing->y < items[parent]->y ||
@@ -120,8 +118,8 @@ static void
art_pri_sift_down_from_root (ArtPriQ *pq, ArtPriPoint *missing)
{
ArtPriPoint **items = pq->items;
- int vacant = 0, child = 2;
- int n = pq->n_items;
+ gint vacant = 0, child = 2;
+ gint n = pq->n_items;
while (child < n)
{
@@ -157,10 +155,10 @@ art_pri_choose (ArtPriQ *pq)
static ArtPriPoint *
art_pri_choose (ArtPriQ *pq)
{
- int i;
- int best = 0;
- double best_x, best_y;
- double y;
+ gint i;
+ gint best = 0;
+ gdouble best_x, best_y;
+ gdouble y;
ArtPriPoint *result;
if (pq->n_items == 0)
@@ -201,9 +199,9 @@ art_pri_insert (ArtPriQ *pq, ArtPriPoint *point)
#include <stdio.h>
static double
-double_rand (double lo, double hi, int quant)
+double_rand (gdouble lo, gdouble hi, gint quant)
{
- int tmp = rand () / (RAND_MAX * (1.0 / quant)) + 0.5;
+ gint tmp = rand () / (RAND_MAX * (1.0 / quant)) + 0.5;
return lo + tmp * ((hi - lo) / quant);
}
@@ -256,14 +254,14 @@ art_pri_pt_pool_free (ArtPriPtPool *pool)
art_free (pool);
}
-int
-main (int argc, char **argv)
+gint
+main (gint argc, gchar **argv)
{
ArtPriPtPool *pool = art_pri_pt_pool_new ();
ArtPriQ *pq;
- int i, j;
- const int n_iter = 1;
- const int pq_size = 100;
+ gint i, j;
+ const gint n_iter = 1;
+ const gint pq_size = 100;
for (j = 0; j < n_iter; j++)
{
@@ -274,7 +272,7 @@ main (int argc, char **argv)
ArtPriPoint *pt = art_pri_pt_alloc (pool);
pt->x = double_rand (0, 1, 100);
pt->y = double_rand (0, 1, 100);
- pt->user_data = (void *)i;
+ pt->user_data = (gpointer)i;
art_pri_insert (pq, pt);
}
@@ -282,7 +280,7 @@ main (int argc, char **argv)
{
ArtPriPoint *pt = art_pri_choose (pq);
if (n_iter == 1)
- printf ("(%g, %g), %d\n", pt->x, pt->y, (int)pt->user_data);
+ printf ("(%g, %g), %d\n", pt->x, pt->y, (gint)pt->user_data);
art_pri_pt_free (pool, pt);
}
@@ -307,21 +305,21 @@ struct _ArtSvpWriterRewind {
ArtSvpWriter super;
ArtWindRule rule;
ArtSVP *svp;
- int n_segs_max;
- int *n_points_max;
+ gint n_segs_max;
+ gint *n_points_max;
};
-static int
-art_svp_writer_rewind_add_segment (ArtSvpWriter *self, int wind_left,
- int delta_wind, double x, double y)
+static gint
+art_svp_writer_rewind_add_segment (ArtSvpWriter *self, gint wind_left,
+ gint delta_wind, gdouble x, gdouble y)
{
ArtSvpWriterRewind *swr = (ArtSvpWriterRewind *)self;
ArtSVP *svp;
ArtSVPSeg *seg;
art_boolean left_filled, right_filled;
- int wind_right = wind_left + delta_wind;
- int seg_num;
- const int init_n_points_max = 4;
+ gint wind_right = wind_left + delta_wind;
+ gint seg_num;
+ const gint init_n_points_max = 4;
switch (swr->rule)
{
@@ -377,12 +375,12 @@ art_svp_writer_rewind_add_segment (ArtSvpWriter *self, int wind_left,
}
static void
-art_svp_writer_rewind_add_point (ArtSvpWriter *self, int seg_id,
- double x, double y)
+art_svp_writer_rewind_add_point (ArtSvpWriter *self, gint seg_id,
+ gdouble x, gdouble y)
{
ArtSvpWriterRewind *swr = (ArtSvpWriterRewind *)self;
ArtSVPSeg *seg;
- int n_points;
+ gint n_points;
if (seg_id < 0)
/* omitted segment */
@@ -402,7 +400,7 @@ art_svp_writer_rewind_add_point (ArtSvpWriter *self, int seg_id,
}
static void
-art_svp_writer_rewind_close_segment (ArtSvpWriter *self, int seg_id)
+art_svp_writer_rewind_close_segment (ArtSvpWriter *self, gint seg_id)
{
/* Not needed for this simple implementation. A potential future
optimization is to merge segments that can be merged safely. */
@@ -443,7 +441,7 @@ art_svp_writer_rewind_new (ArtWindRule rule)
result->rule = rule;
result->n_segs_max = 16;
- result->svp = art_alloc (sizeof(ArtSVP) +
+ result->svp = art_alloc (sizeof(ArtSVP) +
(result->n_segs_max - 1) * sizeof(ArtSVPSeg));
result->svp->n_segs = 0;
result->n_points_max = art_new (int, result->n_segs_max);
@@ -474,28 +472,28 @@ typedef struct _ArtActiveSeg ArtActiveSeg;
#define ART_ACTIVE_FLAGS_IN_HORIZ 16
struct _ArtActiveSeg {
- int flags;
- int wind_left, delta_wind;
+ gint flags;
+ gint wind_left, delta_wind;
ArtActiveSeg *left, *right; /* doubly linked list structure */
const ArtSVPSeg *in_seg;
- int in_curs;
+ gint in_curs;
- double x[2];
- double y0, y1;
- double a, b, c; /* line equation; ax+by+c = 0 for the line, a^2 + b^2 = 1,
+ gdouble x[2];
+ gdouble y0, y1;
+ gdouble a, b, c; /* line equation; ax+by+c = 0 for the line, a^2 + b^2 = 1,
and a>0 */
/* bottom point and intersection point stack */
- int n_stack;
- int n_stack_max;
+ gint n_stack;
+ gint n_stack_max;
ArtPoint *stack;
/* horiz commit list */
ArtActiveSeg *horiz_left, *horiz_right;
- double horiz_x;
- int horiz_delta_wind;
- int seg_id;
+ gdouble horiz_x;
+ gint horiz_delta_wind;
+ gint seg_id;
};
typedef struct _ArtIntersectCtx ArtIntersectCtx;
@@ -508,12 +506,12 @@ struct _ArtIntersectCtx {
ArtActiveSeg *active_head;
- double y;
+ gdouble y;
ArtActiveSeg *horiz_first;
ArtActiveSeg *horiz_last;
/* segment index of next input segment to be added to pri q */
- int in_curs;
+ gint in_curs;
};
#define EPSILON_A 1e-5 /* Threshold for breaking lines at point insertions */
@@ -532,10 +530,10 @@ static void
art_svp_intersect_setup_seg (ArtActiveSeg *seg, ArtPriPoint *pri_pt)
{
const ArtSVPSeg *in_seg = seg->in_seg;
- int in_curs = seg->in_curs++;
- double x0, y0, x1, y1;
- double dx, dy, s;
- double a, b, r2;
+ gint in_curs = seg->in_curs++;
+ gdouble x0, y0, x1, y1;
+ gdouble dx, dy, s;
+ gdouble a, b, r2;
x0 = in_seg->points[in_curs].x;
y0 = in_seg->points[in_curs].y;
@@ -582,7 +580,6 @@ art_svp_intersect_add_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg)
ArtActiveSeg *place;
ArtActiveSeg *place_right = NULL;
-
#ifdef CHEAP_SANITYCHECK
if (seg->flags & ART_ACTIVE_FLAGS_IN_HORIZ)
{
@@ -611,10 +608,10 @@ art_svp_intersect_add_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg)
static void
art_svp_intersect_push_pt (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
- double x, double y)
+ gdouble x, gdouble y)
{
ArtPriPoint *pri_pt;
- int n_stack = seg->n_stack;
+ gint n_stack = seg->n_stack;
if (n_stack == seg->n_stack_max)
art_expand (seg->stack, ArtPoint, seg->n_stack_max);
@@ -647,12 +644,12 @@ typedef enum {
*/
static double
art_svp_intersect_break (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
- double x_ref, double y, ArtBreakFlags break_flags)
+ gdouble x_ref, gdouble y, ArtBreakFlags break_flags)
{
- double x0, y0, x1, y1;
+ gdouble x0, y0, x1, y1;
const ArtSVPSeg *in_seg = seg->in_seg;
- int in_curs = seg->in_curs;
- double x;
+ gint in_curs = seg->in_curs;
+ gdouble x;
x0 = in_seg->points[in_curs - 1].x;
y0 = in_seg->points[in_curs - 1].y;
@@ -691,22 +688,22 @@ art_svp_intersect_break (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
* NULL if the new point is leftmost.
**/
static ArtActiveSeg *
-art_svp_intersect_add_point (ArtIntersectCtx *ctx, double x, double y,
+art_svp_intersect_add_point (ArtIntersectCtx *ctx, gdouble x, gdouble y,
ArtActiveSeg *seg, ArtBreakFlags break_flags)
{
ArtActiveSeg *left, *right;
- double x_min = x, x_max = x;
+ gdouble x_min = x, x_max = x;
art_boolean left_live, right_live;
- double d;
- double new_x;
+ gdouble d;
+ gdouble new_x;
ArtActiveSeg *test, *result = NULL;
- double x_test;
+ gdouble x_test;
left = seg;
if (left == NULL)
right = ctx->active_head;
else
- right = left->right;
+ right = left->right;
left_live = (break_flags & ART_BREAK_LEFT) && (left != NULL);
right_live = (break_flags & ART_BREAK_RIGHT) && (right != NULL);
while (left_live || right_live)
@@ -834,16 +831,15 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
ArtActiveSeg *left_seg, ArtActiveSeg *right_seg,
ArtBreakFlags break_flags)
{
- double left_x0, left_y0, left_x1;
- double left_y1 = left_seg->y1;
- double right_y1 = right_seg->y1;
- double d;
+ gdouble left_x0, left_y0, left_x1;
+ gdouble left_y1 = left_seg->y1;
+ gdouble right_y1 = right_seg->y1;
+ gdouble d;
const ArtSVPSeg *in_seg;
- int in_curs;
- double d0, d1, t;
- double x, y; /* intersection point */
-
+ gint in_curs;
+ gdouble d0, d1, t;
+ gdouble x, y; /* intersection point */
if (left_seg->y0 == right_seg->y0 && left_seg->x[0] == right_seg->x[0])
{
@@ -855,7 +851,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
if (left_y1 < right_y1)
{
/* Test left (x1, y1) against right segment */
- double left_x1 = left_seg->x[1];
+ gdouble left_x1 = left_seg->x[1];
if (left_x1 <
right_seg->x[(right_seg->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] ||
@@ -867,7 +863,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
else if (d < EPSILON_A)
{
/* I'm unsure about the break flags here. */
- double right_x1 = art_svp_intersect_break (ctx, right_seg,
+ gdouble right_x1 = art_svp_intersect_break (ctx, right_seg,
left_x1, left_y1,
ART_BREAK_RIGHT);
if (left_x1 <= right_x1)
@@ -877,7 +873,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
else if (left_y1 > right_y1)
{
/* Test right (x1, y1) against left segment */
- double right_x1 = right_seg->x[1];
+ gdouble right_x1 = right_seg->x[1];
if (right_x1 > left_seg->x[left_seg->flags & ART_ACTIVE_FLAGS_BNEG] ||
right_y1 == left_seg->y0)
@@ -888,7 +884,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
else if (d > -EPSILON_A)
{
/* See above regarding break flags. */
- double left_x1 = art_svp_intersect_break (ctx, left_seg,
+ gdouble left_x1 = art_svp_intersect_break (ctx, left_seg,
right_x1, right_y1,
ART_BREAK_LEFT);
if (left_x1 <= right_x1)
@@ -897,8 +893,8 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
}
else /* left_y1 == right_y1 */
{
- double left_x1 = left_seg->x[1];
- double right_x1 = right_seg->x[1];
+ gdouble left_x1 = left_seg->x[1];
+ gdouble right_x1 = right_seg->x[1];
if (left_x1 <= right_x1)
return ART_FALSE;
@@ -910,7 +906,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
if (left_y1 < right_y1)
{
/* Test left (x1, y1) against right segment */
- double left_x1 = left_seg->x[1];
+ gdouble left_x1 = left_seg->x[1];
if (left_x1 <
right_seg->x[(right_seg->flags & ART_ACTIVE_FLAGS_BNEG) ^ 1] ||
@@ -921,7 +917,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
return ART_FALSE;
else if (d < EPSILON_A)
{
- double right_x1 = art_svp_intersect_break (ctx, right_seg,
+ gdouble right_x1 = art_svp_intersect_break (ctx, right_seg,
left_x1, left_y1,
ART_BREAK_RIGHT);
if (left_x1 <= right_x1)
@@ -931,7 +927,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
else if (left_y1 > right_y1)
{
/* Test right (x1, y1) against left segment */
- double right_x1 = right_seg->x[1];
+ gdouble right_x1 = right_seg->x[1];
if (right_x1 > left_seg->x[left_seg->flags & ART_ACTIVE_FLAGS_BNEG] ||
right_y1 == left_seg->y0)
@@ -941,7 +937,7 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
return ART_FALSE;
else if (d > -EPSILON_A)
{
- double left_x1 = art_svp_intersect_break (ctx, left_seg,
+ gdouble left_x1 = art_svp_intersect_break (ctx, left_seg,
right_x1, right_y1,
ART_BREAK_LEFT);
if (left_x1 <= right_x1)
@@ -949,9 +945,9 @@ art_svp_intersect_test_cross (ArtIntersectCtx *ctx,
}
}
else /* left_y1 == right_y1 */
- {
- double left_x1 = left_seg->x[1];
- double right_x1 = right_seg->x[1];
+ {
+ gdouble left_x1 = left_seg->x[1];
+ gdouble right_x1 = right_seg->x[1];
if (left_x1 <= right_x1)
return ART_FALSE;
@@ -1168,7 +1164,7 @@ art_svp_intersect_insert_cross (ArtIntersectCtx *ctx,
**/
static void
art_svp_intersect_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
- double x0, double x1)
+ gdouble x0, gdouble x1)
{
ArtActiveSeg *hs;
@@ -1209,7 +1205,7 @@ art_svp_intersect_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
for (left = seg->left; left != NULL; left = seg->left)
{
- int left_bneg = left->flags & ART_ACTIVE_FLAGS_BNEG;
+ gint left_bneg = left->flags & ART_ACTIVE_FLAGS_BNEG;
if (left->x[left_bneg] <= x1)
break;
@@ -1236,7 +1232,7 @@ art_svp_intersect_horiz (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
for (right = seg->right; right != NULL; right = seg->right)
{
- int right_bneg = right->flags & ART_ACTIVE_FLAGS_BNEG;
+ gint right_bneg = right->flags & ART_ACTIVE_FLAGS_BNEG;
if (right->x[right_bneg ^ 1] >= x1)
break;
@@ -1291,7 +1287,7 @@ static void
art_svp_intersect_process_intersection (ArtIntersectCtx *ctx,
ArtActiveSeg *seg)
{
- int n_stack = --seg->n_stack;
+ gint n_stack = --seg->n_stack;
seg->x[1] = seg->stack[n_stack - 1].x;
seg->y1 = seg->stack[n_stack - 1].y;
seg->x[0] = seg->stack[n_stack].x;
@@ -1305,7 +1301,7 @@ art_svp_intersect_advance_cursor (ArtIntersectCtx *ctx, ArtActiveSeg *seg,
ArtPriPoint *pri_pt)
{
const ArtSVPSeg *in_seg = seg->in_seg;
- int in_curs = seg->in_curs;
+ gint in_curs = seg->in_curs;
ArtSvpWriter *swr = seg->flags & ART_ACTIVE_FLAGS_OUT ? ctx->out : NULL;
if (swr != NULL)
@@ -1342,7 +1338,7 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg)
{
ArtActiveSeg *seg = art_new (ArtActiveSeg, 1);
ArtActiveSeg *test;
- double x0, y0;
+ gdouble x0, y0;
ArtActiveSeg *beg_range;
ArtActiveSeg *last = NULL;
ArtActiveSeg *left, *right;
@@ -1356,7 +1352,7 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg)
seg->stack = art_new (ArtPoint, seg->n_stack_max);
seg->horiz_delta_wind = 0;
-
+
seg->wind_left = 0;
pri_pt->user_data = seg;
@@ -1372,8 +1368,8 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg)
beg_range = NULL;
for (test = ctx->active_head; test != NULL; test = test->right)
{
- double d;
- int test_bneg = test->flags & ART_ACTIVE_FLAGS_BNEG;
+ gdouble d;
+ gint test_bneg = test->flags & ART_ACTIVE_FLAGS_BNEG;
if (x0 < test->x[test_bneg])
{
@@ -1386,7 +1382,8 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg)
last = test;
}
- left = art_svp_intersect_add_point (ctx, x0, y0, last, ART_BREAK_LEFT | ART_BREAK_RIGHT);
+ left = art_svp_intersect_add_point (ctx, x0, y0, last,
+ ART_BREAK_LEFT | ART_BREAK_RIGHT);
seg->left = left;
if (left == NULL)
{
@@ -1408,35 +1405,6 @@ art_svp_intersect_add_seg (ArtIntersectCtx *ctx, const ArtSVPSeg *in_seg)
art_svp_intersect_insert_line (ctx, seg);
}
-#ifdef SANITYCHECK
-static void
-art_svp_intersect_sanitycheck_winding (ArtIntersectCtx *ctx)
-{
-#if 0
- /* At this point, we seem to be getting false positives, so it's
- turned off for now. */
-
- ArtActiveSeg *seg;
- int winding_number = 0;
-
- for (seg = ctx->active_head; seg != NULL; seg = seg->right)
- {
- /* Check winding number consistency. */
- if (seg->flags & ART_ACTIVE_FLAGS_OUT)
- {
- if (winding_number != seg->wind_left)
- art_warn ("*** art_svp_intersect_sanitycheck_winding: seg %lx has wind_left of %d, expected %d\n",
- (unsigned long) seg, seg->wind_left, winding_number);
- winding_number = seg->wind_left + seg->delta_wind;
- }
- }
- if (winding_number != 0)
- art_warn ("*** art_svp_intersect_sanitycheck_winding: non-balanced winding number %d\n",
- winding_number);
-#endif
-}
-#endif
-
/**
* art_svp_intersect_horiz_commit: Commit points in horiz list to output.
* @ctx: Intersection context.
@@ -1457,22 +1425,22 @@ static void
art_svp_intersect_horiz_commit (ArtIntersectCtx *ctx)
{
ArtActiveSeg *seg;
- int winding_number = 0; /* initialization just to avoid warning */
- int horiz_wind = 0;
- double last_x = 0; /* initialization just to avoid warning */
+ gint winding_number = 0; /* initialization just to avoid warning */
+ gint horiz_wind = 0;
+ gdouble last_x = 0; /* initialization just to avoid warning */
/* Output points to svp writer. */
for (seg = ctx->horiz_first; seg != NULL;)
{
/* Find a cluster with common horiz_x, */
ArtActiveSeg *curs;
- double x = seg->horiz_x;
+ gdouble x = seg->horiz_x;
/* Generate any horizontal segments. */
if (horiz_wind != 0)
{
ArtSvpWriter *swr = ctx->out;
- int seg_id;
+ gint seg_id;
seg_id = swr->add_segment (swr, winding_number, horiz_wind,
last_x, ctx->y);
@@ -1552,9 +1520,6 @@ art_svp_intersect_horiz_commit (ArtIntersectCtx *ctx)
}
ctx->horiz_first = NULL;
ctx->horiz_last = NULL;
-#ifdef SANITYCHECK
- art_svp_intersect_sanitycheck_winding (ctx);
-#endif
}
#ifdef SANITYCHECK
@@ -1563,7 +1528,7 @@ art_svp_intersect_sanitycheck (ArtIntersectCtx *ctx)
{
ArtActiveSeg *seg;
ArtActiveSeg *last = NULL;
- double d;
+ gdouble d;
for (seg = ctx->active_head; seg != NULL; seg = seg->right)
{
@@ -1687,7 +1652,7 @@ art_svp_intersector (const ArtSVP *in, ArtSvpWriter *out)
}
else
{
- int n_stack = seg->n_stack;
+ gint n_stack = seg->n_stack;
if (n_stack > 1)
{
diff --git a/libart_lgpl/art_svp_intersect.h b/libart_lgpl/art_svp_intersect.h
index c73b3530c5..b585ed20f5 100644
--- a/libart_lgpl/art_svp_intersect.h
+++ b/libart_lgpl/art_svp_intersect.h
@@ -41,10 +41,10 @@ typedef enum {
typedef struct _ArtSvpWriter ArtSvpWriter;
struct _ArtSvpWriter {
- int (*add_segment) (ArtSvpWriter *self, int wind_left, int delta_wind,
- double x, double y);
- void (*add_point) (ArtSvpWriter *self, int seg_id, double x, double y);
- void (*close_segment) (ArtSvpWriter *self, int seg_id);
+ gint (*add_segment) (ArtSvpWriter *self, gint wind_left, gint delta_wind,
+ gdouble x, gdouble y);
+ void (*add_point) (ArtSvpWriter *self, gint seg_id, gdouble x, gdouble y);
+ void (*close_segment) (ArtSvpWriter *self, gint seg_id);
};
ArtSvpWriter *
@@ -54,8 +54,8 @@ ArtSVP *
art_svp_writer_rewind_reap (ArtSvpWriter *self);
#if 0 /* XXX already declared in art_svp.h */
-int
-art_svp_seg_compare (const void *s1, const void *s2);
+gint
+art_svp_seg_compare (gconstpointer s1, gconstpointer s2);
#endif
void
diff --git a/libart_lgpl/art_svp_ops.c b/libart_lgpl/art_svp_ops.c
index 08991aac1b..9c5d461bfd 100644
--- a/libart_lgpl/art_svp_ops.c
+++ b/libart_lgpl/art_svp_ops.c
@@ -17,8 +17,6 @@
* Boston, MA 02111-1307, USA.
*/
-#define noVERBOSE
-
/* Vector path set operations, over sorted vpaths. */
#include "config.h"
@@ -56,8 +54,8 @@ static ArtSVP *
art_svp_merge (const ArtSVP *svp1, const ArtSVP *svp2)
{
ArtSVP *svp_new;
- int ix;
- int ix1, ix2;
+ gint ix;
+ gint ix1, ix2;
svp_new = (ArtSVP *)art_alloc (sizeof(ArtSVP) +
(svp1->n_segs + svp2->n_segs - 1) *
@@ -78,77 +76,6 @@ art_svp_merge (const ArtSVP *svp1, const ArtSVP *svp2)
return svp_new;
}
-#ifdef VERBOSE
-
-#define XOFF 50
-#define YOFF 700
-
-static void
-print_ps_vpath (ArtVpath *vpath)
-{
- int i;
-
- printf ("gsave %d %d translate 1 -1 scale\n", XOFF, YOFF);
- for (i = 0; vpath[i].code != ART_END; i++)
- {
- switch (vpath[i].code)
- {
- case ART_MOVETO:
- printf ("%g %g moveto\n", vpath[i].x, vpath[i].y);
- break;
- case ART_LINETO:
- printf ("%g %g lineto\n", vpath[i].x, vpath[i].y);
- break;
- default:
- break;
- }
- }
- printf ("stroke grestore showpage\n");
-}
-
-#define DELT 4
-
-static void
-print_ps_svp (ArtSVP *vpath)
-{
- int i, j;
-
- printf ("%% begin\n");
- for (i = 0; i < vpath->n_segs; i++)
- {
- printf ("%g setgray\n", vpath->segs[i].dir ? 0.7 : 0);
- for (j = 0; j < vpath->segs[i].n_points; j++)
- {
- printf ("%g %g %s\n",
- XOFF + vpath->segs[i].points[j].x,
- YOFF - vpath->segs[i].points[j].y,
- j ? "lineto" : "moveto");
- }
- printf ("%g %g moveto %g %g lineto %g %g lineto %g %g lineto stroke\n",
- XOFF + vpath->segs[i].points[0].x - DELT,
- YOFF - DELT - vpath->segs[i].points[0].y,
- XOFF + vpath->segs[i].points[0].x - DELT,
- YOFF - vpath->segs[i].points[0].y,
- XOFF + vpath->segs[i].points[0].x + DELT,
- YOFF - vpath->segs[i].points[0].y,
- XOFF + vpath->segs[i].points[0].x + DELT,
- YOFF - DELT - vpath->segs[i].points[0].y);
- printf ("%g %g moveto %g %g lineto %g %g lineto %g %g lineto stroke\n",
- XOFF + vpath->segs[i].points[j - 1].x - DELT,
- YOFF + DELT - vpath->segs[i].points[j - 1].y,
- XOFF + vpath->segs[i].points[j - 1].x - DELT,
- YOFF - vpath->segs[i].points[j - 1].y,
- XOFF + vpath->segs[i].points[j - 1].x + DELT,
- YOFF - vpath->segs[i].points[j - 1].y,
- XOFF + vpath->segs[i].points[j - 1].x + DELT,
- YOFF + DELT - vpath->segs[i].points[j - 1].y);
- printf ("stroke\n");
- }
-
- printf ("showpage\n");
-}
-#endif
-
#ifndef ART_USE_NEW_INTERSECTOR
static ArtSVP *
art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2)
@@ -171,11 +98,6 @@ art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2)
art_free (vpath2_p);
svp_new = art_svp_merge (svp1_p, svp2_p);
-#ifdef VERBOSE
- print_ps_svp (svp1_p);
- print_ps_svp (svp2_p);
- print_ps_svp (svp_new);
-#endif
art_free (svp1_p);
art_free (svp2_p);
@@ -220,7 +142,7 @@ art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2)
ArtSVP *
art_svp_intersect (const ArtSVP *svp1, const ArtSVP *svp2)
{
-#ifdef ART_USE_NEW_INTERSECTOR
+#ifdef ART_USE_NEW_INTERSECTOR
ArtSVP *svp3, *svp_new;
ArtSvpWriter *swr;
diff --git a/libart_lgpl/art_svp_point.c b/libart_lgpl/art_svp_point.c
index 4b41e8c402..8278bca55e 100644
--- a/libart_lgpl/art_svp_point.c
+++ b/libart_lgpl/art_svp_point.c
@@ -38,11 +38,11 @@
*
* Return value: the winding number.
**/
-int
-art_svp_point_wind (ArtSVP *svp, double x, double y)
+gint
+art_svp_point_wind (ArtSVP *svp, gdouble x, gdouble y)
{
- int i, j;
- int wind = 0;
+ gint i, j;
+ gint wind = 0;
for (i = 0; i < svp->n_segs; i++)
{
@@ -57,7 +57,7 @@ art_svp_point_wind (ArtSVP *svp, double x, double y)
wind += seg->dir ? 1 : -1;
else if (seg->bbox.x0 <= x)
{
- double x0, y0, x1, y1, dx, dy;
+ gdouble x0, y0, x1, y1, dx, dy;
for (j = 0; j < seg->n_points - 1; j++)
{
@@ -91,42 +91,42 @@ art_svp_point_wind (ArtSVP *svp, double x, double y)
*
* Return value: the distance.
**/
-double
-art_svp_point_dist (ArtSVP *svp, double x, double y)
+gdouble
+art_svp_point_dist (ArtSVP *svp, gdouble x, gdouble y)
{
- int i, j;
- double dist_sq;
- double best_sq = -1;
+ gint i, j;
+ gdouble dist_sq;
+ gdouble best_sq = -1;
for (i = 0; i < svp->n_segs; i++)
{
ArtSVPSeg *seg = &svp->segs[i];
for (j = 0; j < seg->n_points - 1; j++)
{
- double x0 = seg->points[j].x;
- double y0 = seg->points[j].y;
- double x1 = seg->points[j + 1].x;
- double y1 = seg->points[j + 1].y;
+ gdouble x0 = seg->points[j].x;
+ gdouble y0 = seg->points[j].y;
+ gdouble x1 = seg->points[j + 1].x;
+ gdouble y1 = seg->points[j + 1].y;
- double dx = x1 - x0;
- double dy = y1 - y0;
+ gdouble dx = x1 - x0;
+ gdouble dy = y1 - y0;
- double dxx0 = x - x0;
- double dyy0 = y - y0;
+ gdouble dxx0 = x - x0;
+ gdouble dyy0 = y - y0;
- double dot = dxx0 * dx + dyy0 * dy;
+ gdouble dot = dxx0 * dx + dyy0 * dy;
if (dot < 0)
dist_sq = dxx0 * dxx0 + dyy0 * dyy0;
else
{
- double rr = dx * dx + dy * dy;
+ gdouble rr = dx * dx + dy * dy;
if (dot > rr)
dist_sq = (x - x1) * (x - x1) + (y - y1) * (y - y1);
else
{
- double perp = (y - y0) * dx - (x - x0) * dy;
+ gdouble perp = (y - y0) * dx - (x - x0) * dy;
dist_sq = perp * perp / rr;
}
diff --git a/libart_lgpl/art_svp_point.h b/libart_lgpl/art_svp_point.h
index c150d3e579..53faaba37e 100644
--- a/libart_lgpl/art_svp_point.h
+++ b/libart_lgpl/art_svp_point.h
@@ -28,11 +28,11 @@
extern "C" {
#endif /* __cplusplus */
-int
-art_svp_point_wind (ArtSVP *svp, double x, double y);
+gint
+art_svp_point_wind (ArtSVP *svp, gdouble x, gdouble y);
-double
-art_svp_point_dist (ArtSVP *svp, double x, double y);
+gdouble
+art_svp_point_dist (ArtSVP *svp, gdouble x, gdouble y);
#ifdef __cplusplus
}
@@ -40,6 +40,3 @@ art_svp_point_dist (ArtSVP *svp, double x, double y);
#endif /* __ART_SVP_H__ */
-
-
-
diff --git a/libart_lgpl/art_svp_render_aa.c b/libart_lgpl/art_svp_render_aa.c
index d696a51f68..e9ca3c9ba5 100644
--- a/libart_lgpl/art_svp_render_aa.c
+++ b/libart_lgpl/art_svp_render_aa.c
@@ -31,17 +31,17 @@
#include <stdio.h>
-typedef double artfloat;
+typedef gdouble artfloat;
struct _ArtSVPRenderAAIter {
const ArtSVP *svp;
- int x0, x1;
- int y;
- int seg_ix;
+ gint x0, x1;
+ gint y;
+ gint seg_ix;
- int *active_segs;
- int n_active_segs;
- int *cursor;
+ gint *active_segs;
+ gint n_active_segs;
+ gint *cursor;
artfloat *seg_x;
artfloat *seg_dx;
@@ -49,12 +49,12 @@ struct _ArtSVPRenderAAIter {
};
static void
-art_svp_render_insert_active (int i, int *active_segs, int n_active_segs,
+art_svp_render_insert_active (gint i, gint *active_segs, gint n_active_segs,
artfloat *seg_x, artfloat *seg_dx)
{
- int j;
+ gint j;
artfloat x;
- int tmp1, tmp2;
+ gint tmp1, tmp2;
/* this is a cheap hack to get ^'s sorted correctly */
x = seg_x[i] + 0.001 * seg_dx[i];
@@ -72,9 +72,9 @@ art_svp_render_insert_active (int i, int *active_segs, int n_active_segs,
}
static void
-art_svp_render_delete_active (int *active_segs, int j, int n_active_segs)
+art_svp_render_delete_active (gint *active_segs, gint j, gint n_active_segs)
{
- int k;
+ gint k;
for (k = j; k < n_active_segs; k++)
active_segs[k] = active_segs[k + 1];
@@ -129,7 +129,7 @@ art_svp_render_delete_active (int *active_segs, int j, int n_active_segs)
ArtSVPRenderAAIter *
art_svp_render_aa_iter (const ArtSVP *svp,
- int x0, int y0, int x1, int y1)
+ gint x0, gint y0, gint x1, gint y1)
{
ArtSVPRenderAAIter *iter = art_new (ArtSVPRenderAAIter, 1);
@@ -184,40 +184,40 @@ art_svp_render_aa_iter (const ArtSVP *svp,
}
void
-art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start,
- ArtSVPRenderAAStep **p_steps, int *p_n_steps)
+art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, gint *p_start,
+ ArtSVPRenderAAStep **p_steps, gint *p_n_steps)
{
const ArtSVP *svp = iter->svp;
- int *active_segs = iter->active_segs;
- int n_active_segs = iter->n_active_segs;
- int *cursor = iter->cursor;
+ gint *active_segs = iter->active_segs;
+ gint n_active_segs = iter->n_active_segs;
+ gint *cursor = iter->cursor;
artfloat *seg_x = iter->seg_x;
artfloat *seg_dx = iter->seg_dx;
- int i = iter->seg_ix;
- int j;
- int x0 = iter->x0;
- int x1 = iter->x1;
- int y = iter->y;
- int seg_index;
-
- int x;
+ gint i = iter->seg_ix;
+ gint j;
+ gint x0 = iter->x0;
+ gint x1 = iter->x1;
+ gint y = iter->y;
+ gint seg_index;
+
+ gint x;
ArtSVPRenderAAStep *steps = iter->steps;
- int n_steps;
+ gint n_steps;
artfloat y_top, y_bot;
artfloat x_top, x_bot;
artfloat x_min, x_max;
- int ix_min, ix_max;
- artfloat delta; /* delta should be int too? */
- int last, this;
- int xdelta;
+ gint ix_min, ix_max;
+ artfloat delta; /* delta should be gint too? */
+ gint last, this;
+ gint xdelta;
artfloat rslope, drslope;
- int start;
+ gint start;
const ArtSVPSeg *seg;
- int curs;
+ gint curs;
artfloat dy;
- int sx;
-
+ gint sx;
+
/* insert new active segments */
for (; i < svp->n_segs && svp->segs[i].bbox.y0 < y + 1; i++)
{
@@ -310,7 +310,7 @@ art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start,
if (ix_min >= x0)
{
ADD_STEP(ix_min, xdelta)
-
+
x = ix_min + 1;
}
else
@@ -339,7 +339,7 @@ art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start,
last = this;
ADD_STEP(x, xdelta)
-
+
if (x + 1 < x1)
{
xdelta = delta - last;
@@ -433,26 +433,25 @@ art_svp_render_aa_iter_done (ArtSVPRenderAAIter *iter)
* 0xff8000 represents 100% coverage. This format is designed so that
* >> 16 results in a standard 0x00..0xff value range, with nice
* rounding.
- *
+ *
**/
void
art_svp_render_aa (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
- void (*callback) (void *callback_data,
- int y,
- int start,
- ArtSVPRenderAAStep *steps, int n_steps),
- void *callback_data)
+ gint x0, gint y0, gint x1, gint y1,
+ void (*callback) (gpointer callback_data,
+ gint y,
+ gint start,
+ ArtSVPRenderAAStep *steps, gint n_steps),
+ gpointer callback_data)
{
ArtSVPRenderAAIter *iter;
- int y;
- int start;
+ gint y;
+ gint start;
ArtSVPRenderAAStep *steps;
- int n_steps;
+ gint n_steps;
iter = art_svp_render_aa_iter (svp, x0, y0, x1, y1);
-
for (y = y0; y < y1; y++)
{
art_svp_render_aa_iter_step (iter, &start, &steps, &n_steps);
diff --git a/libart_lgpl/art_svp_render_aa.h b/libart_lgpl/art_svp_render_aa.h
index c0c36874dc..5b5d7ace62 100644
--- a/libart_lgpl/art_svp_render_aa.h
+++ b/libart_lgpl/art_svp_render_aa.h
@@ -32,29 +32,29 @@ typedef struct _ArtSVPRenderAAStep ArtSVPRenderAAStep;
typedef struct _ArtSVPRenderAAIter ArtSVPRenderAAIter;
struct _ArtSVPRenderAAStep {
- int x;
- int delta; /* stored with 16 fractional bits */
+ gint x;
+ gint delta; /* stored with 16 fractional bits */
};
ArtSVPRenderAAIter *
art_svp_render_aa_iter (const ArtSVP *svp,
- int x0, int y0, int x1, int y1);
+ gint x0, gint y0, gint x1, gint y1);
void
-art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, int *p_start,
- ArtSVPRenderAAStep **p_steps, int *p_n_steps);
+art_svp_render_aa_iter_step (ArtSVPRenderAAIter *iter, gint *p_start,
+ ArtSVPRenderAAStep **p_steps, gint *p_n_steps);
void
art_svp_render_aa_iter_done (ArtSVPRenderAAIter *iter);
void
art_svp_render_aa (const ArtSVP *svp,
- int x0, int y0, int x1, int y1,
- void (*callback) (void *callback_data,
- int y,
- int start,
- ArtSVPRenderAAStep *steps, int n_steps),
- void *callback_data);
+ gint x0, gint y0, gint x1, gint y1,
+ void (*callback) (gpointer callback_data,
+ gint y,
+ gint start,
+ ArtSVPRenderAAStep *steps, gint n_steps),
+ gpointer callback_data);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_svp_vpath.c b/libart_lgpl/art_svp_vpath.c
index 196711a400..47b1931140 100644
--- a/libart_lgpl/art_svp_vpath.c
+++ b/libart_lgpl/art_svp_vpath.c
@@ -30,12 +30,11 @@
#include "art_vpath.h"
#include "art_svp.h"
-
/* reverse a list of points in place */
static void
-reverse_points (ArtPoint *points, int n_points)
+reverse_points (ArtPoint *points, gint n_points)
{
- int i;
+ gint i;
ArtPoint tmp_p;
for (i = 0; i < (n_points >> 1); i++)
@@ -66,15 +65,15 @@ reverse_points (ArtPoint *points, int n_points)
ArtSVP *
art_svp_from_vpath (ArtVpath *vpath)
{
- int n_segs, n_segs_max;
+ gint n_segs, n_segs_max;
ArtSVP *svp;
- int dir;
- int new_dir;
- int i;
+ gint dir;
+ gint new_dir;
+ gint i;
ArtPoint *points;
- int n_points, n_points_max;
- double x, y;
- double x_min, x_max;
+ gint n_points, n_points_max;
+ gdouble x, y;
+ gdouble x_min, x_max;
n_segs = 0;
n_segs_max = 16;
diff --git a/libart_lgpl/art_svp_vpath_stroke.c b/libart_lgpl/art_svp_vpath_stroke.c
index 8d532f9743..c231048103 100644
--- a/libart_lgpl/art_svp_vpath_stroke.c
+++ b/libart_lgpl/art_svp_vpath_stroke.c
@@ -17,7 +17,6 @@
* Boston, MA 02111-1307, USA.
*/
-
#include "config.h"
#include "art_svp_vpath_stroke.h"
@@ -48,18 +47,18 @@
curve to the right.
*/
static void
-art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max,
- double xc, double yc,
- double x0, double y0,
- double x1, double y1,
- double radius,
- double flatness)
+art_svp_vpath_stroke_arc (ArtVpath **p_vpath, gint *pn, gint *pn_max,
+ gdouble xc, gdouble yc,
+ gdouble x0, gdouble y0,
+ gdouble x1, gdouble y1,
+ gdouble radius,
+ gdouble flatness)
{
- double theta;
- double th_0, th_1;
- int n_pts;
- int i;
- double aradius;
+ gdouble theta;
+ gdouble th_0, th_1;
+ gint n_pts;
+ gint i;
+ gdouble aradius;
aradius = fabs (radius);
theta = 2 * M_SQRT2 * sqrt (flatness / aradius);
@@ -77,9 +76,6 @@ art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max,
if (th_1 < th_0) th_1 += M_PI * 2;
n_pts = ceil ((th_1 - th_0) / theta);
}
-#ifdef VERBOSE
- printf ("start %f %f; th_0 = %f, th_1 = %f, r = %f, theta = %f\n", x0, y0, th_0, th_1, radius, theta);
-#endif
art_vpath_add_point (p_vpath, pn, pn_max,
ART_LINETO, xc + x0, yc + y0);
for (i = 1; i < n_pts; i++)
@@ -88,15 +84,9 @@ art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max,
art_vpath_add_point (p_vpath, pn, pn_max,
ART_LINETO, xc + cos (theta) * aradius,
yc + sin (theta) * aradius);
-#ifdef VERBOSE
- printf ("mid %f %f\n", cos (theta) * radius, sin (theta) * radius);
-#endif
}
art_vpath_add_point (p_vpath, pn, pn_max,
ART_LINETO, xc + x1, yc + y1);
-#ifdef VERBOSE
- printf ("end %f %f\n", x1, y1);
-#endif
}
/* Assume that forw and rev are at point i0. Bring them to i1,
@@ -113,24 +103,20 @@ art_svp_vpath_stroke_arc (ArtVpath **p_vpath, int *pn, int *pn_max,
Precondition: no zero-length vectors, otherwise a divide by
zero will happen. */
static void
-render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max,
- ArtVpath **p_rev, int *pn_rev, int *pn_rev_max,
- ArtVpath *vpath, int i0, int i1, int i2,
+render_seg (ArtVpath **p_forw, gint *pn_forw, gint *pn_forw_max,
+ ArtVpath **p_rev, gint *pn_rev, gint *pn_rev_max,
+ ArtVpath *vpath, gint i0, gint i1, gint i2,
ArtPathStrokeJoinType join,
- double line_width, double miter_limit, double flatness)
+ gdouble line_width, gdouble miter_limit, gdouble flatness)
{
- double dx0, dy0;
- double dx1, dy1;
- double dlx0, dly0;
- double dlx1, dly1;
- double dmx, dmy;
- double dmr2;
- double scale;
- double cross;
-
-#ifdef VERBOSE
- printf ("join style = %d\n", join);
-#endif
+ gdouble dx0, dy0;
+ gdouble dx1, dy1;
+ gdouble dlx0, dly0;
+ gdouble dlx1, dly1;
+ gdouble dmx, dmy;
+ gdouble dmr2;
+ gdouble scale;
+ gdouble cross;
/* The vectors of the lines from i0 to i1 and i1 to i2. */
dx0 = vpath[i1].x - vpath[i0].x;
@@ -151,19 +137,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max,
dlx1 = dy1 * scale;
dly1 = -dx1 * scale;
-#ifdef VERBOSE
- printf ("%% render_seg: (%g, %g) - (%g, %g) - (%g, %g)\n",
- vpath[i0].x, vpath[i0].y,
- vpath[i1].x, vpath[i1].y,
- vpath[i2].x, vpath[i2].y);
-
- printf ("%% render_seg: d[xy]0 = (%g, %g), dl[xy]0 = (%g, %g)\n",
- dx0, dy0, dlx0, dly0);
-
- printf ("%% render_seg: d[xy]1 = (%g, %g), dl[xy]1 = (%g, %g)\n",
- dx1, dy1, dlx1, dly1);
-#endif
-
/* now, forw's last point is expected to be colinear along d[xy]0
to point i0 - dl[xy]0, and rev with i0 + dl[xy]0. */
@@ -193,9 +166,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max,
if (cross * cross < EPSILON_2 && dx0 * dx1 + dy0 * dy1 >= 0)
{
/* going straight */
-#ifdef VERBOSE
- printf ("%% render_seg: straight\n");
-#endif
art_vpath_add_point (p_forw, pn_forw, pn_forw_max,
ART_LINETO, vpath[i1].x - dlx0, vpath[i1].y - dly0);
art_vpath_add_point (p_rev, pn_rev, pn_rev_max,
@@ -205,9 +175,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max,
{
/* left turn, forw is outside and rev is inside */
-#ifdef VERBOSE
- printf ("%% render_seg: left\n");
-#endif
if (
#ifdef NO_OPTIMIZE_INNER
0 &&
@@ -265,9 +232,6 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max,
else
{
/* right turn, rev is outside and forw is inside */
-#ifdef VERBOSE
- printf ("%% render_seg: right\n");
-#endif
if (
#ifdef NO_OPTIMIZE_INNER
@@ -328,15 +292,15 @@ render_seg (ArtVpath **p_forw, int *pn_forw, int *pn_forw_max,
/* caps i1, under the assumption of a vector from i0 */
static void
-render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max,
- ArtVpath *vpath, int i0, int i1,
- ArtPathStrokeCapType cap, double line_width, double flatness)
+render_cap (ArtVpath **p_result, gint *pn_result, gint *pn_result_max,
+ ArtVpath *vpath, gint i0, gint i1,
+ ArtPathStrokeCapType cap, gdouble line_width, gdouble flatness)
{
- double dx0, dy0;
- double dlx0, dly0;
- double scale;
- int n_pts;
- int i;
+ gdouble dx0, dy0;
+ gdouble dlx0, dly0;
+ gdouble scale;
+ gint n_pts;
+ gint i;
dx0 = vpath[i1].x - vpath[i0].x;
dy0 = vpath[i1].y - vpath[i0].y;
@@ -347,10 +311,6 @@ render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max,
dlx0 = dy0 * scale;
dly0 = -dx0 * scale;
-#ifdef VERBOSE
- printf ("cap style = %d\n", cap);
-#endif
-
switch (cap)
{
case ART_PATH_STROKE_CAP_BUTT:
@@ -365,7 +325,7 @@ render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max,
ART_LINETO, vpath[i1].x - dlx0, vpath[i1].y - dly0);
for (i = 1; i < n_pts; i++)
{
- double theta, c_th, s_th;
+ gdouble theta, c_th, s_th;
theta = M_PI * i / n_pts;
c_th = cos (theta);
@@ -410,21 +370,21 @@ ArtVpath *
art_svp_vpath_stroke_raw (ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
- double line_width,
- double miter_limit,
- double flatness)
+ gdouble line_width,
+ gdouble miter_limit,
+ gdouble flatness)
{
- int begin_idx, end_idx;
- int i;
+ gint begin_idx, end_idx;
+ gint i;
ArtVpath *forw, *rev;
- int n_forw, n_rev;
- int n_forw_max, n_rev_max;
+ gint n_forw, n_rev;
+ gint n_forw_max, n_rev_max;
ArtVpath *result;
- int n_result, n_result_max;
- double half_lw = 0.5 * line_width;
- int closed;
- int last, this, next, second;
- double dx, dy;
+ gint n_result, n_result_max;
+ gdouble half_lw = 0.5 * line_width;
+ gint closed;
+ gint last, this, next, second;
+ gdouble dx, dy;
n_forw_max = 16;
forw = art_new (ArtVpath, n_forw_max);
@@ -487,7 +447,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath,
vpath[this].x == vpath[begin_idx].x &&
vpath[this].y == vpath[begin_idx].y)
{
- int j;
+ gint j;
/* path is closed, render join to beginning */
render_seg (&forw, &n_forw, &n_forw_max,
@@ -495,9 +455,6 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath,
vpath, last, this, second,
join, half_lw, miter_limit, flatness);
-#ifdef VERBOSE
- printf ("%% forw %d, rev %d\n", n_forw, n_rev);
-#endif
/* do forward path */
art_vpath_add_point (&result, &n_result, &n_result_max,
ART_MOVETO, forw[n_forw - 1].x,
@@ -519,7 +476,7 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath,
else
{
/* path is open */
- int j;
+ gint j;
/* add to forw rather than result to ensure that
forw has at least one point. */
@@ -556,65 +513,10 @@ art_svp_vpath_stroke_raw (ArtVpath *vpath,
art_free (forw);
art_free (rev);
-#ifdef VERBOSE
- printf ("%% n_result = %d\n", n_result);
-#endif
art_vpath_add_point (&result, &n_result, &n_result_max, ART_END, 0, 0);
return result;
}
-#define noVERBOSE
-
-#ifdef VERBOSE
-
-#define XOFF 50
-#define YOFF 700
-
-static void
-print_ps_vpath (ArtVpath *vpath)
-{
- int i;
-
- for (i = 0; vpath[i].code != ART_END; i++)
- {
- switch (vpath[i].code)
- {
- case ART_MOVETO:
- printf ("%g %g moveto\n", XOFF + vpath[i].x, YOFF - vpath[i].y);
- break;
- case ART_LINETO:
- printf ("%g %g lineto\n", XOFF + vpath[i].x, YOFF - vpath[i].y);
- break;
- default:
- break;
- }
- }
- printf ("stroke showpage\n");
-}
-
-static void
-print_ps_svp (ArtSVP *vpath)
-{
- int i, j;
-
- printf ("%% begin\n");
- for (i = 0; i < vpath->n_segs; i++)
- {
- printf ("%g setgray\n", vpath->segs[i].dir ? 0.7 : 0);
- for (j = 0; j < vpath->segs[i].n_points; j++)
- {
- printf ("%g %g %s\n",
- XOFF + vpath->segs[i].points[j].x,
- YOFF - vpath->segs[i].points[j].y,
- j ? "lineto" : "moveto");
- }
- printf ("stroke\n");
- }
-
- printf ("showpage\n");
-}
-#endif
-
/* Render a vector path into a stroked outline.
Status of this routine:
@@ -675,9 +577,9 @@ ArtSVP *
art_svp_vpath_stroke (ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
- double line_width,
- double miter_limit,
- double flatness)
+ gdouble line_width,
+ gdouble miter_limit,
+ gdouble flatness)
{
#ifdef ART_USE_NEW_INTERSECTOR
ArtVpath *vpath_stroke;
@@ -686,22 +588,13 @@ art_svp_vpath_stroke (ArtVpath *vpath,
vpath_stroke = art_svp_vpath_stroke_raw (vpath, join, cap,
line_width, miter_limit, flatness);
-#ifdef VERBOSE
- print_ps_vpath (vpath_stroke);
-#endif
svp = art_svp_from_vpath (vpath_stroke);
-#ifdef VERBOSE
- print_ps_svp (svp);
-#endif
art_free (vpath_stroke);
swr = art_svp_writer_rewind_new (ART_WIND_RULE_NONZERO);
art_svp_intersector (svp, swr);
svp2 = art_svp_writer_rewind_reap (swr);
-#ifdef VERBOSE
- print_ps_svp (svp2);
-#endif
art_svp_free (svp);
return svp2;
#else
@@ -710,28 +603,13 @@ art_svp_vpath_stroke (ArtVpath *vpath,
vpath_stroke = art_svp_vpath_stroke_raw (vpath, join, cap,
line_width, miter_limit, flatness);
-#ifdef VERBOSE
- print_ps_vpath (vpath_stroke);
-#endif
vpath2 = art_vpath_perturb (vpath_stroke);
-#ifdef VERBOSE
- print_ps_vpath (vpath2);
-#endif
art_free (vpath_stroke);
svp = art_svp_from_vpath (vpath2);
-#ifdef VERBOSE
- print_ps_svp (svp);
-#endif
art_free (vpath2);
svp2 = art_svp_uncross (svp);
-#ifdef VERBOSE
- print_ps_svp (svp2);
-#endif
art_svp_free (svp);
svp3 = art_svp_rewind_uncrossed (svp2, ART_WIND_RULE_NONZERO);
-#ifdef VERBOSE
- print_ps_svp (svp3);
-#endif
art_svp_free (svp2);
return svp3;
diff --git a/libart_lgpl/art_svp_vpath_stroke.h b/libart_lgpl/art_svp_vpath_stroke.h
index c189a5bb2b..f945d7cba9 100644
--- a/libart_lgpl/art_svp_vpath_stroke.h
+++ b/libart_lgpl/art_svp_vpath_stroke.h
@@ -45,18 +45,18 @@ ArtSVP *
art_svp_vpath_stroke (ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
- double line_width,
- double miter_limit,
- double flatness);
+ gdouble line_width,
+ gdouble miter_limit,
+ gdouble flatness);
/* This version may have winding numbers exceeding 1. */
ArtVpath *
art_svp_vpath_stroke_raw (ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
- double line_width,
- double miter_limit,
- double flatness);
+ gdouble line_width,
+ gdouble miter_limit,
+ gdouble flatness);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_uta.c b/libart_lgpl/art_uta.c
index 10bd6ee3bd..4396e2b6c6 100644
--- a/libart_lgpl/art_uta.c
+++ b/libart_lgpl/art_uta.c
@@ -36,7 +36,7 @@
* Returns: the newly allocated #ArtUta.
**/
ArtUta *
-art_uta_new (int x0, int y0, int x1, int y1)
+art_uta_new (gint x0, gint y0, gint x1, gint y1)
{
ArtUta *uta;
@@ -64,7 +64,7 @@ art_uta_new (int x0, int y0, int x1, int y1)
* Returns: the newly allocated #ArtUta.
**/
ArtUta *
-art_uta_new_coords (int x0, int y0, int x1, int y1)
+art_uta_new_coords (gint x0, gint y0, gint x1, gint y1)
{
return art_uta_new (x0 >> ART_UTILE_SHIFT, y0 >> ART_UTILE_SHIFT,
1 + (x1 >> ART_UTILE_SHIFT),
diff --git a/libart_lgpl/art_uta.h b/libart_lgpl/art_uta.h
index e0247c3fc9..3101949bb2 100644
--- a/libart_lgpl/art_uta.h
+++ b/libart_lgpl/art_uta.h
@@ -45,18 +45,18 @@ typedef struct _ArtUta ArtUta;
/* Coordinates are shifted right by ART_UTILE_SHIFT wrt the real
coordinates. */
struct _ArtUta {
- int x0;
- int y0;
- int width;
- int height;
+ gint x0;
+ gint y0;
+ gint width;
+ gint height;
ArtUtaBbox *utiles;
};
ArtUta *
-art_uta_new (int x0, int y0, int x1, int y1);
+art_uta_new (gint x0, gint y0, gint x1, gint y1);
ArtUta *
-art_uta_new_coords (int x0, int y0, int x1, int y1);
+art_uta_new_coords (gint x0, gint y0, gint x1, gint y1);
void
art_uta_free (ArtUta *uta);
diff --git a/libart_lgpl/art_uta_rect.c b/libart_lgpl/art_uta_rect.c
index 68a6053459..d92cf691b5 100644
--- a/libart_lgpl/art_uta_rect.c
+++ b/libart_lgpl/art_uta_rect.c
@@ -39,10 +39,10 @@ art_uta_from_irect (ArtIRect *bbox)
ArtUta *uta;
ArtUtaBbox *utiles;
ArtUtaBbox bb;
- int width, height;
- int x, y;
- int xf0, yf0, xf1, yf1;
- int ix;
+ gint width, height;
+ gint x, y;
+ gint xf0, yf0, xf1, yf1;
+ gint ix;
uta = art_new (ArtUta, 1);
uta->x0 = bbox->x0 >> ART_UTILE_SHIFT;
diff --git a/libart_lgpl/art_uta_vpath.c b/libart_lgpl/art_uta_vpath.c
index d7df5ede8b..9d5af1e844 100644
--- a/libart_lgpl/art_uta_vpath.c
+++ b/libart_lgpl/art_uta_vpath.c
@@ -55,18 +55,18 @@
* details.
**/
void
-art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
- int *rbuf, int rbuf_rowstride)
+art_uta_add_line (ArtUta *uta, gdouble x0, gdouble y0, gdouble x1, gdouble y1,
+ gint *rbuf, gint rbuf_rowstride)
{
- int xmin, ymin;
- double xmax, ymax;
- int xmaxf, ymaxf;
- int xmaxc, ymaxc;
- int xt0, yt0;
- int xt1, yt1;
- int xf0, yf0;
- int xf1, yf1;
- int ix, ix1;
+ gint xmin, ymin;
+ gdouble xmax, ymax;
+ gint xmaxf, ymaxf;
+ gint xmaxc, ymaxc;
+ gint xt0, yt0;
+ gint xt1, yt1;
+ gint xf0, yf0;
+ gint xf1, yf1;
+ gint ix, ix1;
ArtUtaBbox bb;
xmin = floor (MIN(x0, x1));
@@ -102,8 +102,8 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
}
else
{
- double dx, dy;
- int sx, sy;
+ gdouble dx, dy;
+ gint sx, sy;
dx = x1 - x0;
dy = y1 - y0;
@@ -146,9 +146,9 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
else
{
/* Do a Bresenham-style traversal of the line */
- double dx_dy;
- double x, y;
- double xn, yn;
+ gdouble dx_dy;
+ gdouble x, y;
+ gdouble xn, yn;
/* normalize coordinates to uta origin */
x0 -= uta->x0 << ART_UTILE_SHIFT;
@@ -157,7 +157,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
y1 -= uta->y0 << ART_UTILE_SHIFT;
if (dy < 0)
{
- double tmp;
+ gdouble tmp;
tmp = x0;
x0 = x1;
@@ -173,27 +173,21 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
/* we leave sy alone, because it would always be 1,
and we need it for the rbuf stuff. */
}
- xt0 = ((int)floor (x0) >> ART_UTILE_SHIFT);
- xt1 = ((int)floor (x1) >> ART_UTILE_SHIFT);
+ xt0 = ((gint)floor (x0) >> ART_UTILE_SHIFT);
+ xt1 = ((gint)floor (x1) >> ART_UTILE_SHIFT);
/* now [xy]0 is above [xy]1 */
ix = yt0 * uta->width + xt0;
ix1 = yt1 * uta->width + xt1;
-#ifdef VERBOSE
- printf ("%% ix = %d,%d; ix1 = %d,%d\n", xt0, yt0, xt1, yt1);
-#endif
dx_dy = dx / dy;
x = x0;
y = y0;
while (ix != ix1)
{
- int dix;
+ gint dix;
/* figure out whether next crossing is horizontal or vertical */
-#ifdef VERBOSE
- printf ("%% %d,%d\n", xt0, yt0);
-#endif
yn = (yt0 + 1) << ART_UTILE_SHIFT;
/* xn is the intercept with bottom edge of this tile. The
@@ -201,7 +195,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
x1 when yn = y1. */
xn = x1 + dx_dy * (yn - y1);
- if (xt0 != (int)floor (xn) >> ART_UTILE_SHIFT)
+ if (xt0 != (gint)floor (xn) >> ART_UTILE_SHIFT)
{
/* horizontal crossing */
xt0 += sx;
@@ -211,7 +205,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
xn = xt0 << ART_UTILE_SHIFT;
yn = y0 + (xn - x0) / dx_dy;
- xf0 = (int)floor (x) & (ART_UTILE_SIZE - 1);
+ xf0 = (gint)floor (x) & (ART_UTILE_SIZE - 1);
xf1 = ART_UTILE_SIZE;
}
else
@@ -220,20 +214,20 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
yn = y0 + (xn - x0) / dx_dy;
xf0 = 0;
- xmaxc = (int)ceil (x);
+ xmaxc = (gint)ceil (x);
xf1 = xmaxc - ((xt0 + 1) << ART_UTILE_SHIFT);
}
- ymaxf = (int)floor (yn);
- ymaxc = (int)ceil (yn);
+ ymaxf = (gint)floor (yn);
+ ymaxc = (gint)ceil (yn);
yf1 = (ymaxf & (ART_UTILE_SIZE - 1)) + ymaxc - ymaxf;
}
else
{
/* vertical crossing */
dix = uta->width;
- xf0 = (int)floor (MIN(x, xn)) & (ART_UTILE_SIZE - 1);
+ xf0 = (gint)floor (MIN(x, xn)) & (ART_UTILE_SIZE - 1);
xmax = MAX(x, xn);
- xmaxc = (int)ceil (xmax);
+ xmaxc = (gint)ceil (xmax);
xf1 = xmaxc - (xt0 << ART_UTILE_SHIFT);
yf1 = ART_UTILE_SIZE;
@@ -242,7 +236,7 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
yt0++;
}
- yf0 = (int)floor (y) & (ART_UTILE_SIZE - 1);
+ yf0 = (gint)floor (y) & (ART_UTILE_SIZE - 1);
bb = uta->utiles[ix];
if (bb == 0)
bb = ART_UTA_BBOX_CONS(xf0, yf0, xf1, yf1);
@@ -260,8 +254,8 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
xmax = MAX(x, x1);
xmaxc = ceil (xmax);
ymaxc = ceil (y1);
- xf0 = (int)floor (MIN(x1, x)) & (ART_UTILE_SIZE - 1);
- yf0 = (int)floor (y) & (ART_UTILE_SIZE - 1);
+ xf0 = (gint)floor (MIN(x1, x)) & (ART_UTILE_SIZE - 1);
+ yf0 = (gint)floor (y) & (ART_UTILE_SIZE - 1);
xf1 = xmaxc - (xt0 << ART_UTILE_SHIFT);
yf1 = ymaxc - (yt0 << ART_UTILE_SHIFT);
bb = uta->utiles[ix];
@@ -291,16 +285,16 @@ art_uta_from_vpath (const ArtVpath *vec)
{
ArtUta *uta;
ArtIRect bbox;
- int *rbuf;
- int i;
- double x, y;
- int sum;
- int xt, yt;
+ gint *rbuf;
+ gint i;
+ gdouble x, y;
+ gint sum;
+ gint xt, yt;
ArtUtaBbox *utiles;
ArtUtaBbox bb;
- int width;
- int height;
- int ix;
+ gint width;
+ gint height;
+ gint ix;
art_vpath_bbox_irect (vec, &bbox);
diff --git a/libart_lgpl/art_uta_vpath.h b/libart_lgpl/art_uta_vpath.h
index 5a55876018..3f50e3a746 100644
--- a/libart_lgpl/art_uta_vpath.h
+++ b/libart_lgpl/art_uta_vpath.h
@@ -34,8 +34,8 @@ art_uta_from_vpath (const ArtVpath *vec);
/* This is a private function: */
void
-art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
- int *rbuf, int rbuf_rowstride);
+art_uta_add_line (ArtUta *uta, gdouble x0, gdouble y0, gdouble x1, gdouble y1,
+ gint *rbuf, gint rbuf_rowstride);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_vpath.c b/libart_lgpl/art_vpath.c
index bfdb9acca5..395917915b 100644
--- a/libart_lgpl/art_vpath.c
+++ b/libart_lgpl/art_vpath.c
@@ -46,10 +46,10 @@
* desired.
**/
void
-art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max,
- ArtPathcode code, double x, double y)
+art_vpath_add_point (ArtVpath **p_vpath, gint *pn_points, gint *pn_points_max,
+ ArtPathcode code, gdouble x, gdouble y)
{
- int i;
+ gint i;
i = (*pn_points)++;
if (i == *pn_points_max)
@@ -69,8 +69,8 @@ art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max,
void
art_vpath_bbox_drect (const ArtVpath *vec, ArtDRect *drect)
{
- int i;
- double x0, y0, x1, y1;
+ gint i;
+ gdouble x0, y0, x1, y1;
if (vec[0].code == ART_END)
{
diff --git a/libart_lgpl/art_vpath.h b/libart_lgpl/art_vpath.h
index f5557f6005..7dadd2865d 100644
--- a/libart_lgpl/art_vpath.h
+++ b/libart_lgpl/art_vpath.h
@@ -34,15 +34,15 @@ typedef struct _ArtVpath ArtVpath;
/* CURVETO is not allowed! */
struct _ArtVpath {
ArtPathcode code;
- double x;
- double y;
+ gdouble x;
+ gdouble y;
};
/* Some of the functions need to go into their own modules */
void
-art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max,
- ArtPathcode code, double x, double y);
+art_vpath_add_point (ArtVpath **p_vpath, gint *pn_points, gint *pn_points_max,
+ ArtPathcode code, gdouble x, gdouble y);
void
art_vpath_bbox_drect (const ArtVpath *vec, ArtDRect *drect);
diff --git a/libart_lgpl/art_vpath_bpath.c b/libart_lgpl/art_vpath_bpath.c
index 3f9afe7229..a748dfbec5 100644
--- a/libart_lgpl/art_vpath_bpath.c
+++ b/libart_lgpl/art_vpath_bpath.c
@@ -33,19 +33,15 @@
/* level must be >= 1 */
ArtPoint *
-art_bezier_to_vec (double x0, double y0,
- double x1, double y1,
- double x2, double y2,
- double x3, double y3,
+art_bezier_to_vec (gdouble x0, gdouble y0,
+ gdouble x1, gdouble y1,
+ gdouble x2, gdouble y2,
+ gdouble x3, gdouble y3,
ArtPoint *p,
- int level)
+ gint level)
{
- double x_m, y_m;
+ gdouble x_m, y_m;
-#ifdef VERBOSE
- printf ("bezier_to_vec: %g,%g %g,%g %g,%g %g,%g %d\n",
- x0, y0, x1, y1, x2, y2, x3, y3, level);
-#endif
if (level == 1) {
x_m = (x0 + 3 * (x1 + x2) + x3) * 0.125;
y_m = (y0 + 3 * (y1 + y2) + y3) * 0.125;
@@ -55,14 +51,11 @@ art_bezier_to_vec (double x0, double y0,
p->x = x3;
p->y = y3;
p++;
-#ifdef VERBOSE
- printf ("-> (%g, %g) -> (%g, %g)\n", x_m, y_m, x3, y3);
-#endif
} else {
- double xa1, ya1;
- double xa2, ya2;
- double xb1, yb1;
- double xb2, yb2;
+ gdouble xa1, ya1;
+ gdouble xa2, ya2;
+ gdouble xb1, yb1;
+ gdouble xb2, yb2;
xa1 = (x0 + x1) * 0.5;
ya1 = (y0 + y1) * 0.5;
@@ -74,10 +67,6 @@ art_bezier_to_vec (double x0, double y0,
yb2 = (y2 + y3) * 0.5;
x_m = (xa2 + xb1) * 0.5;
y_m = (ya2 + yb1) * 0.5;
-#ifdef VERBOSE
- printf ("%g,%g %g,%g %g,%g %g,%g\n", xa1, ya1, xa2, ya2,
- xb1, yb1, xb2, yb2);
-#endif
p = art_bezier_to_vec (x0, y0, xa1, ya1, xa2, ya2, x_m, y_m, p, level - 1);
p = art_bezier_to_vec (x_m, y_m, xb1, yb1, xb2, yb2, x3, y3, p, level - 1);
}
@@ -88,7 +77,7 @@ art_bezier_to_vec (double x0, double y0,
#define RENDER_SIZE (1 << (RENDER_LEVEL))
/**
- * art_vpath_render_bez: Render a bezier segment into the vpath.
+ * art_vpath_render_bez: Render a bezier segment into the vpath.
* @p_vpath: Where the pointer to the #ArtVpath structure is stored.
* @pn_points: Pointer to the number of points in *@p_vpath.
* @pn_points_max: Pointer to the number of points allocated.
@@ -116,24 +105,24 @@ art_bezier_to_vec (double x0, double y0,
* rendering.
**/
static void
-art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max,
- double x0, double y0,
- double x1, double y1,
- double x2, double y2,
- double x3, double y3,
- double flatness)
+art_vpath_render_bez (ArtVpath **p_vpath, gint *pn, gint *pn_max,
+ gdouble x0, gdouble y0,
+ gdouble x1, gdouble y1,
+ gdouble x2, gdouble y2,
+ gdouble x3, gdouble y3,
+ gdouble flatness)
{
- double x3_0, y3_0;
- double z3_0_dot;
- double z1_dot, z2_dot;
- double z1_perp, z2_perp;
- double max_perp_sq;
-
- double x_m, y_m;
- double xa1, ya1;
- double xa2, ya2;
- double xb1, yb1;
- double xb2, yb2;
+ gdouble x3_0, y3_0;
+ gdouble z3_0_dot;
+ gdouble z1_dot, z2_dot;
+ gdouble z1_perp, z2_perp;
+ gdouble max_perp_sq;
+
+ gdouble x_m, y_m;
+ gdouble xa1, ya1;
+ gdouble xa2, ya2;
+ gdouble xb1, yb1;
+ gdouble xb2, yb2;
/* It's possible to optimize this routine a fair amount.
@@ -213,7 +202,6 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max,
if (z2_dot + z2_dot > z3_0_dot)
goto subdivide;
-
nosubdivide:
/* don't subdivide */
art_vpath_add_point (p_vpath, pn, pn_max,
@@ -232,10 +220,6 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max,
yb2 = (y2 + y3) * 0.5;
x_m = (xa2 + xb1) * 0.5;
y_m = (ya2 + yb1) * 0.5;
-#ifdef VERBOSE
- printf ("%g,%g %g,%g %g,%g %g,%g\n", xa1, ya1, xa2, ya2,
- xb1, yb1, xb2, yb2);
-#endif
art_vpath_render_bez (p_vpath, pn, pn_max,
x0, y0, xa1, ya1, xa2, ya2, x_m, y_m, flatness);
art_vpath_render_bez (p_vpath, pn, pn_max,
@@ -255,12 +239,12 @@ art_vpath_render_bez (ArtVpath **p_vpath, int *pn, int *pn_max,
* Return value: Newly allocated vpath.
**/
ArtVpath *
-art_bez_path_to_vec (const ArtBpath *bez, double flatness)
+art_bez_path_to_vec (const ArtBpath *bez, gdouble flatness)
{
ArtVpath *vec;
- int vec_n, vec_n_max;
- int bez_index;
- double x, y;
+ gint vec_n, vec_n_max;
+ gint bez_index;
+ gdouble x, y;
vec_n = 0;
vec_n_max = RENDER_SIZE;
@@ -275,14 +259,6 @@ art_bez_path_to_vec (const ArtBpath *bez, double flatness)
bez_index = 0;
do
{
-#ifdef VERBOSE
- printf ("%s %g %g\n",
- bez[bez_index].code == ART_CURVETO ? "curveto" :
- bez[bez_index].code == ART_LINETO ? "lineto" :
- bez[bez_index].code == ART_MOVETO ? "moveto" :
- bez[bez_index].code == ART_MOVETO_OPEN ? "moveto-open" :
- "end", bez[bez_index].x3, bez[bez_index].y3);
-#endif
/* make sure space for at least one more code */
if (vec_n >= vec_n_max)
art_expand (vec, ArtVpath, vec_n_max);
@@ -305,12 +281,6 @@ art_bez_path_to_vec (const ArtBpath *bez, double flatness)
vec_n++;
break;
case ART_CURVETO:
-#ifdef VERBOSE
- printf ("%g,%g %g,%g %g,%g %g,%g\n", x, y,
- bez[bez_index].x1, bez[bez_index].y1,
- bez[bez_index].x2, bez[bez_index].y2,
- bez[bez_index].x3, bez[bez_index].y3);
-#endif
art_vpath_render_bez (&vec, &vec_n, &vec_n_max,
x, y,
bez[bez_index].x1, bez[bez_index].y1,
diff --git a/libart_lgpl/art_vpath_bpath.h b/libart_lgpl/art_vpath_bpath.h
index b5ca7c1939..5115ee58cf 100644
--- a/libart_lgpl/art_vpath_bpath.h
+++ b/libart_lgpl/art_vpath_bpath.h
@@ -27,14 +27,14 @@
extern "C" {
#endif /* __cplusplus */
-ArtPoint *art_bezier_to_vec (double x0, double y0,
- double x1, double y1,
- double x2, double y2,
- double x3, double y3,
+ArtPoint *art_bezier_to_vec (gdouble x0, gdouble y0,
+ gdouble x1, gdouble y1,
+ gdouble x2, gdouble y2,
+ gdouble x3, gdouble y3,
ArtPoint *p,
- int level);
+ gint level);
-ArtVpath *art_bez_path_to_vec (const ArtBpath *bez, double flatness);
+ArtVpath *art_bez_path_to_vec (const ArtBpath *bez, gdouble flatness);
#ifdef __cplusplus
}
diff --git a/libart_lgpl/art_vpath_dash.c b/libart_lgpl/art_vpath_dash.c
index 3c98a96d9f..2c54aca4a6 100644
--- a/libart_lgpl/art_vpath_dash.c
+++ b/libart_lgpl/art_vpath_dash.c
@@ -29,14 +29,13 @@
#include "art_vpath.h"
-
/* Return the length of the largest subpath within vpath */
-static int
+static gint
art_vpath_dash_max_subpath (const ArtVpath *vpath)
{
- int max_subpath;
- int i;
- int start;
+ gint max_subpath;
+ gint i;
+ gint start;
max_subpath = 0;
start = 0;
@@ -79,23 +78,23 @@ art_vpath_dash_max_subpath (const ArtVpath *vpath)
ArtVpath *
art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash)
{
- int max_subpath;
- double *dists;
+ gint max_subpath;
+ gdouble *dists;
ArtVpath *result;
- int n_result, n_result_max;
- int start, end;
- int i;
- double total_dist;
+ gint n_result, n_result_max;
+ gint start, end;
+ gint i;
+ gdouble total_dist;
/* state while traversing dasharray - offset is offset of current dash
value, toggle is 0 for "off" and 1 for "on", and phase is the distance
in, >= 0, < dash->dash[offset]. */
- int offset, toggle;
- double phase;
+ gint offset, toggle;
+ gdouble phase;
/* initial values */
- int offset_init, toggle_init;
- double phase_init;
+ gint offset_init, toggle_init;
+ gdouble phase_init;
max_subpath = art_vpath_dash_max_subpath (vpath);
dists = art_new (double, max_subpath);
@@ -124,7 +123,7 @@ art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash)
total_dist = 0;
for (i = start; i < end - 1; i++)
{
- double dx, dy;
+ gdouble dx, dy;
dx = vpath[i + 1].x - vpath[i].x;
dy = vpath[i + 1].y - vpath[i].y;
@@ -145,7 +144,7 @@ art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash)
{
/* subpath is composed of at least one dash - thus all
generated pieces are open */
- double dist;
+ gdouble dist;
phase = phase_init;
offset = offset_init;
@@ -160,8 +159,8 @@ art_vpath_dash (const ArtVpath *vpath, const ArtVpathDash *dash)
if (dists[i - start] - dist > dash->dash[offset] - phase)
{
/* dash boundary is next */
- double a;
- double x, y;
+ gdouble a;
+ gdouble x, y;
dist += dash->dash[offset] - phase;
a = dist / dists[i - start];
diff --git a/libart_lgpl/art_vpath_dash.h b/libart_lgpl/art_vpath_dash.h
index 1ee7b33349..93ecea5e32 100644
--- a/libart_lgpl/art_vpath_dash.h
+++ b/libart_lgpl/art_vpath_dash.h
@@ -31,9 +31,9 @@ extern "C" {
typedef struct _ArtVpathDash ArtVpathDash;
struct _ArtVpathDash {
- double offset;
- int n_dash;
- double *dash;
+ gdouble offset;
+ gint n_dash;
+ gdouble *dash;
};
ArtVpath *
diff --git a/libart_lgpl/art_vpath_svp.c b/libart_lgpl/art_vpath_svp.c
index 000265c376..ceeea0ac4b 100644
--- a/libart_lgpl/art_vpath_svp.c
+++ b/libart_lgpl/art_vpath_svp.c
@@ -31,15 +31,15 @@
typedef struct _ArtVpathSVPEnd ArtVpathSVPEnd;
struct _ArtVpathSVPEnd {
- int seg_num;
- int which; /* 0 = top, 1 = bottom */
- double x, y;
+ gint seg_num;
+ gint which; /* 0 = top, 1 = bottom */
+ gdouble x, y;
};
#define EPSILON 1e-6
-static int
-art_vpath_svp_point_compare (double x1, double y1, double x2, double y2)
+static gint
+art_vpath_svp_point_compare (gdouble x1, gdouble y1, gdouble x2, gdouble y2)
{
if (y1 - EPSILON > y2) return 1;
if (y1 + EPSILON < y2) return -1;
@@ -48,8 +48,8 @@ art_vpath_svp_point_compare (double x1, double y1, double x2, double y2)
return 0;
}
-static int
-art_vpath_svp_compare (const void *s1, const void *s2)
+static gint
+art_vpath_svp_compare (gconstpointer s1, gconstpointer s2)
{
const ArtVpathSVPEnd *e1 = s1;
const ArtVpathSVPEnd *e2 = s2;
@@ -83,18 +83,18 @@ art_vpath_svp_compare (const void *s1, const void *s2)
ArtVpath *
art_vpath_from_svp (const ArtSVP *svp)
{
- int n_segs = svp->n_segs;
+ gint n_segs = svp->n_segs;
ArtVpathSVPEnd *ends;
ArtVpath *new;
- int *visited;
- int n_new, n_new_max;
- int i, k;
- int j = 0; /* Quiet compiler */
- int seg_num;
- int first;
- double last_x, last_y;
- int n_points;
- int pt_num;
+ gint *visited;
+ gint n_new, n_new_max;
+ gint i, k;
+ gint j = 0; /* Quiet compiler */
+ gint seg_num;
+ gint first;
+ gdouble last_x, last_y;
+ gint n_points;
+ gint pt_num;
last_x = 0; /* to eliminate "uninitialized" warning */
last_y = 0;
@@ -102,7 +102,7 @@ art_vpath_from_svp (const ArtSVP *svp)
ends = art_new (ArtVpathSVPEnd, n_segs * 2);
for (i = 0; i < svp->n_segs; i++)
{
- int lastpt;
+ gint lastpt;
ends[i * 2].seg_num = i;
ends[i * 2].which = 0;