Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew S. Wilson <msw@rpath.com>2005-07-02 14:49:23 (GMT)
committer Matt Wilson <msw@src.gnome.org>2005-07-02 14:49:23 (GMT)
commitde3612f2a4b46b555edc50ca344a04bc3a8f7280 (patch)
tree7db89d71b02de917361995df7112ca65496feb97
parent1b167536f9277df8953cc30a531c1c17eab10382 (diff)
scale the reported height by using the resolution aspect ratio
2005-07-02 Matthew S. Wilson <msw@rpath.com> * 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
-rw-r--r--ChangeLog7
-rw-r--r--tiff/tiff-document.c21
2 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0afe222..2da4d9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-02 Matthew S. Wilson <msw@rpath.com>
+
+ * 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 <nshmyrev@yandex.ru>
* configure.ac:
diff --git a/tiff/tiff-document.c b/tiff/tiff-document.c
index f2ed498..3324e7d 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);