[Fresco-devel] cache graphics

[email protected] Sun, 4 Jan 2004 04:24:13 +0100
Newsgroups gmane.comp.video.fresco.devel
Message-ID <20040104032413.GA3897@balthasar>
hi

this idea is only for drawing ... i have no idea of how to devolve it to picking/event-handling
(controllers)...  the problen is that clients can pass its own implementations of 
graphic to the scene-graph and may harm the server just by blocking in the traverse-call...

i'm long thinked about to make the draw/traverse-process asynchron... 

ok... here is yet abother strange idea of how to resolve the problem of untrusted graphics 
in the scenegraph (without break existing thinks) ;)

the idea is to insert "cache-graphics" on top of every client-graph... 

     [root]
       |
       |\
      /  \
     /    \
  [cache]  \
    |      [cache]
    |           |
  [window]      |
   /    \     [window]
  /      \
[button] [other graphic]
              |
              |
   [something other graphic]

new objects we need:

CacheGraphic    - processes it's childs with the CacheTraversal to get all drawing-operations from it's childs
CacheTraversal  - which walks down the SceneGraph from the CacheGraphic
CacheDrawingKit - which is returned from CacheTraversal::drawing()... this will forward the DrawOperation to it's CacheGraphic

here some pseudocode for CacheGraphic:

// this will never block
CacheGraphic::traverse(Traversal t)
{
  // child->traverse() done and cache filled?
  if (is_cache_defined())
  {
    // execute all cached drawing-operations
    draw_all_in_cache(t->drawing());

    // free the cache... 
    reset_cache();
    // ... is_cache_defined() will return FALSE now
  }
  else
  {
    // start the traverse... then call need_redraw()
    start_traverse_thread();
  }
}
    
CacheGraphic::traverse_thread_run()
{
  CacheTraversal t(self);

  // traverse all childs...
  child->traverse(t); 

  // notify root-traversal!
  need_redraw();
}

what do you think about this idea?

(sorry for sending this again... i sended it with the false From:-tag before)