Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2007-06-13 20:01:46 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2007-06-13 20:01:46 (GMT)
commit580b9668800e31ad8fe023b01f257635328c7807 (patch)
tree17f3eb41c2850bf2b3cd9cbf5311146ed2edb557
parentbeda935ce80b173f9430de092f5b9d0551bf7196 (diff)
Fix rotation in djvu backend.
2007-06-13 Carlos Garcia Campos <carlosgc@gnome.org> * backend/djvu/djvu-document.c: (djvu_document_render): Fix rotation in djvu backend. svn path=/trunk/; revision=2504
-rw-r--r--ChangeLog6
-rw-r--r--backend/djvu/djvu-document.c38
2 files changed, 35 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index c27b3a1..71ff016 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2007-06-13 Carlos Garcia Campos <carlosgc@gnome.org>
+ * backend/djvu/djvu-document.c: (djvu_document_render):
+
+ Fix rotation in djvu backend.
+
+2007-06-13 Carlos Garcia Campos <carlosgc@gnome.org>
+
* shell/ev-pixbuf-cache.c: (job_finished_cb),
(ev_pixbuf_cache_get_surface), (ev_pixbuf_cache_get_link_mapping),
(ev_pixbuf_cache_get_image_mapping),
diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c
index a8f0425..88c6bc8 100644
--- a/backend/djvu/djvu-document.c
+++ b/backend/djvu/djvu-document.c
@@ -216,13 +216,14 @@ djvu_document_render (EvDocument *document,
EvRenderContext *rc)
{
DjvuDocument *djvu_document = DJVU_DOCUMENT (document);
- cairo_surface_t *surface, *rotated_surface;
+ cairo_surface_t *surface;
gchar *pixels;
gint rowstride;
ddjvu_rect_t rrect;
ddjvu_rect_t prect;
ddjvu_page_t *d_page;
- double page_width, page_height;
+ ddjvu_page_rotation_t rotation;
+ double page_width, page_height, tmp;
static const cairo_user_data_key_t key;
d_page = ddjvu_page_create_by_pageno (djvu_document->d_document, rc->page);
@@ -232,6 +233,29 @@ djvu_document_render (EvDocument *document,
page_width = ddjvu_page_get_width (d_page) * rc->scale * SCALE_FACTOR + 0.5;
page_height = ddjvu_page_get_height (d_page) * rc->scale * SCALE_FACTOR + 0.5;
+
+ switch (rc->rotation) {
+ case 90:
+ rotation = DDJVU_ROTATE_90;
+ tmp = page_height;
+ page_height = page_width;
+ page_width = tmp;
+
+ break;
+ case 180:
+ rotation = DDJVU_ROTATE_180;
+
+ break;
+ case 270:
+ rotation = DDJVU_ROTATE_270;
+ tmp = page_height;
+ page_height = page_width;
+ page_width = tmp;
+
+ break;
+ default:
+ rotation = DDJVU_ROTATE_0;
+ }
rowstride = page_width * 4;
pixels = (gchar *) g_malloc (page_height * rowstride);
@@ -248,6 +272,8 @@ djvu_document_render (EvDocument *document,
prect.h = page_height;
rrect = prect;
+ ddjvu_page_set_rotation (d_page, rotation);
+
ddjvu_page_render (d_page, DDJVU_RENDER_COLOR,
&prect,
&rrect,
@@ -255,13 +281,7 @@ djvu_document_render (EvDocument *document,
rowstride,
pixels);
- rotated_surface = ev_document_misc_surface_rotate_and_scale (surface,
- page_width,
- page_height,
- rc->rotation);
- cairo_surface_destroy (surface);
-
- return rotated_surface;
+ return surface;
}
static void