]> www.fi.muni.cz Git - evince.git/commitdiff
add page_[xy]_offset fields.
authorMartin Kretzschmar <martink@src.gnome.org>
Fri, 21 Jan 2005 13:29:36 +0000 (13:29 +0000)
committerMartin Kretzschmar <martink@src.gnome.org>
Fri, 21 Jan 2005 13:29:36 +0000 (13:29 +0000)
* ps/ps-document.h: add page_[xy]_offset fields.

* ps/ps-document.c (ps_document_set_page_offset)
(ps_document_render): Keep offset in consideration in a few
places. Bug #164752 "postscript documents are not centered in
window"

ChangeLog
ps/ps-document.c
ps/ps-document.h

index 7c1eb159f2a5a610886867cf2320e1ebdbf88d37..b6f5f5bf3e00907c89f5e31fbeff03876c1ab032 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2005-01-21  Martin Kretzschmar  <martink@gnome.org>
 
+       * ps/ps-document.h: add page_[xy]_offset fields.
+
+       * ps/ps-document.c (ps_document_set_page_offset)
+       (ps_document_render): Keep offset in consideration in a few
+       places. Bug #164752 "postscript documents are not centered in
+       window"
+
        * data/evince.desktop.in (X-GNOME-Bugzilla-Product):
        s/gpdf/evince/. Spotted by Stephane Loeuillet.
 
index 6723edb6312f3f35c73d39cd7006ccb17e43697b..848d1a7075f890939648ff9c5b2b77c812e57ebf 100644 (file)
@@ -1773,6 +1773,10 @@ ps_document_set_page_offset (EvDocument  *document,
                              int          x,
                              int          y)
 {
+       PSDocument *gs = PS_DOCUMENT (document);
+
+       gs->page_x_offset = x;
+       gs->page_y_offset = y;
 }
 
 static void
@@ -1799,6 +1803,8 @@ ps_document_render (EvDocument  *document,
                    int          clip_height)
 {
        PSDocument *gs = PS_DOCUMENT (document);
+       GdkRectangle page;
+       GdkRectangle draw;
        GdkGC *gc;
 
        if (gs->pstarget == NULL ||
@@ -1806,13 +1812,23 @@ ps_document_render (EvDocument  *document,
                return;
        }
 
+       page.x = gs->page_x_offset;
+       page.y = gs->page_y_offset;
+       page.width = gs->width;
+       page.height = gs->height;
+
+       draw.x = clip_x;
+       draw.y = clip_y;
+       draw.width = clip_width;
+       draw.height = clip_height;
+
        gc = gdk_gc_new (gs->pstarget);
 
        gdk_draw_drawable (gs->pstarget, gc,
                           gs->bpixmap,
-                          clip_x, clip_y,
-                          clip_x, clip_y,
-                          clip_width, clip_height);
+                          draw.x - page.x, draw.y - page.y,
+                          draw.x, draw.y,
+                          draw.width, draw.height);
 
        g_object_unref (gc);
 }
index dd5555ed6947a2d22e1c3c67e045aac53620fa6c..fb58ca4b89fda3b288525644f5d8b3cd5c7e11ef 100644 (file)
@@ -107,6 +107,9 @@ struct _PSDocument {
   const gchar *gs_status;       /* PSDocument status */
 
   guint avail_w, avail_h;
+
+  int page_x_offset;
+  int page_y_offset;
 };
 
 struct _PSDocumentClass {