[PATCH 12/13] mi: Fill all spans for PolyFillArc at once

walter harms wharms at bfs.de
Tue May 6 11:07:51 PDT 2014



Am 06.05.2014 18:43, schrieb Eric Anholt:
> walter harms <wharms at bfs.de> writes:
> 
>> Am 06.05.2014 00:02, schrieb Keith Packard:
>>> This allocates span data for all of the provided arcs and draws the
>>> whole set in one call, rather than doing them one at a time. For
>>> modern hardware, this is a significant performance improvement.
>>>
>>> Signed-off-by: Keith Packard <keithp at keithp.com>
>>> ---
>>>  mi/mifillarc.c | 98 ++++++++++++++++++++--------------------------------------
>>>  1 file changed, 34 insertions(+), 64 deletions(-)
>>>
>>> diff --git a/mi/mifillarc.c b/mi/mifillarc.c
>>> index 337343d..1695121 100644
>>> --- a/mi/mifillarc.c
>>> +++ b/mi/mifillarc.c
> 
>>> +
>>> +    pts = points = malloc (sizeof (DDXPointRec) * nspans + sizeof(int) * nspans);
>>> +    if (!points)
>>> +        return;
>>> +    wids = widths = (int *) (points + nspans);
>>
>>
>> this looks like a case for calloc().
> 
> calloc also does the work of zero initialization, which you don't want
> in your rendering paths where the data is getting fully initialized
> anyway.
yep, but it is more clean and it (should) takes care about integer overflows (maybe not a
problem here). Later version may not be fully initialized.
NTL this is my opinion ... if you think it does not matter leave it.

re,
 wh


More information about the xorg-devel mailing list