summaryrefslogtreecommitdiff
path: root/src/lib/ector/software/ector_software_rasterizer.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-09 15:11:16 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-09 15:12:07 +0100
commit917a2bcab5a0f464b5bea72fe76872106d893e25 (patch)
treee11240ff441193b09db4d205b39efac48fcad2fa /src/lib/ector/software/ector_software_rasterizer.c
parentcd4bb6a84d535e4edcd340be261ac7e61569cf11 (diff)
ector: always initialize the array contents even without fetchfunc
Also use a static array instead of a VLA as we know the size at compile time. Fixes CID 1294210. @fix
Diffstat (limited to '')
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 2c55565089..d98a8dc54a 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -55,7 +55,7 @@ _blend_color_argb(int count, const SW_FT_Span *spans, void *user_data)
55 } 55 }
56} 56}
57 57
58int buffer_size = 2048; 58#define BLEND_GRADIENT_BUFFER_SIZE 2048
59 59
60typedef void (*src_fetch) (unsigned int *buffer, Span_Data *data, int y, int x, int length); 60typedef void (*src_fetch) (unsigned int *buffer, Span_Data *data, int y, int x, int length);
61 61
@@ -68,7 +68,7 @@ _blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
68 if(data->type == LinearGradient) fetchfunc = &fetch_linear_gradient; 68 if(data->type == LinearGradient) fetchfunc = &fetch_linear_gradient;
69 if(data->type == RadialGradient) fetchfunc = &fetch_radial_gradient; 69 if(data->type == RadialGradient) fetchfunc = &fetch_radial_gradient;
70 70
71 unsigned int buffer[buffer_size]; 71 unsigned int buffer[BLEND_GRADIENT_BUFFER_SIZE];
72 72
73 // move to the offset location 73 // move to the offset location
74 unsigned int *destbuffer = data->raster_buffer.buffer + (data->raster_buffer.width * data->offy + data->offx); 74 unsigned int *destbuffer = data->raster_buffer.buffer + (data->raster_buffer.width * data->offy + data->offx);
@@ -79,9 +79,11 @@ _blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
79 int length = spans->len; 79 int length = spans->len;
80 while (length) 80 while (length)
81 { 81 {
82 int l = MIN(length, buffer_size); 82 int l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE);
83 if (fetchfunc) 83 if (fetchfunc)
84 fetchfunc(buffer, data, spans->y, spans->x, l); 84 fetchfunc(buffer, data, spans->y, spans->x, l);
85 else
86 memset(buffer, 0, sizeof(buffer));
85 if (data->mul_col == 0xffffffff) 87 if (data->mul_col == 0xffffffff)
86 _ector_comp_func_source_over(target, buffer, l, spans->coverage); // TODO use proper composition func 88 _ector_comp_func_source_over(target, buffer, l, spans->coverage); // TODO use proper composition func
87 else 89 else