[poppler] poppler/glib: poppler-page.cc,1.25,1.26

Kristian Hogsberg krh at freedesktop.org
Fri Jul 8 03:19:40 EST 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv28942/glib

Modified Files:
	poppler-page.cc 
Log Message:
2005-07-07  Kristian Høgsberg  <krh at redhat.com>

        * glib/poppler-page.cc (poppler_page_prepare_output_dev): Account
        for page rotation when creating the cairo surface.



Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- poppler-page.cc	7 Jul 2005 15:58:44 -0000	1.25
+++ poppler-page.cc	7 Jul 2005 17:19:38 -0000	1.26
@@ -179,9 +179,22 @@
   int cairo_width, cairo_height, cairo_rowstride;
   unsigned char *cairo_data;
 
+  switch (page->orientation) {
+  case POPPLER_ORIENTATION_PORTRAIT:
+  case POPPLER_ORIENTATION_UPSIDEDOWN:
+    cairo_width = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
+    cairo_height = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
+    break;
+  case POPPLER_ORIENTATION_LANDSCAPE:
+  case POPPLER_ORIENTATION_SEASCAPE:
+    cairo_width = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
+    cairo_height = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
+    break;
+  default:
+    g_assert_not_reached();
+  }
+
   output_dev = page->document->output_dev;
-  cairo_width = MAX ((int)(page->page->getWidth() * scale + 0.5), 1);
-  cairo_height = MAX ((int)(page->page->getHeight() * scale + 0.5), 1);
   cairo_rowstride = cairo_width * 4;
   cairo_data = (guchar *) gmalloc (cairo_height * cairo_rowstride);
   if (transparent)



More information about the poppler mailing list