Hi,
> > - Pass a CompTextData * instead of the Bool as result of the rendering
> > functions, which then could be used to check if rendering was successful
> > later on (would save some memory in my example implementation, but
> > would cause another heap allocation though, not sure if we want to avoid
> > that)
>
> Why do we have a CompTextAttrib and and a CompTextData type? Why not
> just pass a pointer to the CompTextAttrib and have the image renderer
> render to that instead of having to muck around with heap allocation
> for another type?
>
> I don't know what you're take on this is though, is it worth having
> two separate types?
Yes, it is. CompTextAttrib is the input data ("how is the text to be
rendered?"), CompTextData is the output data used for drawing it on
screen. The former is only needed at rendering time, the latter is
needed as long as the text is drawn.
Thinking about it, however, I think there are so many heap allocations
involved in rendering text via the text plugin (pixmap allocation, cairo
context, cairo surface, pango font etc. pp.) that one or two additional
structure allocations have almost zero impact.
> > - Implement more stuff currently implemented via copy'n'paste in the
> > various text plugins users. Among those are e.g. automatic binding of
> > the pixmap to the texture, a cleanup function, a drawing function which
> > puts the texture on screen. I'm not sure doing stuff like automatic
> > binding would limit the use cases of the text plugin (e.g. group doesn't
> > need it because it does some additional cairo magic). We could make the
> > binding optional via a flag, though (and enable it by default).
>
> Definitely.
>
> I still see you've got:
>
> releasePixmapFromTexture (s, &rs->textTexture);
> initTexture (s, &rs->textTexture);
> - XFreePixmap (s->display->display, rs->textPixmap);
> - rs->textPixmap = None;
> + XFreePixmap (s->display->display, rs->textData.pixmap);
> + rs->textData.pixmap = None;
>
> In the cleanup function, that can probably be put into text as well,
> pretty much all plugins that use text have a cleanup function like
> that.
Yes, right, but pretty much all != all. I have an idea how to do it
generically, though:
- Add a CompTextFlagNoAutomaticBinding
- If it's not set, allocate a CompTexture inside CompTextData and do the
bindPixmapToTexture inside the text plugin
- Otherwise, only return the pixmap.
- Provide a finiTextData func to clean up CompTextData.
> Also, I don't quite understand what you have here by rs->type == RingTypeAll
>
> + if (rd->textFunc->renderWindowTitle (s, rs->selectedWindow,
> + rs->type == RingTypeAll,
> + &attrib, &rs->textData))
Look at the prototype (yes, I will add doxygen documentation): The third
parameter is a Bool that switches rendering of the viewport number, e.g.
"Foo Bar" vs. "Foo Bar -[4]-".
Regards,
Danny
_______________________________________________
Dev mailing list
[email protected]
http://lists.compiz-fusion.org/mailman/listinfo/dev