From 6dc52a44b625e7f43118fc754fe7997eef2b9dab Mon Sep 17 00:00:00 2001 From: Samuel GOUGEON Date: Wed, 17 Oct 2018 15:15:02 +0200 Subject: [PATCH] * Bug 15816 fixed: upstream drawlater ignored by polarplot, mesh, pie, contourf http://bugzilla.scilab.org/15816 // Test: clf drawlater polarplot() // the example must NOT be displayed. drawnow // Now it should be so, and only now. clf drawlater subplot(2,2,1); pie() subplot(2,2,2); mesh() subplot(2,2,3); contourf() drawnow // Now the whole figure must appear, and only now. Change-Id: I1169839d6c226950da793fbb06bc538d8884e218 --- scilab/CHANGES.md | 1 + scilab/modules/graphics/macros/contourf.sci | 6 ++++-- scilab/modules/graphics/macros/hist3d.sci | 7 ++++--- scilab/modules/graphics/macros/mesh.sci | 7 +++++-- scilab/modules/graphics/macros/paramfplot2d.sci | 4 +++- scilab/modules/graphics/macros/pie.sci | 7 +++++-- scilab/modules/graphics/macros/polarplot.sci | 7 +++++-- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 0154a65..6fde78a 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -626,6 +626,7 @@ Known issues * [#15796](http://bugzilla.scilab.org/show_bug.cgi?id=15796): Display after `mprintf("")` crashed Scilab (regression) * [#15809](http://bugzilla.scilab.org/show_bug.cgi?id=15809): HDF5 load/save was super slow for nested lists. * [#15814](http://bugzilla.scilab.org/show_bug.cgi?id=15814): Selecting graphic children with booleans yielded an error. +* [#15816](http://bugzilla.scilab.org/show_bug.cgi?id=15816): `polarplot()`, `pie()`, `mesh()` and `contourf()` ignored / canceled any upstream `drawlater`. * [#15818](http://bugzilla.scilab.org/show_bug.cgi?id=15818): `polarplot()` example could not be subplotted. `polarplot`'s demo did not display 'View code' and too often prompted the user. * [#15847](http://bugzilla.scilab.org/show_bug.cgi?id=15847): Scilab crashed at startup. * [#15854](http://bugzilla.scilab.org/show_bug.cgi?id=15854): `horner(1:$,4)` yielded an error. Extractions from `cblock` tables were impacted. diff --git a/scilab/modules/graphics/macros/contourf.sci b/scilab/modules/graphics/macros/contourf.sci index 93701a5..c6a97e9 100644 --- a/scilab/modules/graphics/macros/contourf.sci +++ b/scilab/modules/graphics/macros/contourf.sci @@ -177,6 +177,9 @@ function contourf(x, y, z, nv, style, strf, leg, rect, nax) min_nv=min(nv); max_nv=max(nv); + initDrawingMode = gcf().immediate_drawing; + gcf().immediate_drawing = "off"; + plot2d([min(xx);max(xx)],[min(yy);max(yy)],0,strf,leg,rect,nax); // Plot patches in order of decreasing size. This makes sure that @@ -191,7 +194,6 @@ function contourf(x, y, z, nv, style, strf, leg, rect, nax) H=[]; [FA,IA]=gsort(abs(Area)); - drawlater(); // postpone the drawing here ax = gca(); old_foreground = ax.foreground; pat = old_foreground; @@ -211,7 +213,7 @@ function contourf(x, y, z, nv, style, strf, leg, rect, nax) contour2d(xx,yy,zz,nv,style,"000",leg,rect,nax); end ax.foreground = old_foreground; - drawnow(); // draw all now! + gcf().immediate_drawing = initDrawingMode; endfunction diff --git a/scilab/modules/graphics/macros/hist3d.sci b/scilab/modules/graphics/macros/hist3d.sci index ffe7950..55f3fb1 100644 --- a/scilab/modules/graphics/macros/hist3d.sci +++ b/scilab/modules/graphics/macros/hist3d.sci @@ -43,7 +43,8 @@ function hist3d(f,theta,alpha,leg,flags,ebox) 6.6 6.7 8.6 10.3 13.6 16.2 18.1 18.0 16.0 13.0 9.4 7.0 12.0 0.6 1.3 3.7 5.5 9.6 13.1 16.2 16.0 12.8 8.8 3.8 1.8 7.8 ]; - drawlater + initDrawingMode = gcf().immediate_drawing; + gcf().immediate_drawing = "off"; hist3d(T) ax = gca() ax.y_ticks = tlist(["ticks" "locations" "labels"], (0:12)+0.5, months) @@ -54,8 +55,8 @@ function hist3d(f,theta,alpha,leg,flags,ebox) ax.rotation_angles = [28 19] ax.children.color_mode = color("violet") // ax.children.color_flag = 1 - drawnow - return; + gcf().immediate_drawing = initDrawingMode; + return end if typeof(f)=="list" then [f,x,y]=f(1:3); diff --git a/scilab/modules/graphics/macros/mesh.sci b/scilab/modules/graphics/macros/mesh.sci index af0c31b..af1040d 100644 --- a/scilab/modules/graphics/macros/mesh.sci +++ b/scilab/modules/graphics/macros/mesh.sci @@ -27,10 +27,13 @@ function mesh(varargin) // Copy RHS arguments ListArg = varargin; - drawlater(); + initDrawingMode = gcf().immediate_drawing; + gcf().immediate_drawing = "off"; + surf(ListArg(:)); e = gce(); e.color_mode = color("white"); e.color_flag = 0; - drawnow(); + + gcf().immediate_drawing = initDrawingMode; endfunction diff --git a/scilab/modules/graphics/macros/paramfplot2d.sci b/scilab/modules/graphics/macros/paramfplot2d.sci index 554580a..646230b 100644 --- a/scilab/modules/graphics/macros/paramfplot2d.sci +++ b/scilab/modules/graphics/macros/paramfplot2d.sci @@ -59,7 +59,9 @@ function paramfplot2d(f,x,theta,flag,rect) a.data_bounds=matrix(rect,2,2); a.axes_visible="on"; y=feval(x,theta(1),f); - xpoly(x,y(:));p=gce(); //the polyline handle + xpoly(x,y(:)); + p = gce(); //the polyline handle + drawnow(); realtime(0); if flag=="no" then drawlater(); diff --git a/scilab/modules/graphics/macros/pie.sci b/scilab/modules/graphics/macros/pie.sci index 8dfd2b7..a2413a0 100644 --- a/scilab/modules/graphics/macros/pie.sci +++ b/scilab/modules/graphics/macros/pie.sci @@ -90,7 +90,9 @@ function pie(varargin) xi = []; CurColor = 0; - drawlater(); + initDrawingMode = gcf().immediate_drawing; + gcf().immediate_drawing = "off"; + a = gca(); // Create a close polyline for every parts of pie, the polyline inside color is determinated by the plot colormap for i=1:size(x,"*") @@ -146,5 +148,6 @@ function pie(varargin) isoview("on") a.box = "off"; a.axes_visible = "off"; - drawnow(); + + gcf().immediate_drawing = initDrawingMode; endfunction diff --git a/scilab/modules/graphics/macros/polarplot.sci b/scilab/modules/graphics/macros/polarplot.sci index 6089102..c6bfa05 100644 --- a/scilab/modules/graphics/macros/polarplot.sci +++ b/scilab/modules/graphics/macros/polarplot.sci @@ -2,6 +2,7 @@ // Copyright (C) INRIA // Copyright (C) 2010 - DIGITEO - Manuel Juliachs // Copyright (C) 2012 - 2016 - Scilab Enterprises +// Copyright (C) 2010, 2018 - Samuel GOUGEON // // This file is hereby licensed under the terms of the GNU GPL v2.0, // pursuant to article 5.3.4 of the CeCILL v.2.1. @@ -163,7 +164,9 @@ function polarplot(theta,rho,style,strf,leg,rect) frameflag=4 opts=[opts,"frameflag=frameflag"], end - drawlater() + + initDrawingMode = gcf().immediate_drawing; + gcf().immediate_drawing = "off"; execstr("plot2d(x,y,"+strcat(opts,",")+")") fcolor=color("grey70"); @@ -238,5 +241,5 @@ function polarplot(theta,rho,style,strf,leg,rect) a.data_bounds=[rect(1:2);rect(3:4)] a.margins=[0.07 0.07 0.12 0.07] - drawnow() + gcf().immediate_drawing = initDrawingMode; endfunction -- 1.7.9.5