- if (width)
- *width = ddjvu_page_get_width (d_page) * SCALE_FACTOR;
- if (height)
- *height = ddjvu_page_get_height (d_page) * SCALE_FACTOR;
-
- ddjvu_page_release (d_page);
+ if (djvu_document->orientation == EV_ORIENTATION_PORTRAIT ||
+ djvu_document->orientation == EV_ORIENTATION_UPSIDEDOWN) {
+ *width = info.width * SCALE_FACTOR;
+ *height = info.height * SCALE_FACTOR;
+ } else {
+ *width = info.height * SCALE_FACTOR;
+ *height = info.width * SCALE_FACTOR;
+ }
+}
+
+static GdkPixbuf *
+rotate_pixbuf (EvDocument *document, GdkPixbuf *pixbuf)
+{
+ DjvuDocument *djvu_document = DJVU_DOCUMENT (document);
+
+ switch (djvu_document->orientation)
+ {
+ case EV_ORIENTATION_LANDSCAPE:
+ return gdk_pixbuf_rotate_simple (pixbuf, 90);
+ case EV_ORIENTATION_UPSIDEDOWN:
+ return gdk_pixbuf_rotate_simple (pixbuf, 180);
+ case EV_ORIENTATION_SEASCAPE:
+ return gdk_pixbuf_rotate_simple (pixbuf, 270);
+ default:
+ return g_object_ref (pixbuf);
+ }