Is __modified__ graphics prop useful anymore?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Is __modified__ graphics prop useful anymore?

Rik-4
10/24/16

I made the graphics property __modified__ a hidden property
(http://hg.savannah.gnu.org/hgweb/octave/rev/4ea5b0c3b10f).  But, I can't
see that it is used anywhere usefully in the code.  Maybe it had a purpose
a long time ago, but should it just be put on the road to deprecation now?

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: Is __modified__ graphics prop useful anymore?

John W. Eaton
Administrator
On 10/24/2016 04:48 PM, Rik wrote:
> 10/24/16
>
> I made the graphics property __modified__ a hidden property
> (http://hg.savannah.gnu.org/hgweb/octave/rev/4ea5b0c3b10f).  But, I can't
> see that it is used anywhere usefully in the code.  Maybe it had a purpose
> a long time ago, but should it just be put on the road to deprecation now?

Isn't it used in base_properties::mark_modified method?  I think the
purpose is to tag a set of properties as modified so that there is a
quick way to know whether something has changed and the object needs to
be drawn again.

jwe



Reply | Threaded
Open this post in threaded view
|

Re: Is __modified__ graphics prop useful anymore?

John W. Eaton
Administrator
On 10/24/2016 05:10 PM, John W. Eaton wrote:

> On 10/24/2016 04:48 PM, Rik wrote:
>> 10/24/16
>>
>> I made the graphics property __modified__ a hidden property
>> (http://hg.savannah.gnu.org/hgweb/octave/rev/4ea5b0c3b10f).  But, I can't
>> see that it is used anywhere usefully in the code.  Maybe it had a
>> purpose
>> a long time ago, but should it just be put on the road to deprecation
>> now?
>
> Isn't it used in base_properties::mark_modified method?  I think the
> purpose is to tag a set of properties as modified so that there is a
> quick way to know whether something has changed and the object needs to
> be drawn again.

The base_properties::is_modified method checks the status.  It's used in
Fdrawnow.

jwe



Reply | Threaded
Open this post in threaded view
|

Re: Is __modified__ graphics prop useful anymore?

Rik-4
On 10/24/2016 02:14 PM, John W. Eaton wrote:
> On 10/24/2016 05:10 PM, John W. Eaton wrote: >> On 10/24/2016 04:48 PM, Rik wrote: >>> 10/24/16 >>> >>> I made the graphics property __modified__ a hidden property >>> (http://hg.savannah.gnu.org/hgweb/octave/rev/4ea5b0c3b10f).  But, I can't >>> see that it is used anywhere usefully in the code.  Maybe it had a >>> purpose >>> a long time ago, but should it just be put on the road to deprecation >>> now? >> >> Isn't it used in base_properties::mark_modified method?  I think the >> purpose is to tag a set of properties as modified so that there is a >> quick way to know whether something has changed and the object needs to >> be drawn again. > > The base_properties::is_modified method checks the status.  It's used in Fdrawnow. >

But nothing seems to set the value to "off".

octave:12> hax = gca;
octave:13> get (hax, "__modified__")
ans = on
octave:14> drawnow
octave:15> get (hax, "__modified__")
ans = on

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Is __modified__ graphics prop useful anymore?

Daniel Sebald
On 10/24/2016 04:32 PM, Rik wrote:

> On 10/24/2016 02:14 PM, John W. Eaton wrote:
>> On 10/24/2016 05:10 PM, John W. Eaton wrote:  >> On 10/24/2016 04:48 PM, Rik wrote: >>> 10/24/16 >>> >>> I made the
> graphics property __modified__ a hidden property >>>
> (http://hg.savannah.gnu.org/hgweb/octave/rev/4ea5b0c3b10f).  But, I
> can't >>> see that it is used anywhere usefully in the code.  Maybe it
> had a >>> purpose >>> a long time ago, but should it just be put on the
> road to deprecation >>> now? >> >> Isn't it used in
> base_properties::mark_modified method?  I think the >> purpose is to tag
> a set of properties as modified so that there is a >> quick way to know
> whether something has changed and the object needs to >> be drawn again.
>  > > The base_properties::is_modified method checks the status.  It's
> used in Fdrawnow. >
>
> But nothing seems to set the value to "off".
>
> octave:12> hax = gca;
> octave:13> get (hax, "__modified__")
> ans = on
> octave:14> drawnow
> octave:15> get (hax, "__modified__")
> ans = on
>
> --Rik

Perhaps this is why we see plots being drawn twice quite often, possibly
all toolkits, but gnuplot for sure, which would most noticeable because
of its relative slowness.

Dan

Reply | Threaded
Open this post in threaded view
|

Re: Is __modified__ graphics prop useful anymore?

Rik-4
In reply to this post by John W. Eaton
On 10/24/2016 02:32 PM, Rik wrote:
On 10/24/2016 02:14 PM, John W. Eaton wrote:
> On 10/24/2016 05:10 PM, John W. Eaton wrote: >> On 10/24/2016 04:48 PM, Rik wrote: >>> 10/24/16 >>> >>> I made the graphics property __modified__ a hidden property >>> (http://hg.savannah.gnu.org/hgweb/octave/rev/4ea5b0c3b10f).  But, I can't >>> see that it is used anywhere usefully in the code.  Maybe it had a >>> purpose >>> a long time ago, but should it just be put on the road to deprecation >>> now? >> >> Isn't it used in base_properties::mark_modified method?  I think the >> purpose is to tag a set of properties as modified so that there is a >> quick way to know whether something has changed and the object needs to >> be drawn again. > > The base_properties::is_modified method checks the status.  It's used in Fdrawnow. >

But nothing seems to set the value to "off".

octave:12> hax = gca;
octave:13> get (hax, "__modified__")
ans = on
octave:14> drawnow
octave:15> get (hax, "__modified__")
ans = on


Actually, the only code that ever turns off a modified property is in Fdrawnow, and it only does it for figure objects

-- Code in Fdrawnow --
          Matrix hlist = gh_manager::figure_handle_list (true);

          for (int i = 0; i < hlist.numel (); i++)
            {
              graphics_handle h = gh_manager::lookup (hlist(i));

              if (h.ok () && h != 0)
                {
                  graphics_object go = gh_manager::get_object (h);
                  figure::properties& fprops
                    = dynamic_cast<figure::properties&> (go.get_properties ());

                  if (fprops.is_modified ())
                    {
                      if (fprops.is_visible ())
                        {
                          gh_manager::unlock ();

                          fprops.get_toolkit ().redraw_figure (go);

                          gh_manager::lock ();
                        }

                      fprops.set_modified (false);
                    }
                }
            }
-- End Code --

Even that doesn't seem to work completely as expected.  As soon as __modified__ property is "off" it seems that it is incapable of being set to "on".

octave:1> h = figure ();
octave:2> get (gcf, "__modified__")
ans = on
octave:3> drawnow
octave:4> get (gcf, "__modified__")
ans = off
octave:5> set (gcf, "__modified__", "on")
octave:6> get (gcf, "__modified__")
ans = off

There might be some performance savings from eliminating all the calls to mark_modified since the state variable is never used.

This issues should be addressed but I don't know where to keep track of it.  It is more than a bug report because the issue is architectural.

--Rik