[cairo] New surface: cairo_combined_surface_t

Kouhei Sutou kou at cozmixng.org
Fri Jun 2 22:24:27 PDT 2006


Hi,

In <Pine.GSO.4.58.0606011643480.18471 at qew.cs>
  "Re: [cairo] New surface: cairo_combined_surface_t" on Thu, 1 Jun 2006 16:45:49 -0400 (EDT),
  Behdad Esfahbod <behdad at cs.toronto.edu> wrote:

> On Thu, 1 Jun 2006, Vladimir Vukicevic wrote:
> 
> > On 5/31/06, Kouhei Sutou <kou at cozmixng.org> wrote:
> > > To solve those problems, I suggeste that cairo provides a surface can combine
> > > some surfaces and show those surfaces as a surface to cairo_t. And then, we can
> > > write the above code as the following:
> > >
> > >   ...
> > >   combined_surface = cairo_combined_surface(ps_surface, pdf_surface, NULL);
> >
> > Not a bad idea, but I think it will be difficult to implement in
> > practice.  The surfaces will almost certainly need fallback for
> > different operations, and fallback happens in the generic surface
> > layer, signalled by the backend surface returning an error code
> > stating that the operation is unsupported.  In the combined_surface
> > case, the actual backend is the combined surface.
> >
> > So, when a composite request comes in that the pdf surface can hande,
> > but the ps surface can not, you need the fallback to happen for the ps
> > surface but not for the pdf surface.  You can't return unsupported,
> > since that would cause fallback rendering to happen for both -- so
> > you'd have to implement the fallback yourself.
> 
> Not necessarily.  If you implement the combined surface as a
> simple container the keeps a collection of other cairo_surface_t
> pointers and just dispatch incoming requests to all of them, you
> get fallback for all of them for free.  You probably should
> return a failure message if at least one of the surfaces fail...

My sample implementation of this idea is implemented as just
what Behdad described. I attached a patch in my previous
mail.

Could someone try the patch and find any problems?


Regards,
--
kou


More information about the cairo mailing list