[cairo-commit] 2 commits - test/Makefile.am test/pdf2png.c
Carl Worth
cworth at kemper.freedesktop.org
Fri May 5 08:04:33 PDT 2006
test/Makefile.am | 5 -----
test/pdf2png.c | 38 +++++++++++---------------------------
2 files changed, 11 insertions(+), 32 deletions(-)
New commits:
diff-tree ac470b02384528f9fda3ee7c80b64d27825b927a (from 44572fdcc8627a5c13d8fc68b55290f414166095)
Author: Carl Worth <cworth at cworth.org>
Date: Fri May 5 07:57:10 2006 -0700
Don't build pdf2svg until we start depending on newer poppler
diff --git a/test/Makefile.am b/test/Makefile.am
index 34902ab..90b5a9c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -330,11 +330,6 @@ if CAIRO_CAN_TEST_SVG_SURFACE
noinst_PROGRAMS += svg2png
svg2png_CFLAGS = $(LIBRSVG_CFLAGS)
svg2png_LDADD = $(LIBRSVG_LIBS)
-if CAIRO_CAN_TEST_PDF_SURFACE
-noinst_PROGRAMS += pdf2svg
-pdf2svg_CFLAGS = $(POPPLER_CFLAGS)
-pdf2svg_LDADD = $(LDADD) $(POPPLER_LIBS)
-endif
endif
CLEANFILES = \
diff-tree 44572fdcc8627a5c13d8fc68b55290f414166095 (from d76701f465669f843c12aee6b533c9fb6399ec99)
Author: Carl Worth <cworth at cworth.org>
Date: Fri May 5 07:51:59 2006 -0700
Revert "pdf2png: Use new poppler_page_render to render directly through cairo."
This introduced a rather gratuitous dependency on a newer version of
poppler, which caused a fair amount of pain for no significant
benefit.
This reverts 253472492ee2a690646a30b32cf8180f5b6e3299 commit.
diff --git a/test/pdf2png.c b/test/pdf2png.c
index c8ea0db..3edb17c 100644
--- a/test/pdf2png.c
+++ b/test/pdf2png.c
@@ -1,6 +1,5 @@
/*
* Copyright © 2005 Red Hat, Inc.
- * Copyright © 2006 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
@@ -21,8 +20,7 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * Authors: Kristian Høgsberg <krh at redhat.com>
- * Carl Worth <cworth at redhat.com>
+ * Author: Kristian Høgsberg <krh at redhat.com>
*/
#include <stdlib.h>
@@ -37,15 +35,13 @@ int main (int argc, char *argv[])
{
PopplerDocument *document;
PopplerPage *page;
+ GdkPixbuf *pixbuf;
double width, height;
GError *error;
const char *filename = argv[1];
const char *output_filename = argv[2];
const char *page_label = argv[3];
gchar *absolute, *uri;
- cairo_surface_t *surface;
- cairo_t *cr;
- cairo_status_t status;
if (argc != 4)
FAIL ("usage: pdf2png input_file.pdf output_file.png page");
@@ -77,28 +73,16 @@ int main (int argc, char *argv[])
poppler_page_get_size (page, &width, &height);
- surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
- width * PIXELS_PER_POINT,
- height * PIXELS_PER_POINT);
- cr = cairo_create (surface);
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
+ width * PIXELS_PER_POINT,
+ height * PIXELS_PER_POINT);
+ gdk_pixbuf_fill (pixbuf, 0xffffffff);
+ poppler_page_render_to_pixbuf (page, 0, 0, width , height,
+ PIXELS_PER_POINT, 0, pixbuf);
- /* Clear background */
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
- cairo_paint (cr);
-
- poppler_page_render (page, cr);
-
- status = cairo_status (cr);
- if (status)
- FAIL (cairo_status_to_string (status));
-
- cairo_destroy (cr);
-
- cairo_surface_write_to_png (surface, output_filename);
-
- status = cairo_surface_status (surface);
- if (status)
- FAIL (cairo_status_to_string (status));
+ gdk_pixbuf_save (pixbuf, output_filename, "png", &error, NULL);
+ if (error != NULL)
+ FAIL (error->message);
return 0;
}
More information about the cairo-commit
mailing list