[cairo] Some other bits...
Keith Packard
keithp at keithp.com
Tue Aug 16 22:13:13 PDT 2005
On Wed, 2005-08-17 at 00:24 -0400, Behdad Esfahbod wrote:
> cairo_fixed_t
> _cairo_fixed_from_26_6 (uint32_t i)
> {
> - return i << 10;
> + return i << (CAIRO_FIXED_FLOAT_BITS - 10);
This should be - 6, not - 10, I think.
> - factor -= factor & 0xffff0000;
> + factor &= 0xffff;
> break;
> case CAIRO_EXTEND_REFLECT:
> if (factor < 0 || factor > 65536) {
> if ((factor >> 16) % 2)
> - factor = 65536 - (factor - (factor & 0xffff0000));
> + factor = 65536 - (factor & 0xffff);
> else
> - factor -= factor & 0xffff0000;
> + factor &= 0xffff;
> }
Aren't all of these supposed to scale with CAIRO_FIXED_FLOAT_BITS?
- cairo_fixed_48_16_t a_dx = a->edge.p2.x - a->edge.p1.x;
- cairo_fixed_48_16_t a_dy = a->edge.p2.y - a->edge.p1.y;
- cairo_fixed_48_16_t b_dx = b->edge.p2.x - b->edge.p1.x;
- cairo_fixed_48_16_t b_dy = b->edge.p2.y - b->edge.p1.y;
+ cairo_fixed_48_16_t a_dx = (cairo_fixed_48_16_t) a->edge.p2.x -
a->edge.p1.x;
+ cairo_fixed_48_16_t a_dy = (cairo_fixed_48_16_t) a->edge.p2.y -
a->edge.p1.y;
+ cairo_fixed_48_16_t b_dx = (cairo_fixed_48_16_t) b->edge.p2.x -
b->edge.p1.x;
+ cairo_fixed_48_16_t b_dy = (cairo_fixed_48_16_t) b->edge.p2.y -
b->edge.p1.y;
Why do you believe these need to be done in 64 bits? Are you concerned
that the subtract might overflow?
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050816/298577bd/attachment.pgp
More information about the cairo
mailing list