]> www.fi.muni.cz Git - evince.git/blobdiff - backend/tiff/tiff-document.c
Update Vietnamese translation
[evince.git] / backend / tiff / tiff-document.c
index 34275c13d3886ba92b0000f27a360734362fa243..146e45539e78b3eec6c65749844c6e54b5d592a7 100644 (file)
 /* FIXME: Should probably buffer calls to libtiff with TIFFSetWarningHandler
  */
 
+#include "config.h"
+
+#include <config.h>
 #include <stdio.h>
 #include <glib.h>
+#include <glib/gi18n.h>
 
 #include "tiffio.h"
 #include "tiff2ps.h"
@@ -29,6 +33,7 @@
 #include "ev-document-misc.h"
 #include "ev-document-thumbnails.h"
 #include "ev-file-exporter.h"
+#include "ev-file-helpers.h"
 
 struct _TiffDocumentClass
 {
@@ -52,13 +57,12 @@ static void tiff_document_document_iface_init (EvDocumentIface *iface);
 static void tiff_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
 static void tiff_document_document_file_exporter_iface_init (EvFileExporterIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (TiffDocument, tiff_document, G_TYPE_OBJECT,
-                         { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT,
-                                                 tiff_document_document_iface_init);
-                          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_REGISTER_WITH_CODE (TiffDocument, tiff_document,
+                        {
+                          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;
@@ -211,9 +215,6 @@ tiff_document_render (EvDocument      *document,
        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;
@@ -245,11 +246,15 @@ tiff_document_render (EvDocument      *document,
        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 */