From 8ed8c7ff59cf052aaab1fbe07deca55aa1dcacc0 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 3 Aug 2022 14:09:46 +0200 Subject: exterminate SignaturePlaceholderCache (it does not offer any measurable benefit) --- .../java/at/asit/pdfover/gui/composites/PositioningComposite.java | 5 ++--- .../main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 7 ++++--- .../gui/composites/configuration/SimpleConfigurationComposite.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index d9263d72..1336d7b6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -187,12 +187,11 @@ public class PositioningComposite extends StateComposite { * @param transparency * transparency of the signature placeholder (0 - 255) */ - public void setPlaceholder(final Image placeholder, final int width, final int height, - final int transparency) { + public void setPlaceholder(final Image placeholder, final int transparency) { EventQueue.invokeLater(() -> { if (this.viewer == null) return; - this.viewer.setSignaturePlaceholder(placeholder, width, height, transparency); + this.viewer.setSignaturePlaceholder(placeholder, transparency); }); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 34837b2d..879a3e98 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -150,10 +150,11 @@ public class SignaturePanel extends JPanel { * @param height height of the placeholder in page space * @param transparency transparency of the signature placeholder (0 - 255) */ - public void setSignaturePlaceholder(Image placeholder, int width, int height, int transparency) { + public void setSignaturePlaceholder(Image placeholder, int transparency) { this.sigPlaceholder = placeholder; - this.sigPageWidth = width; - this.sigPageHeight = height; + // TODO figure out why this is divided by 4 (factor ported from old code) + this.sigPageWidth = placeholder.getWidth(null) / 4; + this.sigPageHeight = placeholder.getHeight(null) / 4; this.sigPlaceholderTransparency = transparency; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index 3d351292..34155668 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -15,6 +15,7 @@ */ package at.asit.pdfover.gui.composites.configuration; +import java.awt.image.BufferedImage; // Imports import java.io.File; import java.io.IOException; @@ -62,7 +63,6 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.utils.ImageConverter; -import at.asit.pdfover.gui.utils.SignaturePlaceholderCache; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory; import at.asit.pdfover.gui.workflow.states.State; @@ -434,7 +434,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { logo = new ImageData(image); param.emblem = new Emblem(image); } - img = SignaturePlaceholderCache.getSWTPlaceholder(param); + img = ImageConverter.convertToSWT((BufferedImage) param.getPlaceholder()); } catch (Exception e) { log.error("Failed to load image for display...", e); } -- cgit v1.2.3