summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-05-21 20:23:17 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-05-21 20:27:15 +0200
commit3081d9b8ea5c411fe0dd75b08a65d556103e1409 (patch)
tree79380f1acdbe9c21f7003c65a7dcac86fc7df3d0 /src
parent7c78938689e4cdd9682dd52def70d8206e49aae4 (diff)
evas/scale_sample: even more code deduplication
Summary: how many times was this block of code copied around??? no functional changes Depends on D8848 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl_rendering Differential Revision: https://phab.enlightenment.org/D8849
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/common/evas_scale_sample.c60
1 files changed, 15 insertions, 45 deletions
diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c
index a498b3cea0..c201dfb292 100644
--- a/src/lib/evas/common/evas_scale_sample.c
+++ b/src/lib/evas/common/evas_scale_sample.c
@@ -415,10 +415,9 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
415{ 415{
416 int x, y; 416 int x, y;
417 int *lin_ptr; 417 int *lin_ptr;
418 DATA32 *buf = NULL, *dptr; 418 DATA32 *dptr;
419 DATA32 **row_ptr; 419 DATA32 **row_ptr;
420 DATA32 *ptr, *dst_ptr, *src_data, *dst_data; 420 DATA32 *ptr, *dst_ptr, *src_data, *dst_data;
421 DATA8 *mask;
422 int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h; 421 int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h;
423 int src_w, src_h, dst_w, dst_h, mask_x, mask_y; 422 int src_w, src_h, dst_w, dst_h, mask_x, mask_y;
424 RGBA_Gfx_Func func, func2 = NULL; 423 RGBA_Gfx_Func func, func2 = NULL;
@@ -563,15 +562,6 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
563 func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op); 562 func = evas_common_gfx_func_composite_pixel_mask_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, dst_clip_w, dc->render_op);
564 if (dc->mul.use) 563 if (dc->mul.use)
565 func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, dst_clip_w, EVAS_RENDER_COPY); 564 func2 = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->mul.col, dst->cache_entry.flags.alpha, dst_clip_w, EVAS_RENDER_COPY);
566 /* clamp/map to mask geometry */
567 if (EINA_UNLIKELY(dst_clip_x < mask_x))
568 dst_clip_x = mask_x;
569 if (EINA_UNLIKELY(dst_clip_y < mask_y))
570 dst_clip_y = mask_y;
571 if (EINA_UNLIKELY(dst_clip_x + dst_clip_w > mask_x + (int)mask_ie->cache_entry.w))
572 dst_clip_w = mask_x + mask_ie->cache_entry.w - dst_clip_x;
573 if (EINA_UNLIKELY(dst_clip_y + dst_clip_h > mask_y + (int)mask_ie->cache_entry.h))
574 dst_clip_h = mask_y + mask_ie->cache_entry.h - dst_clip_y;
575 } 565 }
576 566
577 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h)) 567 if ((dst_region_w == src_region_w) && (dst_region_h == src_region_h))
@@ -600,44 +590,24 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
600# endif 590# endif
601#endif 591#endif
602 { 592 {
593 int mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
603 ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x; 594 ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x;
604 595
605 /* image masking */
606 if (mask_ie) 596 if (mask_ie)
607 { 597 _evas_common_scale_rgba_sample_scale_mask(0,
608 if (dc->mul.use) 598 dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h,
609 buf = alloca(dst_clip_w * sizeof(DATA32)); 599 dst_w, mask_x, mask_y,
610 600 NULL, NULL,
611 for (y = 0; y < dst_clip_h; y++) 601 mask_ie, dst_ptr,
612 { 602 func, func2, mul_col,
613 mask = mask_ie->image.data8 603 ptr, src_w);
614 + ((dst_clip_y - mask_y + y) * mask_ie->cache_entry.w)
615 + (dst_clip_x - mask_x);
616
617 /* * blend here [clip_w *] ptr -> dst_ptr * */
618 if (dc->mul.use)
619 {
620 func2(ptr, NULL, dc->mul.col, buf, dst_clip_w);
621 func(buf, mask, 0, dst_ptr, dst_clip_w);
622 }
623 else
624 func(ptr, mask, 0, dst_ptr, dst_clip_w);
625
626 ptr += src_w;
627 dst_ptr += dst_w;
628 }
629 }
630 else 604 else
631 { 605 _evas_common_scale_rgba_sample_scale_nomask(0,
632 for (y = 0; y < dst_clip_h; y++) 606 dst_clip_w, dst_clip_h, dst_w,
633 { 607 NULL, NULL,
634 /* * blend here [clip_w *] ptr -> dst_ptr * */ 608 dst_ptr,
635 func(ptr, NULL, dc->mul.col, dst_ptr, dst_clip_w); 609 func, mul_col,
636 610 ptr, src_w);
637 ptr += src_w;
638 dst_ptr += dst_w;
639 }
640 }
641 } 611 }
642 } 612 }
643 else 613 else