#include "config.h"
+#include <config.h>
#include <stdio.h>
#include <glib.h>
#include <glib/gi18n.h>
EV_BACKEND_REGISTER_WITH_CODE (TiffDocument, tiff_document,
{
- G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
- tiff_document_document_thumbnails_iface_init);
- G_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER,
- tiff_document_document_file_exporter_iface_init);
+ EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS,
+ tiff_document_document_thumbnails_iface_init);
+ EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_FILE_EXPORTER,
+ tiff_document_document_file_exporter_iface_init);
});
static TIFFErrorHandler orig_error_handler = NULL;
}
static void
-tiff_document_get_page_size (EvDocument *document,
- int page,
- double *width,
- double *height)
+tiff_document_get_page_size (EvDocument *document,
+ EvPage *page,
+ double *width,
+ double *height)
{
guint32 w, h;
gfloat x_res, y_res;
g_return_if_fail (tiff_document->tiff != NULL);
push_handlers ();
- if (TIFFSetDirectory (tiff_document->tiff, page) != 1) {
+ if (TIFFSetDirectory (tiff_document->tiff, page->index) != 1) {
pop_handlers ();
return;
}
gint rowstride, bytes;
guchar *pixels = NULL;
guchar *p;
- GdkPixbuf *pixbuf;
- GdkPixbuf *scaled_pixbuf;
- GdkPixbuf *rotated_pixbuf;
cairo_surface_t *surface;
cairo_surface_t *rotated_surface;
static const cairo_user_data_key_t key;
g_return_val_if_fail (tiff_document->tiff != NULL, NULL);
push_handlers ();
- if (TIFFSetDirectory (tiff_document->tiff, rc->page) != 1) {
+ if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) {
pop_handlers ();
return NULL;
}
if (width <= 0 || height <= 0)
return NULL;
+#ifdef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH
+ rowstride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width);
+#else
rowstride = width * 4;
if (rowstride / 4 != width)
/* overflow */
return NULL;
-
+#endif
+
bytes = height * rowstride;
if (bytes / rowstride != height)
/* overflow */
GdkPixbuf *rotated_pixbuf;
push_handlers ();
- if (TIFFSetDirectory (tiff_document->tiff, rc->page) != 1) {
+ if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) {
pop_handlers ();
return NULL;
}
if (document->ps_export_ctx == NULL)
return;
- if (TIFFSetDirectory (document->tiff, rc->page) != 1)
+ if (TIFFSetDirectory (document->tiff, rc->page->index) != 1)
return;
tiff2ps_process_page (document->ps_export_ctx, document->tiff,
0, 0, 0, 0, 0);