[MPlayer-dev-eng] [PATCH] libass BorderStyle==3 fix

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Jun 11 18:07:50 CEST 2009


On Tuesday 09 June 2009 14:27:19 Rinat wrote:
> > Ok, I lied :) Clipping is needed here. For normal glyphs it is done in
> > render_glyph().
>
> Everybody lies :)
>
> > > > > +	double outline; //outline width
> > > >
> > > > It's better to add "int border_style" instead. This way you will
> > > > avoid comparing floating point values for equality :)
> > >
> > > I've added 'outline' in same way as 'shadow' (already in code). It's
> > > double also, and compared to integer in 'render_text'.
> >
> > Right. And it's bad style. Anyway, BorderStyle is orthogonal to outline
> > width, and is not a property of an individual glyph. You can just check
> > render_context.style->BorderStyle directly in render_text() for both
> > outline and shadow bitmaps, or put it in text_info_t and check it from
> > there. In this case you can also keep border and shadow calculation
> > unchanged.
>
> I've reorganized code and new version uses render_glyph() to render
> background box so I need not duplicate clipping code.
>
> Added 'bg_box' flag in glyph_info_t. Shadow and outline glyphs are now
> rendered only if BorderStyle is set to 1. Added code in render_text()
> rendering background box before other glyphs. And code that adds fake glyph
> bg_box set to 1.
>
>
> There is still minor bug. Bounding box calculated before text rotation
> so background box doesn't cover rotated text.

Yeah, background box has to be rotated with the text. The easiest way to do it 
is probably to create an outline glyph of the required size and placement, and 
add it to text_info.glyphs. If done right, the same code could be used for 
vector drawings (\p).



More information about the MPlayer-dev-eng mailing list