forked from enlightenment/efl
ector software: Be careful at alloca() usage.
allocate one spare span memory then reuse it.
This commit is contained in:
parent
fbe92aa67f
commit
e6f66e56fd
|
@ -49,12 +49,16 @@ _blend_color_argb_with_maskA(int count, const SW_FT_Span *spans, void *user_data
|
||||||
sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
|
sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
|
||||||
uint32_t *mbuffer = mask->pixels.u32;
|
uint32_t *mbuffer = mask->pixels.u32;
|
||||||
|
|
||||||
|
//Temp buffer for intermediate processing
|
||||||
|
int tsize = sd->raster_buffer->generic->w;
|
||||||
|
uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize);
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
|
uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
|
||||||
uint32_t *mtarget =
|
uint32_t *mtarget =
|
||||||
mbuffer + ((mask->generic->w * spans->y) + spans->x);
|
mbuffer + ((mask->generic->w * spans->y) + spans->x);
|
||||||
uint32_t *temp = alloca(sizeof(uint32_t) * spans->len);
|
uint32_t *temp = tbuffer;
|
||||||
memset(temp, 0x00, sizeof(uint32_t) * spans->len);
|
memset(temp, 0x00, sizeof(uint32_t) * spans->len);
|
||||||
comp_func(temp, spans->len, color, spans->coverage);
|
comp_func(temp, spans->len, color, spans->coverage);
|
||||||
|
|
||||||
|
@ -88,12 +92,16 @@ _blend_color_argb_with_maskInvA(int count, const SW_FT_Span *spans, void *user_d
|
||||||
sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
|
sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
|
||||||
uint32_t *mbuffer = mask->pixels.u32;
|
uint32_t *mbuffer = mask->pixels.u32;
|
||||||
|
|
||||||
|
//Temp buffer for intermediate processing
|
||||||
|
int tsize = sd->raster_buffer->generic->w;
|
||||||
|
uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize);
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
|
uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
|
||||||
uint32_t *mtarget =
|
uint32_t *mtarget =
|
||||||
mbuffer + ((mask->generic->w * spans->y) + spans->x);
|
mbuffer + ((mask->generic->w * spans->y) + spans->x);
|
||||||
uint32_t *temp = alloca(sizeof(uint32_t) * spans->len);
|
uint32_t *temp = tbuffer;
|
||||||
memset(temp, 0x00, sizeof(uint32_t) * spans->len);
|
memset(temp, 0x00, sizeof(uint32_t) * spans->len);
|
||||||
comp_func(temp, spans->len, color, spans->coverage);
|
comp_func(temp, spans->len, color, spans->coverage);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue