Gecko:Layers: Difference between revisions

1,475 bytes added ,  6 October 2009
Line 45: Line 45:
   // Create a YUV layer with given size and format, and adopt the memory buffer
   // Create a YUV layer with given size and format, and adopt the memory buffer
   YUVLayerBuilder(size, format, bufferToAdopt);
   YUVLayerBuilder(size, format, bufferToAdopt);
};
class WebGLBufferLayerBuilder : LayerBuilder {
  // Create a layer that's a logical copy (ideally copy on write) of a given
  // WebGL canvas with given size and format, and adopt the memory buffer
  WebGLLayerBuilder(webGLBuffer);
  };
  };
   
   
Line 52: Line 58:
   ContainerLayerBuilder(size, format);
   ContainerLayerBuilder(size, format);
   
   
  // The following methods can only be called after all LayerBuilder property
  // setters are done.
   // Add an existing layer
   // Add an existing layer
   addLayer(Layer);
   addLayer(Layer);
Line 70: Line 79:
   RenderedLayerBuilder(size, format);
   RenderedLayerBuilder(size, format);
   
   
  // This can only be called after all LayerBuilder property setters are
  // done. The context cannot be used after finish() is called.
   gfxContext* getContext();
   gfxContext* getContext();
  };
  };
Line 76: Line 87:


Add a way to return a Layer from a paint event (or just set it directly on the widget), so it gets rendered, possibly asynchronously on another thread.
Add a way to return a Layer from a paint event (or just set it directly on the widget), so it gets rendered, possibly asynchronously on another thread.
Clients can use a mixture of retained Layers and recursive painting with each recursion level delimited by ContainerLayerBuilder::addContainerChild followed by finish() on the child.
The goal is to allow a pure cairo implementation of this API that's as efficient as we have today. In that implementation RenderedLayerBuilder::getContext tries to return a context that renders directly into the underlying surface for some ancestor. Of course we also want to have a GL or D3D implementation that's fast, but will require more temporary surfaces if we're not using cairo-gl.
When we go to off-main-thread compositing we'll want to add support for animation and other stuff. For example we might want a YUVSeriesLayerBuilder that can select from a queue of timestamped frames based on the current time. The rendering property setters on LayerBuilder would be extended with animating setters that take a list of timestamped values, or perhaps the parameters of actual transition functions.


== Jeff ==
== Jeff ==


== Bas ==
== Bas ==
1,295

edits