From: Marco Pesenti Gritti Date: Fri, 17 Jun 2005 14:18:04 +0000 (+0000) Subject: Add a flag to check if orientation has been overriden X-Git-Tag: EVINCE_0_3_3~235 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=cbb8cbc64ce1a462ef98959357772c6dfdc4ec46;p=evince.git Add a flag to check if orientation has been overriden 2005-06-17 Marco Pesenti Gritti * pdf/ev-poppler.cc: Add a flag to check if orientation has been overriden --- diff --git a/ChangeLog b/ChangeLog index 33594657..c07ae985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-17 Marco Pesenti Gritti + + * pdf/ev-poppler.cc: + + Add a flag to check if orientation has been overriden + 2005-06-17 Martin Kretzschmar * ps/ps.c (psscan, psfree): read "Creator:" comment, free creator diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc index 0f9a3562..78475da5 100644 --- a/pdf/ev-poppler.cc +++ b/pdf/ev-poppler.cc @@ -57,6 +57,7 @@ struct _PdfDocument gchar *password; PopplerOrientation orientation; + gboolean orientation_set; PopplerFontInfo *font_info; PopplerFontsIter *fonts_iter; @@ -128,7 +129,6 @@ static void pdf_document_init (PdfDocument *pdf_document) { pdf_document->password = NULL; - pdf_document->orientation = POPPLER_ORIENTATION_PORTRAIT; } static void @@ -210,8 +210,6 @@ pdf_document_load (EvDocument *document, return FALSE; } - pdf_document->orientation = get_document_orientation (pdf_document); - return TRUE; } @@ -221,6 +219,15 @@ pdf_document_get_n_pages (EvDocument *document) return poppler_document_get_n_pages (PDF_DOCUMENT (document)->document); } +/* FIXME This should not be necessary, poppler should rember it */ +static void +set_page_orientation (PdfDocument *pdf_document, PopplerPage *page) +{ + if (pdf_document->orientation_set) { + poppler_page_set_orientation (page, pdf_document->orientation); + } +} + static void pdf_document_get_page_size (EvDocument *document, int page, @@ -231,7 +238,7 @@ pdf_document_get_page_size (EvDocument *document, PopplerPage *poppler_page; poppler_page = poppler_document_get_page (pdf_document->document, page); - poppler_page_set_orientation (poppler_page, pdf_document->orientation); + set_page_orientation (pdf_document, poppler_page); poppler_page_get_size (poppler_page, width, height); } @@ -305,7 +312,7 @@ pdf_document_render_pixbuf (EvDocument *document, pdf_document = PDF_DOCUMENT (document); poppler_page = poppler_document_get_page (pdf_document->document, page); - poppler_page_set_orientation (poppler_page, pdf_document->orientation); + set_page_orientation (pdf_document, poppler_page); poppler_page_get_size (poppler_page, &width_points, &height_points); width = (int) ((width_points * scale) + 0.5); @@ -514,6 +521,10 @@ pdf_document_get_orientation (EvDocument *document) { EvOrientation result; PdfDocument *pdf_document = PDF_DOCUMENT (document); + + if (!pdf_document->orientation_set) { + pdf_document->orientation = get_document_orientation (pdf_document); + } switch (pdf_document->orientation) { case POPPLER_ORIENTATION_PORTRAIT: