? transform.diff ? src/cairo-surface.diff ? src/cairo-transform-surface.c ? src/cairo-transform.h ? test/transform-surface.c Index: configure.in =================================================================== RCS file: /cvs/cairo/cairo/configure.in,v retrieving revision 1.162 diff -u -3 -p -b -B -d -r1.162 configure.in --- configure.in 13 Jan 2006 00:35:12 -0000 1.162 +++ configure.in 30 Jan 2006 07:49:32 -0000 @@ -460,6 +460,23 @@ AM_CONDITIONAL(HAVE_PTHREAD, test "x$hav dnl =========================================================================== +AC_ARG_ENABLE(transform, + [ --disable-transform Disable cairo's Transform backend], + [use_transform=$enableval], [use_transform=yes]) + +AM_CONDITIONAL(CAIRO_HAS_TRANSFORM_SURFACE, test "x$use_transform" = "xyes") +if test "x$use_transform" = "xyes"; then + TRANSFORM_SURFACE_FEATURE="#define CAIRO_HAS_TRANSFORM_SURFACE 1" + TRANSFORM_LIBS= +fi +AC_SUBST(TRANSFORM_SURFACE_FEATURE) + +CAIRO_LIBS="$CAIRO_LIBS $TRANSFORM_LIBS" + +AC_SUBST(TRANSFORM_LIBS) + +dnl =========================================================================== + AC_ARG_ENABLE(ps, [ --disable-ps Disable cairo's PostScript backend], [use_ps=$enableval], [use_ps=yes]) @@ -753,6 +770,7 @@ echo " Win32: $use_win32" echo " PostScript: $use_ps" echo " PDF: $use_pdf" echo " SVG: $use_svg" +echo " Transform: $use_transform" echo " glitz: $use_glitz" echo " BeOS: $use_beos" echo " DirectFB: $use_directfb" Index: src/Makefile.am =================================================================== RCS file: /cvs/cairo/cairo/src/Makefile.am,v retrieving revision 1.76 diff -u -3 -p -b -B -d -r1.76 Makefile.am --- src/Makefile.am 10 Jan 2006 13:29:00 -0000 1.76 +++ src/Makefile.am 30 Jan 2006 07:49:32 -0000 @@ -1,3 +1,7 @@ +if CAIRO_HAS_TRANSFORM_SURFACE +libcairo_transform_headers = cairo-transform.h +libcairo_transform_sources = cairo-transform-surface.c +endif if CAIRO_HAS_PS_SURFACE libcairo_ps_headers = cairo-ps.h @@ -113,6 +117,7 @@ cairoinclude_HEADERS = \ $(libcairo_pdf_headers) \ $(libcairo_svg_headers) \ $(libcairo_ps_headers) \ + $(libcairo_transform_headers) \ $(libcairo_quartz_headers) \ $(libcairo_win32_headers) \ $(libcairo_beos_headers) \ @@ -176,6 +181,7 @@ libcairo_la_SOURCES = \ $(libcairo_atsui_sources) \ $(libcairo_ft_sources) \ $(libcairo_ps_sources) \ + $(libcairo_transform_sources) \ $(libcairo_pdf_sources) \ $(libcairo_png_sources) \ $(libcairo_svg_sources) \ Index: src/cairo-features.h.in =================================================================== RCS file: /cvs/cairo/cairo/src/cairo-features.h.in,v retrieving revision 1.25 diff -u -3 -p -b -B -d -r1.25 cairo-features.h.in --- src/cairo-features.h.in 29 Dec 2005 15:17:01 -0000 1.25 +++ src/cairo-features.h.in 30 Jan 2006 07:49:32 -0000 @@ -59,6 +59,8 @@ @PDF_SURFACE_FEATURE@ +@TRANSFORM_SURFACE_FEATURE@ + @SVG_SURFACE_FEATURE@ @XLIB_SURFACE_FEATURE@ Index: src/cairo-path.c =================================================================== RCS file: /cvs/cairo/cairo/src/cairo-path.c,v retrieving revision 1.28 diff -u -3 -p -b -B -d -r1.28 cairo-path.c --- src/cairo-path.c 31 Aug 2005 22:08:02 -0000 1.28 +++ src/cairo-path.c 30 Jan 2006 07:49:32 -0000 @@ -528,17 +528,17 @@ _cairo_path_fixed_interpret (cairo_path_ switch (op) { case CAIRO_PATH_OP_MOVE_TO: - status = (*move_to) (closure, &point[0]); + status = move_to ? (*move_to) (closure, &point[0]) : CAIRO_STATUS_SUCCESS; break; case CAIRO_PATH_OP_LINE_TO: - status = (*line_to) (closure, &point[0]); + status = line_to ? (*line_to) (closure, &point[0]) : CAIRO_STATUS_SUCCESS; break; case CAIRO_PATH_OP_CURVE_TO: - status = (*curve_to) (closure, &point[0], &point[1], &point[2]); + status = curve_to ? (*curve_to) (closure, &point[0], &point[1], &point[2]) : CAIRO_STATUS_SUCCESS; break; case CAIRO_PATH_OP_CLOSE_PATH: default: - status = (*close_path) (closure); + status = close_path ? (*close_path) (closure) : CAIRO_STATUS_SUCCESS; break; } if (status) @@ -548,3 +548,83 @@ _cairo_path_fixed_interpret (cairo_path_ return CAIRO_STATUS_SUCCESS; } + +typedef struct { + const cairo_matrix_t *matrix; + cairo_path_fixed_t *path; +} cairo_path_fixed_transform_t; + +static cairo_status_t +moveto_func (void *closure, cairo_point_t *p) +{ + cairo_path_fixed_transform_t *t = closure; + double d[2]; + + d[0] = _cairo_fixed_to_double (p->x); + d[1] = _cairo_fixed_to_double (p->y); + cairo_matrix_transform_point (t->matrix, &d[0], &d[1]); + return _cairo_path_fixed_move_to (t->path, + _cairo_fixed_from_double (d[0]), + _cairo_fixed_from_double (d[1])); +} + +static cairo_status_t +lineto_func (void *closure, cairo_point_t *p) +{ + cairo_path_fixed_transform_t *t = closure; + double d[2]; + + d[0] = _cairo_fixed_to_double (p->x); + d[1] = _cairo_fixed_to_double (p->y); + cairo_matrix_transform_point (t->matrix, &d[0], &d[1]); + return _cairo_path_fixed_line_to (t->path, + _cairo_fixed_from_double (d[0]), + _cairo_fixed_from_double (d[1])); +} + +static cairo_status_t +curveto_func (void *closure, cairo_point_t *p0, + cairo_point_t *p1, + cairo_point_t *p2) +{ + cairo_path_fixed_transform_t *t = closure; + double d[6]; + + d[0] = _cairo_fixed_to_double (p0->x); + d[1] = _cairo_fixed_to_double (p0->y); + d[2] = _cairo_fixed_to_double (p1->x); + d[3] = _cairo_fixed_to_double (p1->y); + d[4] = _cairo_fixed_to_double (p2->x); + d[5] = _cairo_fixed_to_double (p2->y); + cairo_matrix_transform_point (t->matrix, &d[0], &d[1]); + cairo_matrix_transform_point (t->matrix, &d[2], &d[3]); + cairo_matrix_transform_point (t->matrix, &d[4], &d[5]); + return _cairo_path_fixed_curve_to (t->path, + _cairo_fixed_from_double (d[0]), + _cairo_fixed_from_double (d[1]), + _cairo_fixed_from_double (d[2]), + _cairo_fixed_from_double (d[3]), + _cairo_fixed_from_double (d[4]), + _cairo_fixed_from_double (d[5])); +} + +static cairo_status_t +closepath_func (void *closure) +{ + cairo_path_fixed_transform_t *t = closure; + + return _cairo_path_fixed_close_path (t->path); +} + +cairo_status_t +_cairo_path_fixed_init_copy_transform (cairo_path_fixed_t *path, + cairo_path_fixed_t *other, const cairo_matrix_t *matrix) +{ + cairo_path_fixed_transform_t t; + + _cairo_path_fixed_init (other); + t.path = other; + t.matrix = matrix; + return _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, + moveto_func, lineto_func, curveto_func, closepath_func, &t); +} Index: src/cairo-surface.c =================================================================== RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v retrieving revision 1.118 diff -u -3 -p -b -B -d -r1.118 cairo-surface.c --- src/cairo-surface.c 6 Jan 2006 22:11:07 -0000 1.118 +++ src/cairo-surface.c 30 Jan 2006 07:49:33 -0000 @@ -652,6 +652,9 @@ _cairo_surface_acquire_dest_image (cairo { assert (!surface->finished); + if (surface->backend->acquire_dest_image == NULL) + return CAIRO_INT_STATUS_UNSUPPORTED; + return surface->backend->acquire_dest_image (surface, interest_rect, image_out, image_rect, image_extra); } Index: src/cairoint.h =================================================================== RCS file: /cvs/cairo/cairo/src/cairoint.h,v retrieving revision 1.243 diff -u -3 -p -b -B -d -r1.243 cairoint.h --- src/cairoint.h 18 Jan 2006 01:01:40 -0000 1.243 +++ src/cairoint.h 30 Jan 2006 07:49:34 -0000 @@ -1380,6 +1380,10 @@ cairo_private cairo_status_t _cairo_path_fixed_init_copy (cairo_path_fixed_t *path, cairo_path_fixed_t *other); +cairo_private cairo_status_t +_cairo_path_fixed_init_copy_transform (cairo_path_fixed_t *path, + cairo_path_fixed_t *other, const cairo_matrix_t *matrix); + cairo_path_fixed_t * _cairo_path_fixed_create (void); Index: test/Makefile.am =================================================================== RCS file: /cvs/cairo/cairo/test/Makefile.am,v retrieving revision 1.109 diff -u -3 -p -b -B -d -r1.109 Makefile.am --- test/Makefile.am 18 Jan 2006 00:59:08 -0000 1.109 +++ test/Makefile.am 30 Jan 2006 07:49:34 -0000 @@ -55,6 +55,7 @@ text-pattern \ text-rotate \ transforms \ translate-show-surface \ +transform-surface \ trap-clip \ unantialiased-shapes \ unbounded-operator \ @@ -338,6 +339,7 @@ text_antialias_subpixel_LDADD = $(LDADDS text_cache_crash_LDADD = $(LDADDS) text_pattern_LDADD = $(LDADDS) text_rotate_LDADD = $(LDADDS) +transform_surface_LDADD = $(LDADDS) transforms_LDADD = $(LDADDS) translate_show_surface_LDADD = $(LDADDS) trap_clip_LDADD = $(LDADDS)