[cairo] towards 24.8
behdad at behdad.org
Mon Jun 18 16:23:14 PDT 2007
On Mon, 2007-06-18 at 13:27 -0700, Vladimir Vukicevic wrote:
> So I've got this working! The current work in progress is in the
> fixed-24-8 branch in my tree
> (git://git.cairographics.org/~vladimir/cairo I believe). Cairo can use
> any fixed point format, and it'll correctly convert to 16.16 for talking
> to pixman/xlib/xcb/etc, but svg, pdf, and other surfaces get the full
> precision. It should be possible to easily convert to using a 64-bit
> fixed point type, or even using doubles throughout, though it's more
> work than just increasing/decreasing the number of fractional bits.
> There are still some things I need to clean up, and I'll probably end up
> redoing a number of the commits to incorporate fixes for issues that I
> discovered in future patches to make it easier to review. There are a
> lot of changes, so I expect review to be a bit painful, but essentially
> the separate chunks are:
> - Make fixed point methods static inline and don't hardcode 16.16
-#define CAIRO_MAGIC_NUMBER_FIXED_16_16 (103079215104.0)
+#define CAIRO_MAGIC_NUMER_FIXED_16_16 (103079215104.0)
+#if (CAIRO_FIXED_BITS == 32) && (CAIRO_FIXED_FRAC_BITS == 16)
+# define CAIRO_MAGIC_NUMBER_FIXED CAIRO_MAGIC_NUMER_FIXED_16_16
+# error Please define a magic number for your fixed point type!
+# error See cairo-fixed-private.h for details.
Read the comment preceding this block. You can use
#if (CAIRO_FIXED_BITS <= 32)
#define CAIRO_MAGIC_NUMBER_FIXED ((DBL_MANT_DIG - CAIRO_FXIED_FRAC_BITS) * 1.5)
# error Please define a magic number for your fixed point type!
# error See cairo-fixed-private.h for details.
> - [misc] Remove usage of cairo_fixed_16_16_t from quartz surface (should
> be cairo_fixed_t)
> - Use _cairo_fixed_mul() instead of hand-written fixed-point multiplication
> - Convert all usage of cairo_rectangle_int16_t to cairo_rectangle_int_t,
> which is typedef'd based on how many bits of precision are present in
> the fixed type (this could also always just be 32-bit, but I wanted to
> be able to keep things how they are for 16.16)
Some noise in there:
- cairo_rectangle_int16_t *image_rect)
+ cairo_rectangle_int_t *image_rect)
int bpp, bytes_per_line;
- int x1, y1, x2, y2;
+ short x1, y1, x2, y2;
unsigned char *data;
And the change is probably wrong too.
There may be other places. Generally, it's best to keep renaming
commits to just renames, so the reviewer doesn't have to laboriously
check the huge commit.
> - Remove dependencies on pixman_color_stop_t, pixman_gradient_t, and
> friends -- introduce cairo_gradient_stop_t; add code to convert from
> cairo_gradient_stop_t etc. to pixman equivalents in cairo-pattern.c
> - Fix up image surface to translate cairo_fixed_t to 16.16
> - Fix up xlib surface to translate cairo_fixed_t to 16.16
> - Fix up xcb surface to translate cairo_fixed_t to 16.16
> - create cairo_region_t and replace all usage of pixman_region16_t usage
> with it (initially, it just wraps pixman_region16_t)
> I've confirmed that I can switch fixed point types trivially and get
> correct results from PS, SVG, etc. surfaces that don't rely on pixman.
> Two #defines and you can get 24.8, 26.6, etc..
Looks good, other than the fact that commits need cleaning up.
Also, should we use the same fixed type for cairo_color_t too?
> - Vlad
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo