From: Matthew S. Wilson Date: Sat, 2 Jul 2005 14:49:23 +0000 (+0000) Subject: scale the reported height by using the resolution aspect ratio X-Git-Tag: EVINCE_0_3_3~187 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=de3612f2a4b46b555edc50ca344a04bc3a8f7280;p=evince.git scale the reported height by using the resolution aspect ratio 2005-07-02 Matthew S. Wilson * tiff/tiff-document.c (tiff_document_get_page_size): scale the reported height by using the resolution aspect ratio (tiff_document_render_pixbuf): scale the pixbuf using the resolution aspect ratio --- diff --git a/ChangeLog b/ChangeLog index 0afe222c..2da4d9a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-02 Matthew S. Wilson + + * tiff/tiff-document.c (tiff_document_get_page_size): scale the + reported height by using the resolution aspect ratio + (tiff_document_render_pixbuf): scale the pixbuf using the + resolution aspect ratio + 2005-07-01 Nickolay V. Shmyrev * configure.ac: diff --git a/tiff/tiff-document.c b/tiff/tiff-document.c index f2ed4986..3324e7d1 100644 --- a/tiff/tiff-document.c +++ b/tiff/tiff-document.c @@ -90,7 +90,7 @@ tiff_document_load (EvDocument *document, if (tiff) { guint32 w, h; - + /* FIXME: unused data? why bother here */ TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h); } @@ -143,6 +143,7 @@ tiff_document_get_page_size (EvDocument *document, double *height) { guint32 w, h; + gfloat x_res, y_res; TiffDocument *tiff_document = TIFF_DOCUMENT (document); g_return_if_fail (TIFF_IS_DOCUMENT (document)); @@ -157,6 +158,9 @@ tiff_document_get_page_size (EvDocument *document, TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGELENGTH, &h); + TIFFGetField (tiff_document->tiff, TIFFTAG_XRESOLUTION, &x_res); + TIFFGetField (tiff_document->tiff, TIFFTAG_YRESOLUTION, &y_res); + h = h * (x_res / y_res); if (tiff_document->orientation == EV_ORIENTATION_PORTRAIT || tiff_document->orientation == EV_ORIENTATION_UPSIDEDOWN) { @@ -210,6 +214,7 @@ tiff_document_render_pixbuf (EvDocument *document, { TiffDocument *tiff_document = TIFF_DOCUMENT (document); int width, height; + float x_res, y_res; gint rowstride, bytes; guchar *pixels = NULL; GdkPixbuf *pixbuf; @@ -238,6 +243,18 @@ tiff_document_render_pixbuf (EvDocument *document, return NULL; } + if (!TIFFGetField (tiff_document->tiff, TIFFTAG_XRESOLUTION, &x_res)) + { + pop_handlers (); + return NULL; + } + + if (! TIFFGetField (tiff_document->tiff, TIFFTAG_YRESOLUTION, &y_res)) + { + pop_handlers (); + return NULL; + } + pop_handlers (); /* Sanity check the doc */ @@ -268,7 +285,7 @@ tiff_document_render_pixbuf (EvDocument *document, scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf, width * rc->scale, - height * rc->scale, + height * rc->scale * (x_res/y_res), GDK_INTERP_BILINEAR); g_object_unref (pixbuf);