summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:55:54 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:55:54 +0000
commitaffc5a1434de487ec79c44cf222e4bc2605460a3 (patch)
tree98d5d44a433227c8a515a3b6bec1fece54e0bf7a /pdf-over-gui/src/main/java/at
parent29ca5260d1ecba9a149661bf2988c6dcc3eeed4e (diff)
downloadpdf-over-affc5a1434de487ec79c44cf222e4bc2605460a3.tar.gz
pdf-over-affc5a1434de487ec79c44cf222e4bc2605460a3.tar.bz2
pdf-over-affc5a1434de487ec79c44cf222e4bc2605460a3.zip
don't use clip bounds to determine redraw area
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@45 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java
index 7792fa3f..f2852fcc 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java
@@ -34,11 +34,20 @@ import org.icepdf.core.exceptions.PDFSecurityException;
import org.icepdf.core.pobjects.Document;
import org.icepdf.core.pobjects.Page;
import org.icepdf.core.util.GraphicsRenderingHints;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.gui.workflow.states.PositioningState;
/**
* Displays a PDF document
*/
public class PDFViewerComposite extends Composite {
+ /**
+ * SFL4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(PDFViewerComposite.class);
/**
* PDF document
@@ -125,16 +134,17 @@ public class PDFViewerComposite extends Composite {
return;
int page = getPage();
// Make page always fit to window
- Rectangle2D clip = g.getClip().getBounds2D();
- double h_zoom = clip.getWidth() / PDFViewerComposite.this.base_dimensions[page].width;
- double v_zoom = clip.getHeight() / PDFViewerComposite.this.base_dimensions[page].height;
+ Dimension d = getSize();
+ double h_zoom = d.getWidth() / PDFViewerComposite.this.base_dimensions[page].width;
+ double v_zoom = d.getHeight() / PDFViewerComposite.this.base_dimensions[page].height;
float zoom = (float) (h_zoom < v_zoom ? h_zoom : v_zoom);
if (v_zoom < h_zoom)
{
// Page is narrower than window, center it
- g.translate((int) ((clip.getWidth() - (PDFViewerComposite.this.base_dimensions[page].width * zoom)) / 2), 0);
+ g.translate((int) ((d.width - (PDFViewerComposite.this.base_dimensions[page].width * zoom)) / 2), 0);
}
+ log.debug("Repainting " + g.getClipBounds().width + "x" + g.getClipBounds().height + " - " + d.width + "x" + d.height);
PDFViewerComposite.this.document.paintPage(page, g, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0f, zoom);
}
};