Follow-up Comment #5, bug #18421 (project mypaint):

(Merely a joke. Call/cc is just a control flow thing in other languages.
Python doesn't really have a good equivalent, probably especially not in the
case of C extensions.)

Yes, that profile makes sense, and it's obvious where any annoying delay to
the user's flow would come from.  We don't really want to delay processing the
GTK event loop until save_png_fast_progressive() completes.  I know
feedback_cb() can be made to process single iterations of the GTK event loop,
as we do right now to prevent the UI from greying out.  However I don't want
to think about would happen if the user started doing file operations while
buried in the middle of an existing call to save_png_fast_progressive() for a
background :X

I think saving of successive tile_scanlines in successive invocations of the
callback argument to glib.idle_add() makes sense for background saving. Gives
us a little flexibility in terminating a background save, and I think it'd
schedule quite nicely too. Something like:


    # Really quick pseudocode sketch

    class BGSaver:
        save_state = None

        def background_save_idler(self, surface, filename):
            if self.save_state is None:
                self.save_state = fast_progr_saver_start(...)
            scanline = render_tile_scanline()
            not_finished = fast_progr_saver_write_scanline(
                             self.save_state, scanline):
            if not_finished:
                return True
            fast_progr_saver_cleanup(self.save_state, ...)
            return False

    saver = BGSaver()
    glib.idle_add(saver.background_save_idler, surface, filename)


should allow the main UI to carry on in the outer loop without blocking. At
the end of the background save, rename into place in something blocking. Does
that seem sane? If the user does something that means we need to kill off an
ongoing background save, that can be arranged too :)

The normal save routines can just call all three functions in the current way
of course.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?18421>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Mypaint-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/mypaint-bugs

Reply via email to