jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=237fdd3db89d3a8736771bc0bc75ba43fb1404ac

commit 237fdd3db89d3a8736771bc0bc75ba43fb1404ac
Author: Jaeun Choi <[email protected]>
Date:   Wed Oct 22 19:59:50 2014 +0900

    Evas: Improved code consistency
    
    Signed-off-by: Jean-Philippe Andre <[email protected]>
---
 src/lib/evas/common/evas_scale_sample.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/lib/evas/common/evas_scale_sample.c 
b/src/lib/evas/common/evas_scale_sample.c
index 57fcd16..8b52280 100644
--- a/src/lib/evas/common/evas_scale_sample.c
+++ b/src/lib/evas/common/evas_scale_sample.c
@@ -63,9 +63,8 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, 
RGBA_Image *dst, int dst_cli
 {
    int      x, y;
    int     *lin_ptr;
-   int      offset;
    DATA32  *buf, *dptr;
-   DATA32  *row_ptr;
+   DATA32 **row_ptr;
    DATA32  *ptr, *dst_ptr, *src_data, *dst_data;
    int      src_w, src_h, dst_w, dst_h;
    RGBA_Gfx_Func func;
@@ -220,10 +219,14 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, 
RGBA_Image *dst, int dst_cli
      {
         /* allocate scale lookup tables */
         lin_ptr = alloca(dst_clip_w * sizeof(int));
+        row_ptr = alloca(dst_clip_h * sizeof(DATA32 *));
 
         /* fill scale tables */
         for (x = 0; x < dst_clip_w; x++)
           lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * src_region_w) / 
dst_region_w) + src_region_x;
+        for (y = 0; y < dst_clip_h; y++)
+          row_ptr[y] = src_data + (((((y + dst_clip_y - dst_region_y) * 
src_region_h) / dst_region_h)
+                                    + src_region_y) * src_w);
 
         /* scale to dst */
         dptr = dst_ptr;
@@ -231,16 +234,13 @@ evas_common_scale_rgba_sample_draw(RGBA_Image *src, 
RGBA_Image *dst, int dst_cli
         /* a scanline buffer */
         buf = alloca(dst_clip_w * sizeof(DATA32));
 
-        offset = dst_clip_y - dst_region_y;
-
         for (y = 0; y < dst_clip_h; y++)
           {
              dst_ptr = buf;
-             row_ptr = src_data + (((((y + offset) * src_region_h) / 
dst_region_h) + src_region_y) * src_w);
 
              for (x = 0; x < dst_clip_w; x++)
                {
-                  ptr = row_ptr + lin_ptr[x];
+                  ptr = row_ptr[y] + lin_ptr[x];
                   *dst_ptr = *ptr;
                   dst_ptr++;
                }
@@ -389,10 +389,6 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, 
RGBA_Image *dst,
      }
    if (dst_clip_h <= 0) return EINA_FALSE;
 
-   /* allocate scale lookup tables */
-   lin_ptr = alloca(dst_clip_w * sizeof(int));
-   row_ptr = alloca(dst_clip_h * sizeof(DATA32 *));
-
    /* figure out dst jump */
    //dst_jump = dst_w - dst_clip_w;
 
@@ -443,6 +439,10 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, 
RGBA_Image *dst,
      }
    else
      {
+        /* allocate scale lookup tables */
+        lin_ptr = alloca(dst_clip_w * sizeof(int));
+        row_ptr = alloca(dst_clip_h * sizeof(DATA32 *));
+
         /* fill scale tables */
         for (x = 0; x < dst_clip_w; x++)
           lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * src_region_w) / 
dst_region_w) + src_region_x;

-- 


Reply via email to