freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FT Performance Regression?


From: Jamie Dale
Subject: Re: FT Performance Regression?
Date: Sun, 27 Oct 2019 17:51:41 +0000

It's direct rendering onto a bitmap to get an outline, yeah. It's basically
the same as in this example:
https://www.freetype.org/freetype2/docs/tutorial/example2.cpp

To give a bit more information, in FreeType 2.6 we didn't actually specify
a clip_box nor the FT_RASTER_FLAG_CLIP flag, and FT_Outline_Render would
set its own clip_box (which was unbounded). After upgrading to FreeType
2.10 we found that if you use FT_RASTER_FLAG_DIRECT you now *must* also use
FT_RASTER_FLAG_CLIP and specify a clip_box otherwise FreeType will crash.

I imagine a lot of people did the same thing I did and just used an
unbounded clip_box when they started getting that crash, as the
documentation doesn't state what a good clip_box should be, nor do the
release notes or any documentation call out this breaking change in
behaviour, which makes the fact that it causes a significant amount of
redundant work even more scary.

As far as I can tell, the code I posted before to calculate a suitable
clip_box is equivalent to the logic of the old gray_compute_cbox function,
giving us back 2.6-like performance.

-Jamie.

On Sat, 26 Oct 2019 at 17:53, Alexei Podtelezhnikov <address@hidden>
wrote:

>
>
> >
> >> FreeType 2.6 used to use an unbounded clip_box in the
> >> FT_Raster_Params struct, and internally the gray_compute_cbox
> >> function would clamp it to a reasonable range.
> >>
> >> That clamping no longer happens, so you have to do it yourself
> >> before calling the function. The docs don't really explain how that
> >> would be calculated, but from looking at the old 2.6 code I think it
> >> should be this:
> >>
> >> FT_Outline_Get_CBox(outline, &rp.clip_box);
> >> rp.clip_box.xMin = rp.clip_box.xMin >> 6;
> >> rp.clip_box.yMin = rp.clip_box.yMin >> 6;
> >> rp.clip_box.xMax = (rp.clip_box.xMax + 63) >> 6;
> >> rp.clip_box.yMax = (rp.clip_box.yMax + 63) >> 6;
> >>
> >> Does that seem correct?
> >
> > Alexei?
>
> Can I have more details on the use case? Is this direct rendering of a
> small outline onto a much larger bitmap without clip_box specified?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]