Proposing EvRenderContext



Hi,

I'd like to change the way do rendering, and introduce a
EvRenderingContext to encapsulate our rendering information.  Currently,
we have some code like:

  ev_document_set_orientation (doc, orientation);
  pixbuf = ev_document_render_pixbuf (doc, page, scale);

Instead of this, I'd like to see us have code that looks like:

  EvRenderContext *rc = ev_render_context_new (doc, orientation, page, scale);
  pixbuf = ev_document_render_pixbuf (doc, rc);
  ...
  ev_render_context_free (rc);

This change is pretty superficial initially, as it will just encapsulate
the arguments to ev_document_render_pixbuf().  I have a few more goals
for this than just this, though:

 * I'd really like to keep the documents stateless.  That is to say,
   each call to ev_document_* doesn't result in possibly different
   values.  This is going to help as we add more idles later on.  It
   makes writing a backend simpler as you don't have to worry about
   storing state for the document.

 * For pdf selection (and presumably later, forms) we really want to
   cache some information per page.  We can let the backends store
   information in the contexts this way, and free it up in a reasonable
   time.

 * Along those lines, we think we can possibly get as much as a 10%
   speed up with repeated renderings by caching the parse tree.  This
   will be especially nice for resizing.

 * The amount of stuff that we're going to be passing in is only going
   to grow and get more complicated.

I'm going to go ahead and put together a patch for this.  If anyone has
any comments on it, please let me know.

Thanks,
-Jonathan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]