move around - flatter.
[profile/ivi/evas.git] / src / lib / engines / common / evas_scale_smooth_scaler_down.c
1 {
2    DATA32  **ypoints;
3    int     *xpoints;
4    int     *xapoints, *xapp;
5    int     *yapoints, *yapp;
6    DATA32  *buf, *src_data;
7
8    RGBA_Gfx_Func      func;
9
10    src_data = src->image.data;
11
12    xpoints = scale_calc_x_points(src_region_w, dst_region_w);
13    ypoints = scale_calc_y_points(src_data, src_w, src_region_h, dst_region_h);
14    xapoints = scale_calc_a_points(src_region_w, dst_region_w);
15    yapoints = scale_calc_a_points(src_region_h, dst_region_h);
16    if ( (!xpoints) || (!ypoints) || (!xapoints) || (!yapoints) )
17         goto done_scale_down;
18
19    /* a scanline buffer */
20    buf = alloca(dst_clip_w * sizeof(DATA32));
21
22    if (dc->mul.use)
23         func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op);
24    else
25         func = evas_common_gfx_func_composite_pixel_span_get(src, dst, dst_clip_w, dc->render_op);
26   /* scaling down vertically */
27    if ((dst_region_w >= src_region_w) &&
28        (dst_region_h <  src_region_h))
29      {
30 #include "evas_scale_smooth_scaler_downy.c"
31      }
32    /* scaling down horizontally */
33    else if ((dst_region_w < src_region_w) &&
34             (dst_region_h >=  src_region_h))
35      {
36 #include "evas_scale_smooth_scaler_downx.c"
37      }
38    /* scaling down both vertically & horizontally */
39    else if ((dst_region_w < src_region_w) &&
40             (dst_region_h <  src_region_h))
41      {
42 #include "evas_scale_smooth_scaler_downx_downy.c"
43      }
44
45    done_scale_down:
46    if (xpoints) free(xpoints);
47    if (ypoints) free(ypoints);
48    if (xapoints) free(xapoints);
49    if (yapoints) free(yapoints);
50 }