]> www.fi.muni.cz Git - evince.git/blobdiff - backend/tiff/tiff-document.c
Fixes bug #542924. Makes enums static to fix Solaris build.
[evince.git] / backend / tiff / tiff-document.c
index d8bee9e529c0654d105011669dee450f59cf64c9..fc8f4aaad3af684f151739111c2291516c37e2d1 100644 (file)
@@ -59,10 +59,10 @@ static void tiff_document_document_file_exporter_iface_init (EvFileExporterIface
 
 EV_BACKEND_REGISTER_WITH_CODE (TiffDocument, tiff_document,
                         {
 
 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 TIFFErrorHandler orig_error_handler = NULL;
@@ -176,10 +176,10 @@ tiff_document_get_resolution (TiffDocument *tiff_document,
 }
 
 static void
 }
 
 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;
 {
        guint32 w, h;
        gfloat x_res, y_res;
@@ -189,7 +189,7 @@ tiff_document_get_page_size (EvDocument   *document,
        g_return_if_fail (tiff_document->tiff != NULL);
        
        push_handlers ();
        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;
        }
                pop_handlers ();
                return;
        }
@@ -223,7 +223,7 @@ tiff_document_render (EvDocument      *document,
        g_return_val_if_fail (tiff_document->tiff != NULL, NULL);
   
        push_handlers ();
        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;
        }
                pop_handlers ();
                return NULL;
        }
@@ -246,11 +246,15 @@ tiff_document_render (EvDocument      *document,
        if (width <= 0 || height <= 0)
                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;                
        rowstride = width * 4;
        if (rowstride / 4 != width)
                /* overflow */
                return NULL;                
-        
+#endif
+       
        bytes = height * rowstride;
        if (bytes / rowstride != height)
                /* overflow */
        bytes = height * rowstride;
        if (bytes / rowstride != height)
                /* overflow */
@@ -313,7 +317,7 @@ tiff_document_render_pixbuf (EvDocument      *document,
        GdkPixbuf *rotated_pixbuf;
        
        push_handlers ();
        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;
        }
                pop_handlers ();
                return NULL;
        }
@@ -478,7 +482,7 @@ tiff_document_file_exporter_do_page (EvFileExporter *exporter, EvRenderContext *
 
        if (document->ps_export_ctx == NULL)
                return;
 
        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);
                return;
        tiff2ps_process_page (document->ps_export_ctx, document->tiff,
                              0, 0, 0, 0, 0);