From 3d2364b1b7216bba1ca6ae54137c735aaa789668 Mon Sep 17 00:00:00 2001 From: Kenneth VanderLinde Date: Fri, 2 Sep 2022 17:20:56 -0700 Subject: [PATCH] Always size the BufferedImagePool to the ZoneRenderer size Rather than using the graphics clip to set a size for the image buffers, we now always size them to the component. This is better for performance as we destroy fewer buffers, and easily avoids clip-related bugs like #3583. --- .../net/rptools/maptool/client/ui/zone/ZoneRenderer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java b/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java index d091ee4063..ed68d61400 100644 --- a/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java +++ b/src/main/java/net/rptools/maptool/client/ui/zone/ZoneRenderer.java @@ -841,15 +841,16 @@ public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; timer.start("paintComponent:allocateBuffer"); - final var bounds = g2d.getClipBounds(); - tempBufferPool.setWidth(bounds.width); - tempBufferPool.setHeight(bounds.height); + tempBufferPool.setWidth(getSize().width); + tempBufferPool.setHeight(getSize().height); tempBufferPool.setConfiguration(g2d.getDeviceConfiguration()); timer.stop("paintComponent:allocateBuffer"); try (final var bufferHandle = tempBufferPool.acquire()) { final var buffer = bufferHandle.get(); final var bufferG2d = buffer.createGraphics(); + // Keep the clip so we don't render more than we have to. + bufferG2d.setClip(g2d.getClip()); timer.start("paintComponent:createView"); PlayerView pl = getPlayerView();