diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-08-24 17:06:10 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-08-24 17:06:10 +0000 |
commit | 58ecf0efcd7c83c8f8900b0a00d353af895e46a4 (patch) | |
tree | cd2b7717a95140708cc835fd6501d77d096f8ad5 /trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java | |
parent | 8c49a60c3aed0f8f36080eb4125d059c12ef8cf2 (diff) | |
download | pdf-over-58ecf0efcd7c83c8f8900b0a00d353af895e46a4.tar.gz pdf-over-58ecf0efcd7c83c8f8900b0a00d353af895e46a4.tar.bz2 pdf-over-58ecf0efcd7c83c8f8900b0a00d353af895e46a4.zip |
don't use clip bounds to determine redraw area
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12410 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java index 7792fa3f..f2852fcc 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PDFViewerComposite.java +++ b/trunk/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); } }; |