• Immutable Page
  • Info
  • Attachments

PaintHandler

class CompositeScreen :
{
    public:

        class PaintHandler {
            public:
                virtual ~PaintHandler () {};

                virtual void paintOutputs (CompOutput::ptrList &outputs,
                                           unsigned int        mask,
                                           const CompRegion    &region) = 0;

                virtual bool hasVSync () { return false; };

                virtual void prepareDrawing () {};
        };

    public:
        CompositeScreen (CompScreen *s);
        ~CompositeScreen ();

        /** 
         * Register a dispatch PaintHandler for a rendering plugin
         */     
        bool registerPaintHandler (PaintHandler *pHnd);
        void unregisterPaintHandler ();

        bool compositingActive ();
}

Creating a new rendering backend

Sometimes you may want to render the entire compiz output using a different backend other than OpenGL or any other implemented backend. To do this, you need to create a CompositeScreen::PaintHandler class which describes the functions used to handle redrawing should be implemented.

::paintOutputs is the function you will need to (and must do since the function is pure virtual) overload in order to display anything on screen. This is the handler function for redrawing an entire output, or the region specified in region. There is also a list of each output that needs to be redrawn in outputs.

From here, you can dispatch your redrawing chain in the way that you like, either immediately compositing all windows on screen, or just drawing them individually. Essentially at this point your plugin is in control of the rendering process.

The ::hasVSync () function is used by the composite plugin to determine whether it needs to do video synchronization manually, or if this is accounted for in the rendering backend.

The ::prepareDrawing () function gets called before anything else in the composite paint cycle and can be used to implement transformations and preparation before plugins are able to modify anything, eg for scene graphs and the like.

Development/zero-nine/CoreClasses/PaintHandler (last edited 2010-09-17 11:16:49 by 124-169-58-87)