[poppler] 2 commits - configure.ac glib/demo glib/Makefile.am glib/poppler.cc glib/poppler-document.cc glib/poppler-page.cc glib/poppler-page.h glib/poppler-private.h glib/test-poppler-glib.cc poppler-glib.pc.in
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Sun Jan 24 10:29:21 PST 2010
configure.ac | 74 +++++++-------
glib/Makefile.am | 20 ---
glib/demo/images.c | 2
glib/demo/layers.c | 71 -------------
glib/demo/render.c | 29 -----
glib/poppler-document.cc | 9 -
glib/poppler-page.cc | 237 ----------------------------------------------
glib/poppler-page.h | 7 -
glib/poppler-private.h | 14 --
glib/poppler.cc | 6 -
glib/test-poppler-glib.cc | 6 -
poppler-glib.pc.in | 2
12 files changed, 60 insertions(+), 417 deletions(-)
New commits:
commit 9c9f18b6ceea546dfb21ef0aab29ba99733dcb52
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sun Jan 24 19:27:29 2010 +0100
[glib-demo] Remove #ifdef HAVE_CAIRO macros from several demos
diff --git a/glib/demo/images.c b/glib/demo/images.c
index 76cfed2..b1fe8e2 100644
--- a/glib/demo/images.c
+++ b/glib/demo/images.c
@@ -201,10 +201,8 @@ pgd_images_selection_changed (GtkTreeSelection *treeselection,
IMAGES_ID_COLUMN, &image_id,
-1);
page = poppler_document_get_page (demo->doc, demo->page);
-#if defined (HAVE_CAIRO)
pgd_image_view_set_image (demo->image_view,
poppler_page_get_image (page, image_id));
-#endif
g_object_unref (page);
}
diff --git a/glib/demo/layers.c b/glib/demo/layers.c
index ac93376..348f9db 100644
--- a/glib/demo/layers.c
+++ b/glib/demo/layers.c
@@ -37,12 +37,8 @@ typedef struct {
guint page;
GtkWidget *treeview;
GtkWidget *darea;
-
-#if defined (HAVE_CAIRO)
+
cairo_surface_t *surface;
-#else
- GdkPixbuf *pixbuf;
-#endif
} PgdLayersDemo;
static void
@@ -55,18 +51,11 @@ pgd_layers_free (PgdLayersDemo *demo)
g_object_unref (demo->doc);
demo->doc = NULL;
}
-
-#if defined (HAVE_CAIRO)
+
if (demo->surface) {
cairo_surface_destroy (demo->surface);
demo->surface = NULL;
}
-#else
- if (demo->pixbuf) {
- g_object_unref (demo->pixbuf);
- demo->pixbuf = NULL;
- }
-#endif
g_free (demo);
}
@@ -156,7 +145,6 @@ pgd_layers_create_model (PopplerDocument *document)
return model;
}
-#if defined (HAVE_CAIRO)
static cairo_surface_t *
pgd_layers_render_page (PgdLayersDemo *demo)
{
@@ -191,39 +179,12 @@ pgd_layers_render_page (PgdLayersDemo *demo)
return surface;
}
-#else
-static GdkPixbuf *
-pgd_layers_render_page (PgdLayersDemo *demo)
-{
- PopplerPage *page;
- gdouble width, height;
- GdkPixbuf *pixbuf = NULL;
-
- page = poppler_document_get_page (demo->doc, demo->page);
- if (!page)
- return NULL;
-
- poppler_page_get_size (page, &width, &height);
- gtk_widget_set_size_request (demo->darea, width, height);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE, 8, width, height);
- gdk_pixbuf_fill (pixbuf, 0xffffff);
- poppler_page_render_to_pixbuf (page, 0, 0,
- width, height,
- 1.0, 0, pixbuf);
- g_object_unref (page);
-
- return pixbuf;
-}
-#endif
static gboolean
pgd_layers_viewer_drawing_area_expose (GtkWidget *area,
GdkEventExpose *event,
PgdLayersDemo *demo)
{
-#if defined (HAVE_CAIRO)
cairo_t *cr;
if (!demo->surface) {
@@ -231,47 +192,23 @@ pgd_layers_viewer_drawing_area_expose (GtkWidget *area,
if (!demo->surface)
return FALSE;
}
-#else
-
- if (!demo->pixbuf) {
- demo->pixbuf = pgd_layers_render_page (demo);
- if (!demo->pixbuf)
- return FALSE;
- }
-#endif
gdk_window_clear (area->window);
-#if defined (HAVE_CAIRO)
cr = gdk_cairo_create (area->window);
cairo_set_source_surface (cr, demo->surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
-#else
- gdk_draw_pixbuf (area->window,
- area->style->fg_gc[GTK_STATE_NORMAL],
- demo->pixbuf,
- 0, 0,
- 0, 0,
- gdk_pixbuf_get_width (demo->pixbuf),
- gdk_pixbuf_get_height (demo->pixbuf),
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
-#endif
-
+
return TRUE;
}
static gboolean
pgd_layers_viewer_redraw (PgdLayersDemo *demo)
{
-#if defined (HAVE_CAIRO)
cairo_surface_destroy (demo->surface);
demo->surface = NULL;
-#else
- g_object_unref (demo->pixbuf);
- demo->pixbuf = NULL;
-#endif
+
gtk_widget_queue_draw (demo->darea);
return FALSE;
diff --git a/glib/demo/render.c b/glib/demo/render.c
index f8f65bf..4365a4b 100644
--- a/glib/demo/render.c
+++ b/glib/demo/render.c
@@ -24,9 +24,7 @@
#include "render.h"
typedef enum {
-#if defined (HAVE_CAIRO)
PGD_RENDER_CAIRO,
-#endif
PGD_RENDER_PIXBUF
} PgdRenderMode;
@@ -48,10 +46,8 @@ typedef struct {
GtkWidget *slice_w;
GtkWidget *slice_h;
GtkWidget *timer_label;
-
-#if defined (HAVE_CAIRO)
+
cairo_surface_t *surface;
-#endif
GdkPixbuf *pixbuf;
} PgdRenderDemo;
@@ -66,12 +62,10 @@ pgd_render_free (PgdRenderDemo *demo)
demo->doc = NULL;
}
-#if defined (HAVE_CAIRO)
if (demo->surface) {
cairo_surface_destroy (demo->surface);
demo->surface = NULL;
}
-#endif
if (demo->pixbuf) {
g_object_unref (demo->pixbuf);
@@ -86,17 +80,14 @@ pgd_render_drawing_area_expose (GtkWidget *area,
GdkEventExpose *event,
PgdRenderDemo *demo)
{
-#if defined (HAVE_CAIRO)
if (demo->mode == PGD_RENDER_CAIRO && !demo->surface)
return FALSE;
-#endif
-
+
if (demo->mode == PGD_RENDER_PIXBUF && !demo->pixbuf)
return FALSE;
gdk_window_clear (area->window);
-#if defined (HAVE_CAIRO)
if (demo->mode == PGD_RENDER_CAIRO) {
cairo_t *cr;
@@ -105,7 +96,6 @@ pgd_render_drawing_area_expose (GtkWidget *area,
cairo_paint (cr);
cairo_destroy (cr);
} else if (demo->mode == PGD_RENDER_PIXBUF) {
-#endif
gdk_draw_pixbuf (area->window,
area->style->fg_gc[GTK_STATE_NORMAL],
demo->pixbuf,
@@ -115,12 +105,10 @@ pgd_render_drawing_area_expose (GtkWidget *area,
gdk_pixbuf_get_height (demo->pixbuf),
GDK_RGB_DITHER_NORMAL,
0, 0);
-#if defined (HAVE_CAIRO)
} else {
g_assert_not_reached ();
}
-#endif
-
+
return TRUE;
}
@@ -139,12 +127,10 @@ pgd_render_start (GtkButton *button,
if (!page)
return;
-#if defined (HAVE_CAIRO)
if (demo->surface)
cairo_surface_destroy (demo->surface);
demo->surface = NULL;
-#endif
-
+
if (demo->pixbuf)
g_object_unref (demo->pixbuf);
demo->pixbuf = NULL;
@@ -163,7 +149,6 @@ pgd_render_start (GtkButton *button,
y = demo->slice.x * demo->scale;
}
-#if defined (HAVE_CAIRO)
if (demo->mode == PGD_RENDER_CAIRO) {
cairo_t *cr;
@@ -207,7 +192,6 @@ pgd_render_start (GtkButton *button,
cairo_destroy (cr);
} else if (demo->mode == PGD_RENDER_PIXBUF) {
-#endif
#ifdef POPPLER_WITH_GDK
timer = g_timer_new ();
demo->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
@@ -232,11 +216,10 @@ pgd_render_start (GtkButton *button,
}
g_timer_stop (timer);
#endif /* POPPLER_WITH_GDK */
-#if defined (HAVE_CAIRO)
} else {
g_assert_not_reached ();
}
-#endif
+
g_object_unref (page);
str = g_strdup_printf ("<i>Page rendered in %.4f seconds</i>",
@@ -411,9 +394,7 @@ pgd_render_properties_selector_create (PgdRenderDemo *demo)
gtk_widget_show (label);
mode_selector = gtk_combo_box_new_text ();
-#if defined (HAVE_CAIRO)
gtk_combo_box_append_text (GTK_COMBO_BOX (mode_selector), "cairo");
-#endif
#ifdef POPPLER_WITH_GDK
gtk_combo_box_append_text (GTK_COMBO_BOX (mode_selector), "pixbuf");
#endif
commit 4e938c1f81add2162ced0e97b24fe588f15f178d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sun Jan 24 19:15:06 2010 +0100
[glib] Make glib frontend unconditionally use cairo output device
Splash support has been removed.
diff --git a/configure.ac b/configure.ac
index dae0a1e..590e8bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -369,28 +369,38 @@ fi
AC_SUBST(CAIRO_FEATURE)
AC_SUBST(CAIRO_REQ)
-POPPLER_GLIB_DISABLE_DEPRECATED=""
-POPPLER_GLIB_DISABLE_SINGLE_INCLUDES=""
-
-GLIB_REQUIRED=2.18
-AC_ARG_ENABLE(poppler-glib,
- AC_HELP_STRING([--disable-poppler-glib],
- [Don't compile poppler glib wrapper.]),
- enable_poppler_glib=$enableval,
- enable_poppler_glib="try")
-if test x$enable_poppler_glib = xyes; then
- PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
-elif test x$enable_poppler_glib = xtry; then
- PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED,
- [enable_poppler_glib="yes"],
- [enable_poppler_glib="no"])
-fi
-if test x$enable_poppler_glib = xyes; then
- AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
- POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
- POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
+if test x$enable_cairo_output = xyes; then
+ POPPLER_GLIB_DISABLE_DEPRECATED=""
+ POPPLER_GLIB_DISABLE_SINGLE_INCLUDES=""
+
+ GLIB_REQUIRED=2.18
+ AC_ARG_ENABLE(poppler-glib,
+ AC_HELP_STRING([--disable-poppler-glib],
+ [Don't compile poppler glib wrapper.]),
+ enable_poppler_glib=$enableval,
+ enable_poppler_glib="try")
+ if test x$enable_poppler_glib = xyes; then
+ PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION)
+ elif test x$enable_poppler_glib = xtry; then
+ PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION,
+ [enable_poppler_glib="yes"],
+ [enable_poppler_glib="no"])
+ fi
+ if test x$enable_poppler_glib = xyes; then
+ GLIB_REQ="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION"
+ AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
+ POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
+ POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
+ fi
+else
+ if test x$enable_poppler_glib = xyes; then
+ AC_MSG_ERROR("Cairo output is required to build glib frontend")
+ fi
+ enable_poppler_glib="no"
+ GLIB_REQ=""
fi
AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
+AC_SUBST(GLIB_REQ)
GTK_DOC_CHECK([1.0])
@@ -407,34 +417,30 @@ if test x$enable_poppler_glib = xyes; then
if test x$enable_gdk = xyes; then
PKG_CHECK_MODULES(GDK, gdk-2.0)
elif test x$enable_gdk = xtry; then
- if test x$enable_splash_output = xyes; then
- PKG_CHECK_MODULES(GDK, gdk-2.0,
- [enable_gdk="yes"],
- [enable_gdk="no"])
- elif test x$enable_cairo_output = xyes; then
- PKG_CHECK_MODULES(GDK, gdk-2.0,
- [enable_gdk="yes"],
- [enable_gdk="no"])
- fi
- elif test x$enable_splash_output = xyes; then
- PKG_CHECK_MODULES(GDK, gdk-2.0)
- AC_MSG_WARN("GDK is required by the glib wrapper when splash output device is
- enabled. If you want to comppile popler without GDK use --disable-splash-output too")
- enable_gdk=yes
+ PKG_CHECK_MODULES(GDK, gdk-2.0,
+ [enable_gdk="yes"],
+ [enable_gdk="no"])
fi
if test x$enable_gdk = xyes; then
+ GDK_REQ="gdk-2.0 gdk-pixbuf-2.0"
AC_DEFINE(POPPLER_WITH_GDK,[1], [Have GDK])
GDK_FEATURE="#define POPPLER_WITH_GDK 1"
POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED"
POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
else
+ enable_gdk="no"
GDK_FEATURE=""
+ GDK_REQ=""
fi
+else
+ enable_gdk="no"
+ GDK_REQ=""
fi
AM_CONDITIONAL(BUILD_WITH_GDK, test x$enable_gdk = xyes)
AC_SUBST(GDK_CFLAGS)
AC_SUBST(GDK_LIBS)
AC_SUBST(GDK_FEATURE)
+AC_SUBST(GDK_REQ)
AC_SUBST(POPPLER_GLIB_DISABLE_DEPRECATED)
AC_SUBST(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 3c065fe..bb6c489 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -1,25 +1,12 @@
-if BUILD_CAIRO_OUTPUT
-
-cairo_includes = \
- $(CAIRO_CFLAGS)
-
-cairo_libs = \
- $(top_builddir)/poppler/libpoppler-cairo.la \
- $(CAIRO_LIBS)
-
-endif
-
SUBDIRS = . reference demo
INCLUDES = \
-DG_LOG_DOMAIN=\"Poppler\" \
-I$(top_srcdir) \
-I$(top_srcdir)/poppler \
- $(cairo_includes) \
$(POPPLER_GLIB_CFLAGS) \
$(GDK_CFLAGS) \
$(FREETYPE_CFLAGS) \
$(FONTCONFIG_CFLAGS) \
- $(cairo_includes) \
$(POPPLER_GLIB_DISABLE_DEPRECATED) \
$(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
@@ -77,11 +64,11 @@ libpoppler_glib_la_SOURCES = \
libpoppler_glib_la_LIBADD = \
$(top_builddir)/poppler/libpoppler.la \
+ $(top_builddir)/poppler/libpoppler-cairo.la \
$(POPPLER_GLIB_LIBS) \
$(GDK_LIBS) \
$(FREETYPE_LIBS) \
- $(FONTCONFIG_LIBS) \
- $(cairo_libs)
+ $(FONTCONFIG_LIBS)
libpoppler_glib_la_LDFLAGS = -version-info 4:0:0 @create_shared_lib@ @auto_import_flags@
@@ -96,8 +83,7 @@ test_poppler_glib_LDADD = \
libpoppler-glib.la \
$(POPPLER_GLIB_LIBS) \
$(GDK_LIBS) \
- $(FREETYPE_LIBS) \
- $(cairo_libs)
+ $(FREETYPE_LIBS)
endif
BUILT_SOURCES = \
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index cb6e485..eceb5c4 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -116,17 +116,8 @@ _poppler_document_new_from_pdfdoc (PDFDoc *newDoc,
document->doc = newDoc;
-#if defined (HAVE_CAIRO)
document->output_dev = new CairoOutputDev ();
document->output_dev->startDoc(document->doc->getXRef (), document->doc->getCatalog ());
-#elif defined (HAVE_SPLASH)
- SplashColor white;
- white[0] = 255;
- white[1] = 255;
- white[2] = 255;
- document->output_dev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
- document->output_dev->startDoc(document->doc->getXRef ());
-#endif
return document;
}
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 2448644..c439c2a 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -71,15 +71,8 @@ poppler_page_finalize (GObject *object)
if (page->annots != NULL)
delete page->annots;
-#if defined (HAVE_CAIRO)
if (page->text != NULL)
page->text->decRefCnt();
-#else
- if (page->gfx != NULL)
- delete page->gfx;
- if (page->text_dev != NULL)
- delete page->text_dev;
-#endif
/* page->page is owned by the document */
}
@@ -235,35 +228,6 @@ poppler_page_get_transition (PopplerPage *page)
return transition;
}
-#if !defined (HAVE_CAIRO)
-static TextOutputDev *
-poppler_page_get_text_output_dev (PopplerPage *page)
-{
- if (page->text_dev == NULL) {
- page->text_dev = new TextOutputDev (NULL, gTrue, gFalse, gFalse);
-
- if (page->gfx)
- delete page->gfx;
- page->gfx = page->page->createGfx(page->text_dev,
- 72.0, 72.0, 0,
- gFalse, /* useMediaBox */
- gTrue, /* Crop */
- -1, -1, -1, -1,
- gFalse, /* printing */
- page->document->doc->getCatalog (),
- NULL, NULL, NULL, NULL);
-
- page->page->display(page->gfx);
-
- page->text_dev->endPage();
- }
-
- return page->text_dev;
-}
-#endif /* !defined (HAVE_CAIRO) */
-
-#if defined (HAVE_CAIRO)
-
static TextPage *
poppler_page_get_text_page (PopplerPage *page)
{
@@ -409,125 +373,6 @@ poppler_page_set_selection_alpha (PopplerPage *page,
}
#endif /* POPPLER_WITH_GDK */
-#elif defined (HAVE_SPLASH) && defined (POPPLER_WITH_GDK)
-
-typedef struct {
-} OutputDevData;
-
-static void
-poppler_page_prepare_output_dev (PopplerPage *page,
- double scale,
- int rotation,
- gboolean transparent,
- OutputDevData *output_dev_data)
-{
- /* pft */
-}
-
-static void
-poppler_page_copy_to_pixbuf(PopplerPage *page,
- GdkPixbuf *pixbuf,
- OutputDevData *data)
-{
- SplashOutputDev *output_dev;
- SplashBitmap *bitmap;
- SplashColorPtr color_ptr;
- int splash_width, splash_height, splash_rowstride;
- int pixbuf_rowstride, pixbuf_n_channels;
- guchar *pixbuf_data, *dst;
- int x, y;
-
- output_dev = page->document->output_dev;
-
- bitmap = output_dev->getBitmap ();
- color_ptr = bitmap->getDataPtr ();
-
- splash_width = bitmap->getWidth ();
- splash_height = bitmap->getHeight ();
- splash_rowstride = bitmap->getRowSize ();
-
- pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
- pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
- if (splash_width > gdk_pixbuf_get_width (pixbuf))
- splash_width = gdk_pixbuf_get_width (pixbuf);
- if (splash_height > gdk_pixbuf_get_height (pixbuf))
- splash_height = gdk_pixbuf_get_height (pixbuf);
-
- SplashColorPtr pixel = new Guchar[4];
- for (y = 0; y < splash_height; y++)
- {
- dst = pixbuf_data + y * pixbuf_rowstride;
- for (x = 0; x < splash_width; x++)
- {
- output_dev->getBitmap()->getPixel(x, y, pixel);
- dst[0] = pixel[0];
- dst[1] = pixel[1];
- dst[2] = pixel[2];
- if (pixbuf_n_channels == 4)
- dst[3] = 0xff;
- dst += pixbuf_n_channels;
- }
- }
- delete [] pixel;
-}
-
-static void
-poppler_page_set_selection_alpha (PopplerPage *page,
- double scale,
- GdkPixbuf *pixbuf,
- PopplerSelectionStyle style,
- PopplerRectangle *selection)
-{
- GList *region, *l;
- gint x, y, width, height;
- int pixbuf_rowstride, pixbuf_n_channels;
- guchar *pixbuf_data, *dst;
-
- pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
- pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- if (pixbuf_n_channels != 4)
- return;
-
- for (y = 0; y < height; y++) {
- dst = pixbuf_data + y * pixbuf_rowstride;
- for (x = 0; x < width; x++) {
- dst[3] = 0x00;
- dst += pixbuf_n_channels;
- }
- }
-
- region = poppler_page_get_selection_region (page, scale, style, selection);
-
- for (l = region; l; l = g_list_next (l)) {
- PopplerRectangle *rectangle = (PopplerRectangle *)l->data;
- GdkRectangle rect;
-
- rect.x = (gint)rectangle->x1;
- rect.y = (gint)rectangle->y1;
- rect.width = (gint) (rectangle->x2 - rectangle->x1);
- rect.height = (gint) (rectangle->y2 - rectangle->y1);
-
- for (y = 0; y < rect.height; y++) {
- dst = pixbuf_data + (rect.y + y) * pixbuf_rowstride +
- rect.x * pixbuf_n_channels;
- for (x = 0; x < rect.width; x++) {
- dst[3] = 0xff;
- dst += pixbuf_n_channels;
- }
- }
- }
-
- poppler_page_selection_region_free (region);
-}
-
-#endif /* HAVE_SPLASH */
-
static GBool
poppler_print_annot_cb (Annot *annot, void *user_data)
{
@@ -536,8 +381,6 @@ poppler_print_annot_cb (Annot *annot, void *user_data)
return (annot->getType() == Annot::typeWidget);
}
-#if defined (HAVE_CAIRO)
-
static void
_poppler_page_render (PopplerPage *page,
cairo_t *cairo,
@@ -758,8 +601,6 @@ poppler_page_render_selection (PopplerPage *page,
output_dev->setCairo (NULL);
}
-#endif /* HAVE_CAIRO */
-
#ifdef POPPLER_WITH_GDK
static void
_poppler_page_render_to_pixbuf (PopplerPage *page,
@@ -922,6 +763,7 @@ poppler_page_render_selection_to_pixbuf (PopplerPage *page,
{
OutputDev *output_dev;
OutputDevData data;
+ TextPage *text;
SelectionStyle selection_style = selectionStyleGlyph;
PDFRectangle pdf_selection(selection->x1, selection->y1,
selection->x2, selection->y2);
@@ -958,30 +800,11 @@ poppler_page_render_selection_to_pixbuf (PopplerPage *page,
poppler_page_prepare_output_dev (page, scale, rotation, TRUE, &data);
-#if defined (HAVE_CAIRO)
- TextPage *text;
-
text = poppler_page_get_text_page (page);
text->drawSelection (output_dev, scale, rotation,
&pdf_selection, selection_style,
&gfx_glyph_color, &gfx_background_color);
-#else
- TextOutputDev *text_dev;
- text_dev = poppler_page_get_text_output_dev (page);
- text_dev->drawSelection (output_dev, scale, rotation,
- &pdf_selection, selection_style,
- &gfx_glyph_color, &gfx_background_color);
- /* We'll need a function to destroy page->text_dev and page->gfx
- * when the application wants to get rid of them.
- *
- * Two improvements: 1) make GfxFont refcounted and let TextPage and
- * friends hold a reference to the GfxFonts they need so we can free
- * up Gfx early. 2) use a TextPage directly when rendering the page
- * so we don't have to use TextOutputDev and render a second
- * time. */
-#endif
-
poppler_page_copy_to_pixbuf (page, pixbuf, &data);
poppler_page_set_selection_alpha (page, scale, pixbuf, style, selection);
@@ -1057,6 +880,7 @@ poppler_page_get_selection_region (PopplerPage *page,
PopplerRectangle *selection)
{
PDFRectangle poppler_selection;
+ TextPage *text;
SelectionStyle selection_style = selectionStyleGlyph;
GooList *list;
GList *region = NULL;
@@ -1080,20 +904,10 @@ poppler_page_get_selection_region (PopplerPage *page,
break;
}
-#if defined (HAVE_CAIRO)
- TextPage *text;
-
text = poppler_page_get_text_page (page);
list = text->getSelectionRegion(&poppler_selection,
selection_style, scale);
-#else
- TextOutputDev *text_dev;
-
- text_dev = poppler_page_get_text_output_dev (page);
- list = text_dev->getSelectionRegion(&poppler_selection,
- selection_style, scale);
-#endif
-
+
for (i = 0; i < list->getLength(); i++) {
PDFRectangle *selection_rect = (PDFRectangle *) list->get(i);
PopplerRectangle *rect;
@@ -1144,6 +958,7 @@ poppler_page_get_text (PopplerPage *page,
GooString *sel_text;
double height;
char *result;
+ TextPage *text;
SelectionStyle selection_style = selectionStyleGlyph;
PDFRectangle pdf_selection;
@@ -1169,18 +984,8 @@ poppler_page_get_text (PopplerPage *page,
break;
}
-#if defined (HAVE_CAIRO)
- TextPage *text;
-
text = poppler_page_get_text_page (page);
sel_text = text->getSelectionText (&pdf_selection, selection_style);
-#else
- TextOutputDev *text_dev;
-
- text_dev = poppler_page_get_text_output_dev (page);
- sel_text = text_dev->getSelectionText (&pdf_selection, selection_style);
-#endif
-
result = g_strdup (sel_text->getCString ());
delete sel_text;
@@ -1207,23 +1012,12 @@ poppler_page_find_text (PopplerPage *page,
gunichar *ucs4;
glong ucs4_len;
double height;
-#if defined (HAVE_CAIRO)
TextPage *text_dev;
-#else
- TextOutputDev *text_dev;
-#endif
-
+
g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE);
g_return_val_if_fail (text != NULL, FALSE);
-#if defined (HAVE_CAIRO)
text_dev = poppler_page_get_text_page (page);
-#else
- text_dev = new TextOutputDev (NULL, gTrue, gFalse, gFalse);
- page->page->display (text_dev, 72, 72, 0,
- gFalse, gTrue, gFalse,
- page->document->doc->getCatalog());
-#endif
ucs4 = g_utf8_to_ucs4_fast (text, -1, &ucs4_len);
poppler_page_get_size (page, NULL, &height);
@@ -1246,17 +1040,11 @@ poppler_page_find_text (PopplerPage *page,
matches = g_list_prepend (matches, match);
}
-#if !defined (HAVE_CAIRO)
- delete text_dev;
-#endif
-
g_free (ucs4);
return g_list_reverse (matches);
}
-#if defined (HAVE_CAIRO)
-
static CairoImageOutputDev *
poppler_page_get_image_output_dev (PopplerPage *page,
GBool (*imgDrawDeviceCbk)(int img_id, void *data),
@@ -1397,21 +1185,6 @@ poppler_page_free_image_mapping (GList *list)
g_list_free (list);
}
-#else /* HAVE_CAIRO */
-
-GList *
-poppler_page_get_image_mapping (PopplerPage *page)
-{
- return NULL;
-}
-
-void
-poppler_page_free_image_mapping (GList *list)
-{
-}
-
-#endif /* HAVE_CAIRO */
-
/**
* poppler_page_render_to_ps:
* @page: a #PopplerPage
diff --git a/glib/poppler-page.h b/glib/poppler-page.h
index 9351048..20dc20f 100644
--- a/glib/poppler-page.h
+++ b/glib/poppler-page.h
@@ -27,10 +27,7 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#endif
-
-#ifdef POPPLER_HAS_CAIRO
#include <cairo.h>
-#endif
G_BEGIN_DECLS
@@ -71,7 +68,6 @@ void poppler_page_render_selection_to_pixbuf (
GdkColor *background_color);
#endif /* POPPLER_WITH_GDK */
-#ifdef POPPLER_HAS_CAIRO
void poppler_page_render (PopplerPage *page,
cairo_t *cairo);
void poppler_page_render_for_printing (PopplerPage *page,
@@ -84,7 +80,6 @@ void poppler_page_render_selection (PopplerPage *pa
PopplerSelectionStyle style,
PopplerColor *glyph_color,
PopplerColor *background_color);
-#endif /* POPPLER_HAS_CAIRO */
void poppler_page_get_size (PopplerPage *page,
double *width,
@@ -111,10 +106,8 @@ GList *poppler_page_get_link_mapping (PopplerPage *pa
void poppler_page_free_link_mapping (GList *list);
GList *poppler_page_get_image_mapping (PopplerPage *page);
void poppler_page_free_image_mapping (GList *list);
-#ifdef POPPLER_HAS_CAIRO
cairo_surface_t *poppler_page_get_image (PopplerPage *page,
gint image_id);
-#endif /* POPPLER_HAS_CAIRO */
GList *poppler_page_get_form_field_mapping (PopplerPage *page);
void poppler_page_free_form_field_mapping (GList *list);
GList *poppler_page_get_annot_mapping (PopplerPage *page);
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
index a41742c..ed36a86 100644
--- a/glib/poppler-private.h
+++ b/glib/poppler-private.h
@@ -11,12 +11,7 @@
#include <TextOutputDev.h>
#include <Catalog.h>
#include <OptionalContent.h>
-
-#if defined (HAVE_CAIRO)
#include <CairoOutputDev.h>
-#elif defined (HAVE_SPLASH)
-#include <SplashOutputDev.h>
-#endif
struct _PopplerDocument
{
@@ -25,11 +20,7 @@ struct _PopplerDocument
GList *layers;
GList *layers_rbgroups;
-#if defined (HAVE_CAIRO)
CairoOutputDev *output_dev;
-#elif defined (HAVE_SPLASH)
- SplashOutputDev *output_dev;
-#endif
};
struct _PopplerPSFile
@@ -59,12 +50,7 @@ struct _PopplerPage
PopplerDocument *document;
Page *page;
int index;
-#if defined (HAVE_CAIRO)
TextPage *text;
-#else
- TextOutputDev *text_dev;
- Gfx *gfx;
-#endif
Annots *annots;
};
diff --git a/glib/poppler.cc b/glib/poppler.cc
index 3c1d503..cc2ca4d 100644
--- a/glib/poppler.cc
+++ b/glib/poppler.cc
@@ -39,13 +39,7 @@ GQuark poppler_error_quark (void)
PopplerBackend
poppler_get_backend (void)
{
-#if defined (HAVE_CAIRO)
return POPPLER_BACKEND_CAIRO;
-#elif defined (HAVE_SPLASH)
- return POPPLER_BACKEND_SPLASH;
-#else
- return POPPLER_BACKEND_UNKNOWN;
-#endif
}
static const char poppler_version[] = PACKAGE_VERSION;
diff --git a/glib/test-poppler-glib.cc b/glib/test-poppler-glib.cc
index e64000e..97a51cc 100644
--- a/glib/test-poppler-glib.cc
+++ b/glib/test-poppler-glib.cc
@@ -538,20 +538,18 @@ int main (int argc, char *argv[])
for (l = list; l != NULL; l = l->next)
{
PopplerImageMapping *mapping;
-#if defined (HAVE_CAIRO)
cairo_surface_t *image;
-#endif
+
mapping = (PopplerImageMapping *)l->data;
printf ("\t\t(%f, %f) - (%f, %f)\n",
mapping->area.x1,
mapping->area.y1,
mapping->area.x2,
mapping->area.y2);
-#if defined (HAVE_CAIRO)
+
image = poppler_page_get_image (page, mapping->image_id);
printf ("\t\tImage: %p\n", image);
cairo_surface_destroy (image);
-#endif
}
poppler_page_free_image_mapping (list);
diff --git a/poppler-glib.pc.in b/poppler-glib.pc.in
index 2b79945..b3d145f 100644
--- a/poppler-glib.pc.in
+++ b/poppler-glib.pc.in
@@ -6,7 +6,7 @@ includedir=@includedir@
Name: poppler-glib
Description: GLib wrapper for poppler
Version: @VERSION@
-Requires: @PC_REQUIRES@ gobject-2.0 gdk-2.0 gdk-pixbuf-2.0 @CAIRO_REQ@
+Requires: poppler-cairo = @VERSION@ @GLIB_REQ@ @GDK_REQ@
@PC_REQUIRES_PRIVATE@
Libs: -L${libdir} -lpoppler-glib
More information about the poppler
mailing list