summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/engines/common/evas_scale_sample.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c83
1 files changed, 78 insertions, 5 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
index 3b232213d4..ea1061802d 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
@@ -1,11 +1,28 @@
1#include "evas_common.h" 1#include "evas_common.h"
2#include "evas_blend_private.h" 2#include "evas_blend_private.h"
3 3
4void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h); 4static void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
5 5
6#ifndef BUILD_SCALE_SMOOTH 6#ifndef BUILD_SCALE_SMOOTH
7#ifdef BUILD_SCALE_SAMPLE 7#ifdef BUILD_SCALE_SAMPLE
8EAPI void 8EAPI void
9evas_common_scale_rgba_in_to_out_clip_smooth_do(const Cutout_Rects *reuse,
10 const Eina_Rectangle *clip,
11 RGBA_Image *src, RGBA_Image *dst,
12 RGBA_Draw_Context *dc,
13 int src_region_x, int src_region_y,
14 int src_region_w, int src_region_h,
15 int dst_region_x, int dst_region_y,
16 int dst_region_w, int dst_region_h)
17{
18 evas_common_scale_rgba_in_to_out_clip_sample_do(reuse, clip, src, dst, dc,
19 src_region_x, src_region_y,
20 src_region_w, src_region_h,
21 dst_region_x, dst_region_y,
22 dst_region_w, dst_region_h);
23}
24
25EAPI void
9evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst, 26evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
10 RGBA_Draw_Context *dc, 27 RGBA_Draw_Context *dc,
11 int src_region_x, int src_region_y, 28 int src_region_x, int src_region_y,
@@ -31,7 +48,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
31 int dst_region_x, int dst_region_y, 48 int dst_region_x, int dst_region_y,
32 int dst_region_w, int dst_region_h) 49 int dst_region_w, int dst_region_h)
33{ 50{
34 Cutout_Rects *rects; 51 static Cutout_Rects *rects = NULL;
35 Cutout_Rect *r; 52 Cutout_Rect *r;
36 int c, cx, cy, cw, ch; 53 int c, cx, cy, cw, ch;
37 int i; 54 int i;
@@ -60,7 +77,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
60 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 77 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
61 return; 78 return;
62 } 79 }
63 rects = evas_common_draw_context_apply_cutouts(dc); 80 rects = evas_common_draw_context_apply_cutouts(dc, rects);
64 for (i = 0; i < rects->active; ++i) 81 for (i = 0; i < rects->active; ++i)
65 { 82 {
66 r = rects->rects + i; 83 r = rects->rects + i;
@@ -72,12 +89,51 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
72 dst_region_w, dst_region_h); 89 dst_region_w, dst_region_h);
73 90
74 } 91 }
75 evas_common_draw_context_apply_clear_cutouts(rects);
76 /* restore clip info */ 92 /* restore clip info */
77 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; 93 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
78} 94}
79 95
80void 96EAPI void
97evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
98 const Eina_Rectangle *clip,
99 RGBA_Image *src, RGBA_Image *dst,
100 RGBA_Draw_Context *dc,
101 int src_region_x, int src_region_y,
102 int src_region_w, int src_region_h,
103 int dst_region_x, int dst_region_y,
104 int dst_region_w, int dst_region_h)
105{
106 Eina_Rectangle area;
107 Cutout_Rect *r;
108 int i;
109
110 if (!reuse)
111 {
112 evas_common_draw_context_set_clip(dc, clip->x, clip->y, clip->w, clip->h);
113 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
114 src_region_x, src_region_y,
115 src_region_w, src_region_h,
116 dst_region_x, dst_region_y,
117 dst_region_w, dst_region_h);
118 return;
119 }
120
121 for (i = 0; i < reuse->active; ++i)
122 {
123 r = reuse->rects + i;
124
125 EINA_RECTANGLE_SET(&area, r->x, r->y, r->w, r->h);
126 if (!eina_rectangle_intersection(&area, clip)) continue ;
127 evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
128 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
129 src_region_x, src_region_y,
130 src_region_w, src_region_h,
131 dst_region_x, dst_region_y,
132 dst_region_w, dst_region_h);
133 }
134}
135
136static void
81scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst, 137scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
82 RGBA_Draw_Context *dc, 138 RGBA_Draw_Context *dc,
83 int src_region_x, int src_region_y, 139 int src_region_x, int src_region_y,
@@ -403,5 +459,22 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
403 dst_region_x, dst_region_y, 459 dst_region_x, dst_region_y,
404 dst_region_w, dst_region_h); 460 dst_region_w, dst_region_h);
405} 461}
462
463EAPI void
464evas_common_scale_rgba_in_to_out_clip_sample_do(const Cutout_Rects *reuse,
465 const Eina_Rectangle *clip,
466 RGBA_Image *src, RGBA_Image *dst,
467 RGBA_Draw_Context *dc,
468 int src_region_x, int src_region_y,
469 int src_region_w, int src_region_h,
470 int dst_region_x, int dst_region_y,
471 int dst_region_w, int dst_region_h)
472{
473 evas_common_scale_rgba_in_to_out_clip_smooth_do(reuse, clip, src, dst, dc,
474 src_region_x, src_region_y,
475 src_region_w, src_region_h,
476 dst_region_x, dst_region_y,
477 dst_region_w, dst_region_h);
478}
406#endif 479#endif
407#endif 480#endif