Bug 12028 fixed: The pair drawlater/drawnow did not work as expected 45/10045/3
Calixte DENIZET [Tue, 18 Dec 2012 11:17:16 +0000 (12:17 +0100)]
Change-Id: I88fc34b74461470eb2a650d01aca1f9d17cebf70

scilab/CHANGES_5.4.X
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/figure/Figure.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java

index d733558..88efd8d 100644 (file)
@@ -171,6 +171,8 @@ Bug fixes
 
 * Bug #12022 fixed - ftuneq had a bad example.
 
+* Bug #12028 fixed - The pair drawlater/drawnow did not work as expected.
+
 * Bug #12033 fixed - assert_checkalmostequal was failing with two %inf values.
 
 * Bug #12043 fixed - Fix a typo in the ATOMS module help pages.
index 197a8fe..4312ae3 100644 (file)
@@ -533,7 +533,7 @@ public class Figure extends GraphicObject {
         } else if (property == RenderingModeProperty.ANTIALIASING) {
             setAntialiasing((Integer) value);
         } else if (property == RenderingModeProperty.IMMEDIATEDRAWING) {
-            setImmediateDrawing((Boolean) value);
+            return setImmediateDrawing((Boolean) value);
         } else if (property == FigureProperty.BACKGROUND) {
             setBackground((Integer) value);
         } else if (property == EventHandlerProperty.EVENTHANDLER) {
@@ -876,8 +876,13 @@ public class Figure extends GraphicObject {
     /**
      * @param immediateDrawing the immediateDrawing to set
      */
-    public void setImmediateDrawing(Boolean immediateDrawing) {
-        renderingMode.immediateDrawing = immediateDrawing;
+    public UpdateStatus setImmediateDrawing(Boolean immediateDrawing) {
+       if (renderingMode.immediateDrawing != immediateDrawing) {
+           renderingMode.immediateDrawing = immediateDrawing;
+           return UpdateStatus.Success;
+       }
+
+       return UpdateStatus.NoChange;
     }
 
     /**
index 539bd55..b892872 100644 (file)
@@ -325,7 +325,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
 
     @Override
     public void visit(Arc arc) {
-        if (arc.isValid() && arc.getVisible()) {
+       if (arc.isValid() && arc.getVisible()) {
             axesDrawer.enableClipping(currentAxes, arc.getClipProperty());
             try {
                 contouredObjectDrawer.draw(arc, currentAxes.getViewAsEnum() == ViewType.VIEW_2D);
@@ -371,15 +371,14 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
 
     @Override
     public void visit(Figure figure) {
-        synchronized (figure) {
-            /** Set the current {@see ColorMap}. */
-            colorMap = figure.getColorMap();
-
-            drawingTools.clear(ColorFactory.createColor(colorMap, figure.getBackground()));
-            drawingTools.clearDepthBuffer();
-            if (figure.getVisible() && figure.getImmediateDrawing()) {
-                askAcceptVisitor(figure.getChildren());
-            }
+       synchronized (figure) {
+           /** Set the current {@see ColorMap}. */
+           colorMap = figure.getColorMap();
+           drawingTools.clear(ColorFactory.createColor(colorMap, figure.getBackground()));
+           drawingTools.clearDepthBuffer();
+           if (figure.getVisible() && figure.getImmediateDrawing()) {
+               askAcceptVisitor(figure.getChildren());
+           }
         }
     }
 
@@ -853,12 +852,16 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                 }
 
                 if (isImmediateDrawing(id)) {
-                    canvas.redraw();
+                   if (GraphicObjectProperties.__GO_IMMEDIATE_DRAWING__ == property) {
+                       canvas.redrawAndWait();
+                   } else {
+                       canvas.redraw();
+                   }
                 }
             }
 
             if (GraphicObjectProperties.__GO_IMMEDIATE_DRAWING__ == property && !isImmediateDrawing(id)) {
-                canvas.waitImage();
+               canvas.waitImage();
             }
 
         } catch (OutOfMemoryException e) {