[cairo-commit] cairo/src cairo.c,1.25,1.26 cairo.h,1.26,1.27 cairo_gstate.c,1.28,1.29 cairo_image_surface.c,1.3,1.4 cairo_ps_surface.c,1.3,1.4 cairo_surface.c,1.20,1.21 cairo_xlib_surface.c,1.10,1.11 cairoint.h,1.37,1.38
Carl Worth
commit at pdx.freedesktop.org
Mon Nov 3 19:17:33 PST 2003
- Previous message: [cairo-commit] cairo ChangeLog,1.99,1.100 configure.in,1.24,1.25
- Next message: [cairo-commit] cairo-demo/PS ChangeLog,NONE,1.1 .cvsignore,1.1,1.2 basket.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv15885/src
Modified Files:
cairo.c cairo.h cairo_gstate.c cairo_image_surface.c
cairo_ps_surface.c cairo_surface.c cairo_xlib_surface.c
cairoint.h
Log Message:
Add support for cairo_copy_page.
Fixes so PS output can be more than one page.
Bump version to 0.1.11 for new cairo_copy_page.
Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** cairo.c 1 Nov 2003 05:30:35 -0000 1.25
--- cairo.c 4 Nov 2003 03:17:31 -0000 1.26
***************
*** 585,588 ****
--- 585,597 ----
void
+ cairo_copy_page (cairo_t *cr)
+ {
+ if (cr->status)
+ return;
+
+ cr->status = _cairo_gstate_copy_page (cr->gstate);
+ }
+
+ void
cairo_show_page (cairo_t *cr)
{
Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** cairo.h 3 Nov 2003 21:44:53 -0000 1.26
--- cairo.h 4 Nov 2003 03:17:31 -0000 1.27
***************
*** 297,300 ****
--- 297,303 ----
extern void __external_linkage
+ cairo_copy_page (cairo_t *cr);
+
+ extern void __external_linkage
cairo_show_page (cairo_t *cr);
Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** cairo_gstate.c 1 Nov 2003 05:30:35 -0000 1.28
--- cairo_gstate.c 4 Nov 2003 03:17:31 -0000 1.29
***************
*** 1346,1349 ****
--- 1346,1358 ----
cairo_status_t
+ _cairo_gstate_copy_page (cairo_gstate_t *gstate)
+ {
+ if (gstate->surface == NULL)
+ return CAIRO_STATUS_NO_TARGET_SURFACE;
+
+ return _cairo_surface_copy_page (gstate->surface);
+ }
+
+ cairo_status_t
_cairo_gstate_show_page (cairo_gstate_t *gstate)
{
Index: cairo_image_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_image_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** cairo_image_surface.c 4 Nov 2003 02:24:45 -0000 1.3
--- cairo_image_surface.c 4 Nov 2003 03:17:31 -0000 1.4
***************
*** 437,440 ****
--- 437,446 ----
static cairo_int_status_t
+ _cairo_image_surface_copy_page (void *abstract_surface)
+ {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
+ static cairo_int_status_t
_cairo_image_surface_show_page (void *abstract_surface)
{
***************
*** 454,457 ****
--- 460,464 ----
_cairo_image_surface_fill_rectangles,
_cairo_image_surface_composite_trapezoids,
+ _cairo_image_surface_copy_page,
_cairo_image_surface_show_page
};
Index: cairo_ps_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ps_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** cairo_ps_surface.c 4 Nov 2003 02:24:45 -0000 1.3
--- cairo_ps_surface.c 4 Nov 2003 03:17:31 -0000 1.4
***************
*** 68,74 ****
--- 68,79 ----
double y_ppi;
+ int pages;
+
cairo_image_surface_t *image;
} cairo_ps_surface_t;
+ static void
+ _cairo_ps_surface_erase (cairo_ps_surface_t *surface);
+
cairo_surface_t *
cairo_ps_surface_create (FILE *file,
***************
*** 80,84 ****
cairo_ps_surface_t *surface;
int width, height;
! cairo_color_t transparent;
surface = malloc (sizeof (cairo_ps_surface_t));
--- 85,89 ----
cairo_ps_surface_t *surface;
int width, height;
! time_t now = time (0);
surface = malloc (sizeof (cairo_ps_surface_t));
***************
*** 95,98 ****
--- 100,105 ----
surface->y_ppi = x_pixels_per_inch;
+ surface->pages = 0;
+
width = (int) (x_pixels_per_inch * width_inches + 1.0);
height = (int) (y_pixels_per_inch * height_inches + 1.0);
***************
*** 105,114 ****
}
! _cairo_color_init (&transparent);
! _cairo_color_set_rgb (&transparent, 0., 0., 0.);
! _cairo_color_set_alpha (&transparent, 0.);
! _cairo_surface_fill_rectangle (&surface->image->base,
! CAIRO_OPERATOR_SRC,
! &transparent, 0, 0, width, height);
return &surface->base;
--- 112,136 ----
}
! _cairo_ps_surface_erase (surface);
!
! /* Document header */
! fprintf (file,
! "%%!PS-Adobe-3.0\n"
! "%%%%Creator: Cairo (http://cairographics.org)\n");
! fprintf (file,
! "%%%%CreationDate: %s",
! ctime (&now));
! fprintf (file,
! "%%%%Copyright: 2003 Carl Worth and Keith Packard\n");
! fprintf (file,
! "%%%%BoundingBox: %d %d %d %d\n",
! 0, 0, (int) (surface->width_inches * 72.0), (int) (surface->height_inches * 72.0));
! /* The "/FlateDecode filter" currently used is a feature of LanguageLevel 3 */
! fprintf (file,
! "%%%%DocumentData: Clean7Bit\n"
! "%%%%LanguageLevel: 3\n");
! fprintf (file,
! "%%%%Orientation: Portrait\n"
! "%%%%EndComments\n");
return &surface->base;
***************
*** 129,132 ****
--- 151,157 ----
cairo_ps_surface_t *surface = abstract_surface;
+ /* Document footer */
+ fprintf (surface->file, "%%%%EOF\n");
+
cairo_surface_destroy (&surface->image->base);
***************
*** 134,137 ****
--- 159,178 ----
}
+ static void
+ _cairo_ps_surface_erase (cairo_ps_surface_t *surface)
+ {
+ cairo_color_t transparent;
+
+ _cairo_color_init (&transparent);
+ _cairo_color_set_rgb (&transparent, 0., 0., 0.);
+ _cairo_color_set_alpha (&transparent, 0.);
+ _cairo_surface_fill_rectangle (&surface->image->base,
+ CAIRO_OPERATOR_SRC,
+ &transparent,
+ 0, 0,
+ surface->image->width,
+ surface->image->height);
+ }
+
/* XXX: We should re-work this interface to return both X/Y ppi values. */
static double
***************
*** 235,239 ****
static cairo_int_status_t
! _cairo_ps_surface_show_page (void *abstract_surface)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
--- 276,280 ----
static cairo_int_status_t
! _cairo_ps_surface_copy_page (void *abstract_surface)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
***************
*** 244,248 ****
int i, x, y;
- time_t now = time (0);
cairo_surface_t *white_surface;
--- 285,288 ----
***************
*** 302,329 ****
compress (compressed, &compressed_size, bgr, bgr_size);
- /* Document header */
- fprintf (file,
- "%%!PS-Adobe-3.0\n"
- "%%%%Creator: Cairo (http://cairographics.org)\n");
- fprintf (file,
- "%%%%CreationDate: %s",
- ctime (&now));
- fprintf (file,
- "%%%%Copyright: 2003 Carl Worth and Keith Packard\n");
- fprintf (file,
- "%%%%BoundingBox: %d %d %d %d\n",
- 0, 0, (int) (surface->width_inches * 72.0), (int) (surface->height_inches * 72.0));
- fprintf (file,
- "%%%%DocumentData: Clean7Bit\n"
- "%%%%LanguageLevel: 3\n");
- fprintf (file,
- "%%%%Pages: %d\n",
- 1);
- fprintf (file,
- "%%%%Orientation: Portrait\n"
- "%%%%EndComments\n");
-
/* Page header */
! fprintf (file, "%%%%Page: %d\n", 1);
fprintf (file, "gsave\n");
--- 342,347 ----
compress (compressed, &compressed_size, bgr, bgr_size);
/* Page header */
! fprintf (file, "%%%%Page: %d\n", ++surface->pages);
fprintf (file, "gsave\n");
***************
*** 354,360 ****
fprintf (file, "%%%%EndPage\n");
- /* Document footer */
- fprintf (file, "%%%%EOF\n");
-
cairo_surface_destroy (white_surface);
BAIL2:
--- 372,375 ----
***************
*** 366,369 ****
--- 381,399 ----
}
+ static cairo_int_status_t
+ _cairo_ps_surface_show_page (void *abstract_surface)
+ {
+ cairo_int_status_t status;
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ status = _cairo_ps_surface_copy_page (surface);
+ if (status)
+ return status;
+
+ _cairo_ps_surface_erase (surface);
+
+ return CAIRO_STATUS_SUCCESS;
+ }
+
static const cairo_surface_backend_t cairo_ps_surface_backend = {
_cairo_ps_surface_create_similar,
***************
*** 378,381 ****
--- 408,412 ----
_cairo_ps_surface_fill_rectangles,
_cairo_ps_surface_composite_trapezoids,
+ _cairo_ps_surface_copy_page,
_cairo_ps_surface_show_page
};
Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** cairo_surface.c 1 Nov 2003 05:30:35 -0000 1.20
--- cairo_surface.c 4 Nov 2003 03:17:31 -0000 1.21
***************
*** 336,339 ****
--- 336,354 ----
cairo_status_t
+ _cairo_surface_copy_page (cairo_surface_t *surface)
+ {
+ cairo_int_status_t status;
+
+ status = surface->backend->copy_page (surface);
+ /* It's fine if some backends just don't support this. */
+ if (status == CAIRO_INT_STATUS_UNSUPPORTED)
+ return CAIRO_STATUS_SUCCESS;
+ if (status)
+ return status;
+
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ cairo_status_t
_cairo_surface_show_page (cairo_surface_t *surface)
{
Index: cairo_xlib_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xlib_surface.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** cairo_xlib_surface.c 1 Nov 2003 05:30:35 -0000 1.10
--- cairo_xlib_surface.c 4 Nov 2003 03:17:31 -0000 1.11
***************
*** 558,561 ****
--- 558,567 ----
static cairo_int_status_t
+ _cairo_xlib_surface_copy_page (void *abstract_surface)
+ {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
+ static cairo_int_status_t
_cairo_xlib_surface_show_page (void *abstract_surface)
{
***************
*** 575,578 ****
--- 581,585 ----
_cairo_xlib_surface_fill_rectangles,
_cairo_xlib_surface_composite_trapezoids,
+ _cairo_xlib_surface_copy_page,
_cairo_xlib_surface_show_page
};
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** cairoint.h 1 Nov 2003 05:30:35 -0000 1.37
--- cairoint.h 4 Nov 2003 03:17:31 -0000 1.38
***************
*** 356,359 ****
--- 356,362 ----
cairo_int_status_t
+ (*copy_page) (void *surface);
+
+ cairo_int_status_t
(*show_page) (void *surface);
} cairo_surface_backend_t;
***************
*** 713,717 ****
_cairo_gstate_fill (cairo_gstate_t *gstate);
! cairo_status_t
_cairo_gstate_show_page (cairo_gstate_t *gstate);
--- 716,723 ----
_cairo_gstate_fill (cairo_gstate_t *gstate);
! extern cairo_status_t __internal_linkage
! _cairo_gstate_copy_page (cairo_gstate_t *gstate);
!
! extern cairo_status_t __internal_linkage
_cairo_gstate_show_page (cairo_gstate_t *gstate);
***************
*** 963,967 ****
int ntraps);
! cairo_status_t
_cairo_surface_show_page (cairo_surface_t *surface);
--- 969,976 ----
int ntraps);
! extern cairo_status_t __internal_linkage
! _cairo_surface_copy_page (cairo_surface_t *surface);
!
! extern cairo_status_t __internal_linkage
_cairo_surface_show_page (cairo_surface_t *surface);
- Previous message: [cairo-commit] cairo ChangeLog,1.99,1.100 configure.in,1.24,1.25
- Next message: [cairo-commit] cairo-demo/PS ChangeLog,NONE,1.1 .cvsignore,1.1,1.2 basket.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list