summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-08-29 21:51:48 +0900
committerHermet Park <hermetpark@gmail.com>2019-08-30 13:44:56 +0900
commit17320a13180fdfbf75f5648d2f06a8d2155c8a0d (patch)
tree2bfb74067f8ff64fc8dd1d3cb283b41204c972d8 /src/lib/ector
parent5370c2e7957cfec1b4bf8eff65dfe0e7a6547263 (diff)
ector: code refactoring.
just renamed internal variables, no logical changes.
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index d6242a0..bd8055f 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -260,22 +260,22 @@ static void
260_blend_gradient(int count, const SW_FT_Span *spans, void *user_data) 260_blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
261{ 261{
262 RGBA_Comp_Func comp_func; 262 RGBA_Comp_Func comp_func;
263 Span_Data *data = (Span_Data *)(user_data); 263 Span_Data *sd = (Span_Data *)(user_data);
264 src_fetch fetchfunc = NULL; 264 src_fetch fetchfunc = NULL;
265 unsigned int buffer[BLEND_GRADIENT_BUFFER_SIZE], *target, *destbuffer; 265 unsigned int buffer[BLEND_GRADIENT_BUFFER_SIZE], *target, *destbuffer;
266 int length, l; 266 int length, l;
267 const int pix_stride = data->raster_buffer->stride / 4; 267 const int pix_stride = sd->raster_buffer->stride / 4;
268 268
269 // FIXME: Get the proper composition function using ,color, ECTOR_OP etc. 269 // FIXME: Get the proper composition function using ,color, ECTOR_OP etc.
270 if (data->type == LinearGradient) fetchfunc = &fetch_linear_gradient; 270 if (sd->type == LinearGradient) fetchfunc = &fetch_linear_gradient;
271 if (data->type == RadialGradient) fetchfunc = &fetch_radial_gradient; 271 if (sd->type == RadialGradient) fetchfunc = &fetch_radial_gradient;
272 272
273 if (!fetchfunc || !data->raster_buffer->pixels.u32) return; 273 if (!fetchfunc || !sd->raster_buffer->pixels.u32) return;
274 274
275 comp_func = efl_draw_func_span_get(data->op, data->mul_col, data->gradient->alpha); 275 comp_func = efl_draw_func_span_get(sd->op, sd->mul_col, sd->gradient->alpha);
276 276
277 // move to the offset location 277 // move to the offset location
278 destbuffer = data->raster_buffer->pixels.u32 + ((pix_stride * data->offy) + data->offx); 278 destbuffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
279 279
280 while (count--) 280 while (count--)
281 { 281 {
@@ -284,8 +284,8 @@ _blend_gradient(int count, const SW_FT_Span *spans, void *user_data)
284 while (length) 284 while (length)
285 { 285 {
286 l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE); 286 l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE);
287 fetchfunc(buffer, data, spans->y, spans->x, l); 287 fetchfunc(buffer, sd, spans->y, spans->x, l);
288 comp_func(target, buffer, l, data->mul_col, spans->coverage); 288 comp_func(target, buffer, l, sd->mul_col, spans->coverage);
289 target += l; 289 target += l;
290 length -= l; 290 length -= l;
291 } 291 }
@@ -297,33 +297,32 @@ static void
297_blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data) 297_blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
298{ 298{
299 RGBA_Comp_Func comp_func; 299 RGBA_Comp_Func comp_func;
300 Span_Data *data = (Span_Data *)(user_data); 300 Span_Data *sd = (Span_Data *)(user_data);
301 src_fetch fetchfunc = NULL; 301 src_fetch fetchfunc = NULL;
302 uint32_t *buffer; 302 uint32_t *buffer;
303 const int pix_stride = data->raster_buffer->stride / 4; 303 const int pix_stride = sd->raster_buffer->stride / 4;
304 uint32_t gradientbuffer[BLEND_GRADIENT_BUFFER_SIZE]; 304 uint32_t gradientbuffer[BLEND_GRADIENT_BUFFER_SIZE];
305 305
306 // FIXME: Get the proper composition function using ,color, ECTOR_OP etc. 306 // FIXME: Get the proper composition function using ,color, ECTOR_OP etc.
307 if (data->type == LinearGradient) fetchfunc = &fetch_linear_gradient; 307 if (sd->type == LinearGradient) fetchfunc = &fetch_linear_gradient;
308 if (data->type == RadialGradient) fetchfunc = &fetch_radial_gradient; 308 if (sd->type == RadialGradient) fetchfunc = &fetch_radial_gradient;
309 309
310 if (!fetchfunc) 310 if (!fetchfunc) return;
311 return;
312 311
313 Ector_Software_Buffer_Base_Data *mask = data->mask; 312 Ector_Software_Buffer_Base_Data *mask = sd->mask;
314 uint32_t *mbuffer = mask->pixels.u32; 313 uint32_t *mbuffer = mask->pixels.u32;
315 314
316 //Temp buffer for intermediate processing 315 //Temp buffer for intermediate processing
317 uint32_t *tbuffer = malloc(sizeof(uint32_t) * data->raster_buffer->generic->w); 316 uint32_t *tbuffer = malloc(sizeof(uint32_t) * sd->raster_buffer->generic->w);
318 317
319 comp_func = efl_draw_func_span_get(data->op, data->mul_col, data->gradient->alpha); 318 comp_func = efl_draw_func_span_get(sd->op, sd->mul_col, sd->gradient->alpha);
320 319
321 // move to the offset location 320 // move to the offset location
322 buffer = data->raster_buffer->pixels.u32 + ((pix_stride * data->offy) + data->offx); 321 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
323 322
324 while (count--) 323 while (count--)
325 { 324 {
326 uint32_t *target = buffer + ((data->raster_buffer->generic->w * spans->y) + spans->x); 325 uint32_t *target = buffer + ((sd->raster_buffer->generic->w * spans->y) + spans->x);
327 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 326 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x);
328 uint32_t *temp = tbuffer; 327 uint32_t *temp = tbuffer;
329 int length = spans->len; 328 int length = spans->len;
@@ -331,8 +330,8 @@ _blend_gradient_alpha(int count, const SW_FT_Span *spans, void *user_data)
331 while (length) 330 while (length)
332 { 331 {
333 int l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE); 332 int l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE);
334 fetchfunc(gradientbuffer, data, spans->y, spans->x, l); 333 fetchfunc(gradientbuffer, sd, spans->y, spans->x, l);
335 comp_func(temp, gradientbuffer, l, data->mul_col, spans->coverage); 334 comp_func(temp, gradientbuffer, l, sd->mul_col, spans->coverage);
336 335
337 for (int i = 0; i < l; i++) 336 for (int i = 0; i < l; i++)
338 { 337 {
@@ -354,33 +353,32 @@ static void
354_blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data) 353_blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
355{ 354{
356 RGBA_Comp_Func comp_func; 355 RGBA_Comp_Func comp_func;
357 Span_Data *data = (Span_Data *)(user_data); 356 Span_Data *sd = (Span_Data *)(user_data);
358 src_fetch fetchfunc = NULL; 357 src_fetch fetchfunc = NULL;
359 uint32_t *buffer; 358 uint32_t *buffer;
360 const int pix_stride = data->raster_buffer->stride / 4; 359 const int pix_stride = sd->raster_buffer->stride / 4;
361 uint32_t gradientbuffer[BLEND_GRADIENT_BUFFER_SIZE]; 360 uint32_t gradientbuffer[BLEND_GRADIENT_BUFFER_SIZE];
362 361
363 // FIXME: Get the proper composition function using ,color, ECTOR_OP etc. 362 // FIXME: Get the proper composition function using ,color, ECTOR_OP etc.
364 if (data->type == LinearGradient) fetchfunc = &fetch_linear_gradient; 363 if (sd->type == LinearGradient) fetchfunc = &fetch_linear_gradient;
365 if (data->type == RadialGradient) fetchfunc = &fetch_radial_gradient; 364 if (sd->type == RadialGradient) fetchfunc = &fetch_radial_gradient;
366 365
367 if (!fetchfunc) 366 if (!fetchfunc) return;
368 return;
369 367
370 Ector_Software_Buffer_Base_Data *mask = data->mask; 368 Ector_Software_Buffer_Base_Data *mask = sd->mask;
371 uint32_t *mbuffer = mask->pixels.u32; 369 uint32_t *mbuffer = mask->pixels.u32;
372 370
373 //Temp buffer for intermediate processing 371 //Temp buffer for intermediate processing
374 uint32_t *tbuffer = malloc(sizeof(uint32_t) * data->raster_buffer->generic->w); 372 uint32_t *tbuffer = malloc(sizeof(uint32_t) * sd->raster_buffer->generic->w);
375 373
376 comp_func = efl_draw_func_span_get(data->op, data->mul_col, data->gradient->alpha); 374 comp_func = efl_draw_func_span_get(sd->op, sd->mul_col, sd->gradient->alpha);
377 375
378 // move to the offset location 376 // move to the offset location
379 buffer = data->raster_buffer->pixels.u32 + ((pix_stride * data->offy) + data->offx); 377 buffer = sd->raster_buffer->pixels.u32 + ((pix_stride * sd->offy) + sd->offx);
380 378
381 while (count--) 379 while (count--)
382 { 380 {
383 uint32_t *target = buffer + ((data->raster_buffer->generic->w * spans->y) + spans->x); 381 uint32_t *target = buffer + ((sd->raster_buffer->generic->w * spans->y) + spans->x);
384 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x); 382 uint32_t *mtarget = mbuffer + ((mask->generic->w * spans->y) + spans->x);
385 uint32_t *temp = tbuffer; 383 uint32_t *temp = tbuffer;
386 int length = spans->len; 384 int length = spans->len;
@@ -388,8 +386,8 @@ _blend_gradient_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
388 while (length) 386 while (length)
389 { 387 {
390 int l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE); 388 int l = MIN(length, BLEND_GRADIENT_BUFFER_SIZE);
391 fetchfunc(gradientbuffer, data, spans->y, spans->x, l); 389 fetchfunc(gradientbuffer, sd, spans->y, spans->x, l);
392 comp_func(temp, gradientbuffer, l, data->mul_col, spans->coverage); 390 comp_func(temp, gradientbuffer, l, sd->mul_col, spans->coverage);
393 391
394 for (int i = 0; i < l; i++) 392 for (int i = 0; i < l; i++)
395 { 393 {