summaryrefslogtreecommitdiff
path: root/src/lib/ector/software
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-12-06 10:37:31 +0900
committerHermet Park <hermetpark@gmail.com>2019-12-06 10:37:31 +0900
commit562ae738ccafbe1d876cc1a90de79fe97ad3ba79 (patch)
treefd12feaf31cd3d03aec8d781753a480b68cd360d /src/lib/ector/software
parentc86f77ff6e700d96f7ba3634ba6c1116c1dc1941 (diff)
ector_software_rasterizer: use dynamic array by span size.
Summary: When use with intersect mask, if span_count over span array size, composition is to be wrong. So, In this case, we use dynamic array by span_count. Test Plan: N/A Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: vtorri, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10748
Diffstat (limited to 'src/lib/ector/software')
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index fd59686131..bbaba4802d 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -522,12 +522,29 @@ _span_fill_clipRect(int span_count, const SW_FT_Span *spans, void *user_data)
522{ 522{
523 const int NSPANS = 256; 523 const int NSPANS = 256;
524 int clip_count, i; 524 int clip_count, i;
525 SW_FT_Span cspans[NSPANS];
526 Span_Data *fill_data = (Span_Data *) user_data; 525 Span_Data *fill_data = (Span_Data *) user_data;
527 Clip_Data clip = fill_data->clip; 526 Clip_Data clip = fill_data->clip;
528 SW_FT_Span *clipped; 527 SW_FT_Span *clipped;
529 Eina_Rectangle *rect; 528 Eina_Rectangle *rect;
530 Eina_Rectangle tmp_rect; 529 Eina_Rectangle tmp_rect;
530 SW_FT_Span *cspans = NULL;
531 Eina_Bool intersect = EINA_FALSE;
532
533 //Note: Uses same span_count sized heap memory in intersect mask case.
534 if (fill_data->comp_method == EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT)
535 {
536 intersect = EINA_TRUE;
537 cspans = malloc(sizeof(SW_FT_Span) * (span_count));
538 if (!cspans)
539 {
540 ERR("OOM: Failed malloc()");
541 return ;
542 }
543 }
544 else
545 {
546 cspans = alloca(sizeof(SW_FT_Span) * (NSPANS));
547 }
531 548
532 clip_count = eina_array_count(clip.clips); 549 clip_count = eina_array_count(clip.clips);
533 550
@@ -545,11 +562,12 @@ _span_fill_clipRect(int span_count, const SW_FT_Span *spans, void *user_data)
545 while (spans < end) 562 while (spans < end)
546 { 563 {
547 clipped = cspans; 564 clipped = cspans;
548 spans = _intersect_spans_rect(&tmp_rect, spans, end, &clipped, NSPANS); 565 spans = _intersect_spans_rect(&tmp_rect, spans, end, &clipped, intersect ? span_count : NSPANS);
549 if (clipped - cspans) 566 if (clipped - cspans)
550 fill_data->unclipped_blend(clipped - cspans, cspans, fill_data); 567 fill_data->unclipped_blend(clipped - cspans, cspans, fill_data);
551 } 568 }
552 } 569 }
570 if (intersect && cspans) free(cspans);
553} 571}
554 572
555static void 573static void
@@ -557,20 +575,38 @@ _span_fill_clipPath(int span_count, const SW_FT_Span *spans, void *user_data)
557{ 575{
558 const int NSPANS = 256; 576 const int NSPANS = 256;
559 int current_clip = 0; 577 int current_clip = 0;
560 SW_FT_Span cspans[NSPANS];
561 Span_Data *fill_data = (Span_Data *) user_data; 578 Span_Data *fill_data = (Span_Data *) user_data;
562 Clip_Data clip = fill_data->clip; 579 Clip_Data clip = fill_data->clip;
563 SW_FT_Span *clipped; 580 SW_FT_Span *clipped;
581 SW_FT_Span *cspans = NULL;
582 Eina_Bool intersect = EINA_FALSE;
583
584 //Note: Uses same span_count sized heap memory in intersect mask case.
585 if (fill_data->comp_method == EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT)
586 {
587 intersect = EINA_TRUE;
588 cspans = malloc(sizeof(SW_FT_Span) * (span_count));
589 if (!cspans)
590 {
591 ERR("OOM: Failed malloc()");
592 return ;
593 }
594 }
595 else
596 {
597 cspans = alloca(sizeof(SW_FT_Span) * (NSPANS));
598 }
564 599
565 // FIXME: Take clip path offset into account. 600 // FIXME: Take clip path offset into account.
566 const SW_FT_Span *end = spans + span_count; 601 const SW_FT_Span *end = spans + span_count;
567 while (spans < end) 602 while (spans < end)
568 { 603 {
569 clipped = cspans; 604 clipped = cspans;
570 spans = _intersect_spans_region(clip.path, &current_clip, spans, end, &clipped, NSPANS); 605 spans = _intersect_spans_region(clip.path, &current_clip, spans, end, &clipped, intersect ? span_count : NSPANS);
571 if (clipped - cspans) 606 if (clipped - cspans)
572 fill_data->unclipped_blend(clipped - cspans, cspans, fill_data); 607 fill_data->unclipped_blend(clipped - cspans, cspans, fill_data);
573 } 608 }
609 if (intersect && cspans) free(cspans);
574} 610}
575 611
576static void 612static void