From 037502c88b1735030881f5700322727c0f453fcb Mon Sep 17 00:00:00 2001 From: Danilo Tomasoni Date: Thu, 15 Jun 2017 15:40:53 +0200 Subject: [PATCH 1/3] windowscalefactor default value --- core/src/processing/awt/PSurfaceAWT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java index 27c7b8e6be..521ba446a9 100644 --- a/core/src/processing/awt/PSurfaceAWT.java +++ b/core/src/processing/awt/PSurfaceAWT.java @@ -90,7 +90,7 @@ public class PSurfaceAWT extends PSurfaceNone { int sketchWidth; int sketchHeight; - int windowScaleFactor; + int windowScaleFactor = 1; public PSurfaceAWT(PGraphics graphics) { From 267ed63d126f0ce4b18b13b469843db000b96633 Mon Sep 17 00:00:00 2001 From: Danilo Tomasoni Date: Fri, 16 Jun 2017 15:38:46 +0200 Subject: [PATCH 2/3] render() should not be syncronized --- core/src/processing/awt/PSurfaceAWT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java index 521ba446a9..374b73e1c6 100644 --- a/core/src/processing/awt/PSurfaceAWT.java +++ b/core/src/processing/awt/PSurfaceAWT.java @@ -281,7 +281,7 @@ public void addNotify() { */ - synchronized protected void render() { + protected void render() { if (canvas.isDisplayable() && graphics.image != null) { if (canvas.getBufferStrategy() == null) { From 8a48286cb20208f9260125dc829d86c343ac4b11 Mon Sep 17 00:00:00 2001 From: Danilo Tomasoni Date: Fri, 16 Jun 2017 17:14:45 +0200 Subject: [PATCH 3/3] removed render() call in AWT events (it will be handled directly in animation thread) --- core/src/processing/awt/PSurfaceAWT.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java index 374b73e1c6..a0d4cdefce 100644 --- a/core/src/processing/awt/PSurfaceAWT.java +++ b/core/src/processing/awt/PSurfaceAWT.java @@ -228,7 +228,8 @@ public void validate() { oldSize = newSize; sketch.setSize(newSize.width / windowScaleFactor, newSize.height / windowScaleFactor); // try { - render(); + // DANILO TOMASONI: removed render here, it will be handled only by animation thread + //render(); // } catch (IllegalStateException ise) { // System.out.println(ise.getMessage()); // } @@ -247,7 +248,8 @@ public void update(Graphics g) { public void paint(Graphics screen) { // System.out.println("painting"); // if (useStrategy) { - render(); + // DANILO TOMASONI: removed render here, it will be handled only by animation thread + //render(); /* if (graphics != null) { System.out.println("drawing to screen " + canvas);