Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-page-cache.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2005-07-29 16:02:28 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-07-29 16:02:28 (GMT)
commit41229e9ef5135c93176acb6320f96abc7d624b0a (patch)
treef071ff5a68f1509869a937e6e42a61f0e53fb821 /shell/ev-page-cache.c
parent646b17b09453da438218e6b86a2b8b830e5b73c0 (diff)
Use rotation rather than orientation. It's easier and enough for our
2005-07-29 Marco Pesenti Gritti <mpg@redhat.com> * backend/ev-document-thumbnails.c: (ev_document_thumbnails_get_thumbnail): * backend/ev-document-thumbnails.h: * backend/ev-document.c: * backend/ev-document.h: * backend/ev-render-context.c: (ev_render_context_new), (ev_render_context_set_rotation): * backend/ev-render-context.h: * pdf/ev-poppler.cc: * ps/ps-document.c: (ps_document_document_iface_init): * shell/ev-jobs.c: (ev_job_thumbnail_new), (ev_job_thumbnail_run): * shell/ev-jobs.h: * shell/ev-page-cache.c: (build_height_to_page), (ev_page_cache_new), (ev_page_cache_get_size), (ev_page_cache_get_max_width), (ev_page_cache_get_max_height), (ev_page_cache_get_height_to_page): * shell/ev-page-cache.h: * shell/ev-pixbuf-cache.c: (check_job_size_and_unref), (add_job_if_needed), (ev_pixbuf_cache_add_jobs_if_needed), (ev_pixbuf_cache_set_page_range), (new_selection_pixbuf_needed), (ev_pixbuf_cache_get_selection_pixbuf): * shell/ev-pixbuf-cache.h: * shell/ev-print-job.c: (idle_print_handler): * shell/ev-sidebar-thumbnails.c: (add_range): * shell/ev-view.c: (view_update_range_and_current_page), (get_page_y_offset), (get_page_extents), (ev_view_size_request_continuous_dual_page), (ev_view_size_request_continuous), (ev_view_size_request_dual_page), (ev_view_size_request_single_page), (draw_one_page), (ev_view_set_rotation), (ev_view_rotate_right), (ev_view_rotate_left), (ev_view_zoom_for_size_presentation), (ev_view_zoom_for_size_continuous_and_dual_page), (ev_view_zoom_for_size_continuous), (ev_view_zoom_for_size_dual_page), (ev_view_zoom_for_size_single_page), (compute_new_selection_text), (ev_view_select_all): * thumbnailer/evince-thumbnailer.c: (evince_thumbnail_pngenc_get): * tiff/tiff-document.c: (tiff_document_render_pixbuf), (tiff_document_document_iface_init), (tiff_document_thumbnails_get_thumbnail): Use rotation rather than orientation. It's easier and enough for our needs.
Diffstat (limited to 'shell/ev-page-cache.c')
-rw-r--r--shell/ev-page-cache.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/shell/ev-page-cache.c b/shell/ev-page-cache.c
index 1b0f8e4..d7aa03d 100644
--- a/shell/ev-page-cache.c
+++ b/shell/ev-page-cache.c
@@ -33,7 +33,7 @@ struct _EvPageCache
double* height_to_page;
double* dual_height_to_page;
- EvOrientation orientation;
+ int rotation;
EvPageCacheInfo *size_cache;
EvDocumentInfo *page_info;
@@ -111,8 +111,8 @@ build_height_to_page (EvPageCache *page_cache)
double uniform_height, page_height, next_page_height;
double saved_height;
- swap = (page_cache->orientation == EV_ORIENTATION_LANDSCAPE ||
- page_cache->orientation == EV_ORIENTATION_SEASCAPE);
+ swap = (page_cache->rotation == 90 ||
+ page_cache->rotation == 270);
g_free (page_cache->height_to_page);
g_free (page_cache->dual_height_to_page);
@@ -130,7 +130,7 @@ build_height_to_page (EvPageCache *page_cache)
}
page_cache->height_to_page [i] = (i + 1) * uniform_height;
} else {
- if (swap) {
+ if (!swap) {
page_height = page_cache->size_cache [i].height;
} else {
page_height = page_cache->size_cache [i].width;
@@ -186,7 +186,6 @@ ev_page_cache_new (EvDocument *document)
/* Assume all pages are the same size until proven otherwise */
page_cache->uniform = TRUE;
page_cache->has_labels = FALSE;
- page_cache->orientation = ev_document_get_orientation (document);
page_cache->n_pages = ev_document_get_n_pages (document);
page_cache->page_labels = g_new0 (char *, page_cache->n_pages);
page_cache->max_width = 0;
@@ -363,7 +362,7 @@ ev_page_cache_get_title (EvPageCache *page_cache)
void
ev_page_cache_get_size (EvPageCache *page_cache,
gint page,
- EvOrientation orientation,
+ gint rotation,
gfloat scale,
gint *width,
gint *height)
@@ -387,8 +386,7 @@ ev_page_cache_get_size (EvPageCache *page_cache,
*height = info->height;
}
- if (orientation == EV_ORIENTATION_PORTRAIT ||
- orientation == EV_ORIENTATION_UPSIDEDOWN) {
+ if (rotation == 0 || rotation == 180) {
if (width)
*width = (int) ((*width) * scale + 0.5);
if (height)
@@ -403,15 +401,14 @@ ev_page_cache_get_size (EvPageCache *page_cache,
void
ev_page_cache_get_max_width (EvPageCache *page_cache,
- EvOrientation orientation,
+ gint rotation,
gfloat scale,
gint *width)
{
g_return_if_fail (EV_IS_PAGE_CACHE (page_cache));
if (width) {
- if (orientation == EV_ORIENTATION_PORTRAIT ||
- orientation == EV_ORIENTATION_UPSIDEDOWN) {
+ if (rotation == 0 || rotation == 180) {
*width = page_cache->max_width * scale;
} else {
*width = page_cache->max_height * scale;
@@ -421,15 +418,14 @@ ev_page_cache_get_max_width (EvPageCache *page_cache,
void
ev_page_cache_get_max_height (EvPageCache *page_cache,
- EvOrientation orientation,
+ gint rotation,
gfloat scale,
gint *height)
{
g_return_if_fail (EV_IS_PAGE_CACHE (page_cache));
if (height) {
- if (orientation == EV_ORIENTATION_PORTRAIT ||
- orientation == EV_ORIENTATION_UPSIDEDOWN) {
+ if (rotation == 0 || rotation == 180) {
*height = page_cache->max_height * scale;
} else {
*height = page_cache->max_width * scale;
@@ -440,7 +436,7 @@ ev_page_cache_get_max_height (EvPageCache *page_cache,
void
ev_page_cache_get_height_to_page (EvPageCache *page_cache,
gint page,
- EvOrientation orientation,
+ gint rotation,
gfloat scale,
gint *height,
gint *dual_height)
@@ -450,8 +446,8 @@ ev_page_cache_get_height_to_page (EvPageCache *page_cache,
g_return_if_fail (EV_IS_PAGE_CACHE (page_cache));
- if (page_cache->orientation != orientation) {
- page_cache->orientation = orientation;
+ if (page_cache->rotation != rotation) {
+ page_cache->rotation = rotation;
build_height_to_page (page_cache);
}