[cairo-commit]
cairo/src cairo_matrix.c, 1.13, 1.14 cairo_wideint.c,
1.2, 1.3 cairo_wideint.h, 1.4, 1.5
Keith Packard
commit at pdx.freedesktop.org
Tue Jan 11 14:52:19 PST 2005
Committed by: keithp
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv31142/src
Modified Files:
cairo_matrix.c cairo_wideint.c cairo_wideint.h
Log Message:
2005-01-11 Keith Packard <keithp at keithp.com>
* src/cairo_matrix.c: (_cairo_matrix_compute_scale_factors):
Scale factors shouldn't include mirroring.
* src/cairo_wideint.c: (_cairo_int32x32_64_mul),
(_cairo_int64x64_128_mul):
* src/cairo_wideint.h:
int32x32_64_mul and int64x64_128_mul are different from their
unsigned compatriots
Index: cairo_matrix.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_matrix.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cairo_matrix.c 11 Jan 2005 18:03:01 -0000 1.13
+++ cairo_matrix.c 11 Jan 2005 22:52:16 -0000 1.14
@@ -423,6 +423,11 @@
cairo_matrix_transform_distance (matrix, &x, &y);
major = sqrt(x*x + y*y);
+ /*
+ * ignore mirroring
+ */
+ if (det < 0)
+ det = -det;
if (major)
minor = det / major;
else
Index: cairo_wideint.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_wideint.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo_wideint.c 11 Jan 2005 18:03:01 -0000 1.2
+++ cairo_wideint.c 11 Jan 2005 22:52:16 -0000 1.3
@@ -154,6 +154,17 @@
return s;
}
+const cairo_int64_t
+_cairo_int32x32_64_mul (int32_t a, int32_t b)
+{
+ s = _cairo_uint32x32_64_mul ((uint32_t) a, (uint32_t b));
+ if (a < 0)
+ s.hi -= b;
+ if (b < 0)
+ s.hi -= a;
+ return s;
+}
+
const cairo_uint64_t
_cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b)
{
@@ -634,6 +645,21 @@
return s;
}
+const cairo_int128_t
+_cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b)
+{
+ cairo_int128_t s;
+ s = _cairo_uint64x64_128_mul (_cairo_int64_to_uint64(a),
+ _cairo_int64_to_uint64(b));
+ if (_cairo_int64_negative (a))
+ s.hi = _cairo_uint64_sub (s.hi,
+ _cairo_int64_to_uint64 (b));
+ if (_cairo_int64_negative (b))
+ s.hi = _cairo_uint64_sub (s.hi,
+ _cairo_int64_to_uint64 (a));
+ return s;
+}
+
const cairo_uint128_t
_cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b)
{
Index: cairo_wideint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_wideint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo_wideint.h 11 Jan 2005 18:03:01 -0000 1.4
+++ cairo_wideint.h 11 Jan 2005 22:52:17 -0000 1.5
@@ -77,8 +77,7 @@
#define _cairo_int64_add(a,b) _cairo_uint64_add (a,b)
#define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b)
#define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b)
-/* XXX this is wrong */
-#define _cairo_int32x32_64_mul(a,b) _cairo_uint32x32_64_mul ((uint32_t) (a), (uint32_t) (b)))
+const int I _cairo_int32x32_64_mul (int32_t a, int32_t b);
const int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b);
#define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b)
#define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b)
@@ -196,13 +195,12 @@
const cairo_int128_t I _cairo_int32_to_int128 (int32_t i);
const cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i);
-#define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo);
+#define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo)
#define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a))
#define _cairo_int128_add(a,b) _cairo_uint128_add(a,b)
#define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b)
#define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b)
-/* XXX this is wrong */
-#define _cairo_int64x64_128_mul(a,b) _cairo_uint64x64_128_mul ((cairo_uint64_t) (a), (cairo_uint64_t) (b))
+const cairo_uint128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b);
#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b)
#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b)
#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b)
More information about the cairo-commit
mailing list