resizeCanvas bugfix patch

Hello there!



As posted here I’m attaching my patch for JME 2

http://www.jmonkeyengine.com/jmeforum/index.php?topic=9923.0



Index: src/com/jme/system/canvas/SimplePassCanvasImpl.java
===================================================================
--- src/com/jme/system/canvas/SimplePassCanvasImpl.java   (revision 4059)
+++ src/com/jme/system/canvas/SimplePassCanvasImpl.java   (working copy)
@@ -57,7 +57,6 @@
     protected Timer timer;
     protected float tpf;
     protected Camera cam;
-    protected int width, height;
 
     /**
      * This class should be subclasses - not directly instantiated.
Index: src/com/jme/system/canvas/JMECanvasImplementor.java
===================================================================
--- src/com/jme/system/canvas/JMECanvasImplementor.java   (revision 4059)
+++ src/com/jme/system/canvas/JMECanvasImplementor.java   (working copy)
@@ -51,6 +51,8 @@
    
     protected Renderer renderer;
 
+    protected int width, height;
+   
     public void doSetup() {
         setup = true;
     }
@@ -71,13 +73,16 @@
         this.renderer = renderer;
     }
 
-    public void resizeCanvas(int width, int height) {
-        final int fWidth = width <= 0 ? 1 : width;
-        final int fHeight = height <= 0 ? 1 : height;
+    public void resizeCanvas(int newWidth, int newHeight) {
+        final int fWidth = newWidth <= 0 ? 1 : newWidth;
+        final int fHeight = newHeight <= 0 ? 1 : newHeight;
         Callable<?> exe = new Callable<Object>() {
             public Object call() {
-                if (renderer != null)
+                if (renderer != null) {
                     renderer.reinit(fWidth, fHeight);
+                    height = fHeight;
+                    width = fWidth;
+                }
                 return null;
             }
         };
Index: src/com/jme/system/canvas/SimpleCanvasImpl.java
===================================================================
--- src/com/jme/system/canvas/SimpleCanvasImpl.java   (revision 4059)
+++ src/com/jme/system/canvas/SimpleCanvasImpl.java   (working copy)
@@ -59,8 +59,6 @@
 
     protected Camera cam;
 
-    protected int width, height;
-
     /**
      * This class should be subclasses - not directly instantiated.
      * @param width canvas width

tested and commited. Thanks mastershadow.