summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-07 19:54:41 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-07 19:54:41 +0900
commite6f66e56fdc0989e73fc54809dea5368df68cfab (patch)
tree4c8540f1abdfcfe49f4a137f02210c3327353af2 /src/lib/ector
parentfbe92aa67f18f8c0401cdc6d4440ed512c43b131 (diff)
ector software: Be careful at alloca() usage.
allocate one spare span memory then reuse it.
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 7a03bb69f2..d9b3351248 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -49,12 +49,16 @@ _blend_color_argb_with_maskA(int count, const SW_FT_Span *spans, void *user_data
49 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 49 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
50 uint32_t *mbuffer = mask->pixels.u32; 50 uint32_t *mbuffer = mask->pixels.u32;
51 51
52 //Temp buffer for intermediate processing
53 int tsize = sd->raster_buffer->generic->w;
54 uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize);
55
52 while (count--) 56 while (count--)
53 { 57 {
54 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 58 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
55 uint32_t *mtarget = 59 uint32_t *mtarget =
56 mbuffer + ((mask->generic->w * spans->y) + spans->x); 60 mbuffer + ((mask->generic->w * spans->y) + spans->x);
57 uint32_t *temp = alloca(sizeof(uint32_t) * spans->len); 61 uint32_t *temp = tbuffer;
58 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 62 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
59 comp_func(temp, spans->len, color, spans->coverage); 63 comp_func(temp, spans->len, color, spans->coverage);
60 64
@@ -88,12 +92,16 @@ _blend_color_argb_with_maskInvA(int count, const SW_FT_Span *spans, void *user_d
88 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx); 92 sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
89 uint32_t *mbuffer = mask->pixels.u32; 93 uint32_t *mbuffer = mask->pixels.u32;
90 94
95 //Temp buffer for intermediate processing
96 int tsize = sd->raster_buffer->generic->w;
97 uint32_t *tbuffer = alloca(sizeof(uint32_t) * tsize);
98
91 while (count--) 99 while (count--)
92 { 100 {
93 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x); 101 uint32_t *target = buffer + ((pix_stride * spans->y) + spans->x);
94 uint32_t *mtarget = 102 uint32_t *mtarget =
95 mbuffer + ((mask->generic->w * spans->y) + spans->x); 103 mbuffer + ((mask->generic->w * spans->y) + spans->x);
96 uint32_t *temp = alloca(sizeof(uint32_t) * spans->len); 104 uint32_t *temp = tbuffer;
97 memset(temp, 0x00, sizeof(uint32_t) * spans->len); 105 memset(temp, 0x00, sizeof(uint32_t) * spans->len);
98 comp_func(temp, spans->len, color, spans->coverage); 106 comp_func(temp, spans->len, color, spans->coverage);
99 107