[cairo-commit] cairo/src cairo-output-stream.c, 1.3,
1.4 cairo-pdf-surface.c, 1.34, 1.35 cairo-pdf.h, 1.9,
1.10 cairoint.h, 1.141, 1.142
Kristian Hogsberg
commit at pdx.freedesktop.org
Mon May 16 11:41:44 PDT 2005
Committed by: krh
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv23180/src
Modified Files:
cairo-output-stream.c cairo-pdf-surface.c cairo-pdf.h
cairoint.h
Log Message:
2005-05-16 Kristian Høgsberg <krh at redhat.com>
* src/cairo-pdf-surface.c (cairo_pdf_surface_create):
* src/cairo-output-stream.c
(_cairo_output_stream_create_for_file): Take a filename instead of
a FILE pointer.
Index: cairo-output-stream.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-output-stream.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-output-stream.c 13 May 2005 21:04:22 -0000 1.3
+++ cairo-output-stream.c 16 May 2005 18:41:42 -0000 1.4
@@ -266,12 +266,26 @@
static void
stdio_destroy_closure (void *closure)
{
+ FILE *fp = closure;
+
+ fclose (fp);
}
cairo_output_stream_t *
-_cairo_output_stream_create_for_file (FILE *fp)
+_cairo_output_stream_create_for_file (const char *filename)
{
- return _cairo_output_stream_create (stdio_write,
- stdio_destroy_closure, fp);
+ FILE *fp;
+ cairo_output_stream_t *stream;
+
+ fp = fopen (filename, "wb");
+ if (fp == NULL)
+ return NULL;
+
+ stream = _cairo_output_stream_create (stdio_write,
+ stdio_destroy_closure, fp);
+ if (stream == NULL)
+ fclose (fp);
+
+ return stream;
}
Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cairo-pdf-surface.c 13 May 2005 21:04:22 -0000 1.34
+++ cairo-pdf-surface.c 16 May 2005 18:41:42 -0000 1.35
@@ -160,8 +160,8 @@
double width;
double height;
- double x_ppi;
- double y_ppi;
+ double x_dpi;
+ double y_dpi;
unsigned int next_available_id;
unsigned int pages_id;
@@ -190,7 +190,7 @@
cairo_array_t fonts;
};
-#define DEFAULT_PPI 300
+#define DEFAULT_DPI 300
static cairo_pdf_document_t *
_cairo_pdf_document_create (cairo_output_stream_t *stream,
@@ -939,13 +939,13 @@
}
cairo_surface_t *
-cairo_pdf_surface_create (FILE *fp,
+cairo_pdf_surface_create (const char *filename,
double width,
double height)
{
cairo_output_stream_t *stream;
- stream = _cairo_output_stream_create_for_file (fp);
+ stream = _cairo_output_stream_create_for_file (filename);
if (stream == NULL)
return NULL;
@@ -953,14 +953,14 @@
}
void
-cairo_pdf_surface_set_ppi (cairo_surface_t *surface,
- double x_ppi,
- double y_ppi)
+cairo_pdf_surface_set_dpi (cairo_surface_t *surface,
+ double x_dpi,
+ double y_dpi)
{
cairo_pdf_surface_t *pdf_surface = (cairo_pdf_surface_t *) surface;
- pdf_surface->document->x_ppi = x_ppi;
- pdf_surface->document->y_ppi = y_ppi;
+ pdf_surface->document->x_dpi = x_dpi;
+ pdf_surface->document->y_dpi = y_dpi;
}
static cairo_surface_t *
@@ -1937,8 +1937,8 @@
document->finished = FALSE;
document->width = width;
document->height = height;
- document->x_ppi = DEFAULT_PPI;
- document->y_ppi = DEFAULT_PPI;
+ document->x_dpi = DEFAULT_DPI;
+ document->y_dpi = DEFAULT_DPI;
_cairo_array_init (&document->objects, sizeof (cairo_pdf_object_t));
_cairo_array_init (&document->pages, sizeof (unsigned int));
Index: cairo-pdf.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cairo-pdf.h 14 May 2005 17:03:56 -0000 1.9
+++ cairo-pdf.h 16 May 2005 18:41:42 -0000 1.10
@@ -41,12 +41,10 @@
#if CAIRO_HAS_PDF_SURFACE
-#include <stdio.h>
-
CAIRO_BEGIN_DECLS
cairo_surface_t *
-cairo_pdf_surface_create (FILE *fp,
+cairo_pdf_surface_create (const char *filename,
double width,
double height);
@@ -58,9 +56,9 @@
double height);
void
-cairo_pdf_surface_set_ppi (cairo_surface_t *surface,
- double x_ppi,
- double y_ppi);
+cairo_pdf_surface_set_dpi (cairo_surface_t *surface,
+ double x_dpi,
+ double y_dpi);
CAIRO_END_DECLS
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- cairoint.h 13 May 2005 21:04:22 -0000 1.141
+++ cairoint.h 16 May 2005 18:41:42 -0000 1.142
@@ -1798,7 +1798,7 @@
_cairo_output_stream_get_status (cairo_output_stream_t *stream);
cairo_output_stream_t *
-_cairo_output_stream_create_for_file (FILE *fp);
+_cairo_output_stream_create_for_file (const char *filename);
/* Avoid unnecessary PLT entries. */
More information about the cairo-commit
mailing list