summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_scale_sample.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@profusion.mobi>2012-11-28 22:49:19 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-11-28 22:49:19 +0000
commit6ae734468301f732c9668f4cb74bc73e47c8baae (patch)
treea619d19a180f0d13a3c486b36ca9be46e1094f5e /src/lib/evas/common/evas_scale_sample.c
parent951a95c9840b079b4e24162cab89909a5b4472c5 (diff)
evas/image: Refactor common code for image drawing
This patch refactors common code for image draws - so that it can be used by other engines and *threaded* X11. Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi> Patch by: Paulo Alcantara <pcacjr@profusion.mobi> SVN revision: 79795
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_scale_sample.c58
1 files changed, 10 insertions, 48 deletions
diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c
index f78aad3879..9a94f904ea 100644
--- a/src/lib/evas/common/evas_scale_sample.c
+++ b/src/lib/evas/common/evas_scale_sample.c
@@ -5,55 +5,17 @@ static void scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Imag
5 5
6EAPI void 6EAPI void
7evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst, 7evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
8 RGBA_Draw_Context *dc, 8 RGBA_Draw_Context *dc,
9 int src_region_x, int src_region_y, 9 int src_region_x, int src_region_y,
10 int src_region_w, int src_region_h, 10 int src_region_w, int src_region_h,
11 int dst_region_x, int dst_region_y, 11 int dst_region_x, int dst_region_y,
12 int dst_region_w, int dst_region_h) 12 int dst_region_w, int dst_region_h)
13{ 13{
14 static Cutout_Rects *rects = NULL; 14 evas_common_scale_rgba_in_to_out_clip_cb
15 Cutout_Rect *r; 15 (src, dst, dc,
16 int c, cx, cy, cw, ch; 16 src_region_x, src_region_y, src_region_w, src_region_h,
17 int i; 17 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
18 /* handle cutouts here! */ 18 scale_rgba_in_to_out_clip_sample_internal);
19
20 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return;
21 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
22 return;
23 /* no cutouts - cut right to the chase */
24 if (!dc->cutout.rects)
25 {
26 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
27 src_region_x, src_region_y,
28 src_region_w, src_region_h,
29 dst_region_x, dst_region_y,
30 dst_region_w, dst_region_h);
31 return;
32 }
33 /* save out clip info */
34 c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
35 evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
36 evas_common_draw_context_clip_clip(dc, dst_region_x, dst_region_y, dst_region_w, dst_region_h);
37 /* our clip is 0 size.. abort */
38 if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
39 {
40 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
41 return;
42 }
43 rects = evas_common_draw_context_apply_cutouts(dc, rects);
44 for (i = 0; i < rects->active; ++i)
45 {
46 r = rects->rects + i;
47 evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
48 scale_rgba_in_to_out_clip_sample_internal(src, dst, dc,
49 src_region_x, src_region_y,
50 src_region_w, src_region_h,
51 dst_region_x, dst_region_y,
52 dst_region_w, dst_region_h);
53
54 }
55 /* restore clip info */
56 dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
57} 19}
58 20
59EAPI void 21EAPI void