Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : proto/python-efl

Dir     : e17/proto/python-efl/python-evas/evas


Modified Files:
        evas.c_evas_object_image.pxi evas_object_image_mask.c 
        evas_object_image_rotate.c 


Log Message:
Reformat to fit coding style + unify headers

This should change no logic, just coding style. Next commits will
change types and break some functions into smaller pieces.


===================================================================
RCS file: 
/cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_object_image.pxi,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- evas.c_evas_object_image.pxi        6 Dec 2007 15:28:11 -0000       1.15
+++ evas.c_evas_object_image.pxi        12 Mar 2008 18:53:55 -0000      1.16
@@ -1,30 +1,9 @@
 # This file is included verbatim by c_evas.pyx
 
 
-## for mask support
-cdef extern from "evas_object_image_mask.h":
-    int evas_object_image_mask_fill(Evas_Object *src, Evas_Object *mask, 
-        Evas_Object *surface, int x_mask, int y_mask, int x_surface, int 
y_surface)
-
-def image_mask_fill(source, mask, surface, int x_mask, int y_mask, 
-    int x_surface, int y_surface):
-        cdef Image isource = <Image> source
-        cdef Image imask = <Image> mask
-        cdef Image isurface = <Image> surface
-        evas_object_image_mask_fill(isource.obj, imask.obj, isurface.obj, 
-           x_mask, y_mask, x_surface, y_surface)
-
-
-## for rotate support
-cdef extern from "evas_object_image_rotate.h":
-    ctypedef enum Rotation:
-            ROTATE_NONE
-            ROTATE_90
-            ROTATE_180
-            ROTATE_270
-
-    void evas_object_image_rotate(Evas_Object *image, Rotation rotation)
-
+def image_mask_fill(Image source, Image mask, Image surface, int x_mask, int 
y_mask, int x_surface, int y_surface):
+    evas_object_image_mask_fill(source.obj, mask.obj, surface.obj,
+                                x_mask, y_mask, x_surface, y_surface)
 
 cdef int _data_size_get(Evas_Object *obj):
     cdef int stride, h, bpp, cspace, have_alpha
@@ -464,7 +443,7 @@
             self.colorspace_set(value)
 
     def rotate(self, int rotation):
-        evas_object_image_rotate(self.obj, <Rotation>rotation)
+        evas_object_image_rotate(self.obj, 
<Evas_Object_Image_Rotation>rotation)
 
     def reload(self):
         "Force reload of image data."
===================================================================
RCS file: 
/cvs/e/e17/proto/python-efl/python-evas/evas/evas_object_image_mask.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- evas_object_image_mask.c    6 Dec 2007 15:28:11 -0000       1.1
+++ evas_object_image_mask.c    12 Mar 2008 18:53:55 -0000      1.2
@@ -2,51 +2,42 @@
 #include <stdlib.h>
 #include <Evas.h>
 
-#include "evas_object_image_mask.h"
-
-typedef unsigned char DATA8;
-typedef short int DATA16;
-typedef int DATA32;
-
-enum {FALSE, TRUE};
-
+#include "evas_object_image_python_extras.h"
 
 #define BPIXEL(base, x, y, stride) (base + (y * stride + x))
-
 #define MEDPIXEL(src, msk, srf) (((src) * (msk)) + (srf) * (255 - (msk)))/255
 
 
 static void
-_argb8888_image_mask_fill(char *dst, const char *src,
-    const char *msk, const char *srf,
-    int x_msk, int y_msk, int x_srf, int y_srf,
-    int src_stride, int src_width, int src_height,
-    int msk_stride, int msk_width, int msk_height,
-    int srf_stride, int srf_width, int srf_height)
+_argb8888_image_mask_fill(char *dst, const char *src, const char *msk, const 
char *srf, int x_msk, int y_msk, int x_srf, int y_srf, int src_stride, int 
src_width, int src_height, int msk_stride, int msk_width, int msk_height, int 
srf_stride, int srf_width, int srf_height)
 {
-    int x, y, xp, yp, xs, ys;
-    int r, g, b, a;
-    DATA32 pixel, pxa, pxb;
-    DATA32 *sp = (DATA32 *) src;
-    DATA32 *mp = (DATA32 *) msk;
-    DATA32 *fp = (DATA32 *) srf;
-    DATA32 *dp = (DATA32 *) dst;
-
-    for (y = 0; y < src_height; y++)
-        for (x = 0; x < src_width; x++)
-        {
-            xp = x - x_msk;
-            yp = y - y_msk;
-            xs = x - x_srf;
-            ys = y - y_srf;
-
-            pixel = *(BPIXEL(sp, x, y, src_stride));
-
-            if (xp >= 0 && xp < msk_width && yp >= 0 && yp < msk_height
-                && xs >= 0 && xs < srf_width && ys >= 0 && ys < srf_height) {
-                pxa = *(BPIXEL(mp, xp, yp, msk_stride));
-                pxb = *(BPIXEL(fp, xs, ys, srf_stride));
-                if(pxa != 0) {
+   int x, y, xp, yp, xs, ys;
+   int r, g, b, a;
+   DATA32 pixel, pxa, pxb;
+   DATA32 *sp = (DATA32 *) src;
+   DATA32 *mp = (DATA32 *) msk;
+   DATA32 *fp = (DATA32 *) srf;
+   DATA32 *dp = (DATA32 *) dst;
+
+   for (y = 0; y < src_height; y++)
+     for (x = 0; x < src_width; x++)
+       {
+         xp = x - x_msk;
+         yp = y - y_msk;
+         xs = x - x_srf;
+         ys = y - y_srf;
+
+         pixel = *(BPIXEL(sp, x, y, src_stride));
+
+         if ((xp >= 0) && (xp < msk_width) &&
+             (yp >= 0) && (yp < msk_height) &&
+             (xs >= 0) && (xs < srf_width) &&
+             (ys >= 0) && (ys < srf_height))
+           {
+              pxa = *(BPIXEL(mp, xp, yp, msk_stride));
+              pxb = *(BPIXEL(fp, xs, ys, srf_stride));
+              if (pxa != 0)
+                {
                     a = MEDPIXEL((pixel >> 24) & 0xFF,
                                  (pxa >> 24) & 0xFF, (pxb >> 24) & 0xFF);
                     r = MEDPIXEL((pixel >> 16) & 0xFF,
@@ -55,75 +46,75 @@
                                  (pxa >> 8) & 0xFF, (pxb >> 8) & 0xFF);
                     b = MEDPIXEL(pixel & 0xFF, pxa & 0xFF, pxb & 0xFF);
                     pixel = (a << 24) | (r << 16) | (g << 8) | b;
-                }
+                }
             }
 
-            *(BPIXEL(dp, x, y, src_stride)) = pixel;
-        }
+         *(BPIXEL(dp, x, y, src_stride)) = pixel;
+       }
 }
 
 
 int
-evas_object_image_mask_fill(Evas_Object *src, Evas_Object *mask,
-    Evas_Object *surface, int x_mask, int y_mask, int x_surface, int y_surface)
+evas_object_image_mask_fill(Evas_Object *src, Evas_Object *mask, Evas_Object 
*surface, int x_mask, int y_mask, int x_surface, int y_surface)
 {
-    int alloc_size;
-    unsigned char has_alpha;
-    char *src_data;
-    char *msk_data;
-    char *srf_data;
-    char *new_buffer;
-    int src_stride, src_width, src_height;
-    int msk_stride, msk_width, msk_height;
-    int srf_stride, srf_width, srf_height;
-
-    Evas_Colorspace src_colorspace = evas_object_image_colorspace_get(src);
-    Evas_Colorspace msk_colorspace = evas_object_image_colorspace_get(mask);
-    Evas_Colorspace srf_colorspace = evas_object_image_colorspace_get(surface);
-
-    if (src_colorspace != msk_colorspace || src_colorspace != srf_colorspace) {
-        /* force use the same colorspace */
-        return 1;
-    }
-
-    evas_object_image_size_get(src, &src_width, &src_height);
-    src_stride = evas_object_image_stride_get(src);
-    evas_object_image_size_get(mask, &msk_width, &msk_height);
-    msk_stride = evas_object_image_stride_get(mask);
-    evas_object_image_size_get(surface, &srf_width, &srf_height);
-    srf_stride = evas_object_image_stride_get(surface);
-
-    has_alpha = evas_object_image_alpha_get(src);
-
-    switch(src_colorspace) {
-        case EVAS_COLORSPACE_ARGB8888:
-            alloc_size = IMG_BYTE_SIZE_ARGB8888(src_stride, src_height, 
src_stride);
-            new_buffer = (char *) malloc(alloc_size);
-            if(new_buffer == NULL)
-                return 3;
-
-            src_data = (char *) evas_object_image_data_get(src, FALSE);
-            msk_data = (char *) evas_object_image_data_get(mask, FALSE);
-            srf_data = (char *) evas_object_image_data_get(surface, FALSE);
-
-            _argb8888_image_mask_fill(new_buffer, src_data, msk_data,
-                srf_data, x_mask, y_mask, x_surface, y_surface,
-                src_stride, src_width, src_height,
-                msk_stride, msk_width, msk_height,
-                srf_stride, srf_width, srf_height);
-            break;
-        case EVAS_COLORSPACE_RGB565_A5P:
-            /* TODO */
-            return 2;
-        default:
-            /* invalid colorspace */
-            return 2;
-    }
+   int alloc_size;
+   unsigned char has_alpha;
+   char *src_data;
+   char *msk_data;
+   char *srf_data;
+   char *new_buffer;
+   int src_stride, src_width, src_height;
+   int msk_stride, msk_width, msk_height;
+   int srf_stride, srf_width, srf_height;
+
+   Evas_Colorspace src_colorspace = evas_object_image_colorspace_get(src);
+   Evas_Colorspace msk_colorspace = evas_object_image_colorspace_get(mask);
+   Evas_Colorspace srf_colorspace = evas_object_image_colorspace_get(surface);
+
+   if ((src_colorspace != msk_colorspace) || (src_colorspace != 
srf_colorspace))
+     /* force use the same colorspace */
+     return 1;
+
+   evas_object_image_size_get(src, &src_width, &src_height);
+   src_stride = evas_object_image_stride_get(src);
+   evas_object_image_size_get(mask, &msk_width, &msk_height);
+   msk_stride = evas_object_image_stride_get(mask);
+   evas_object_image_size_get(surface, &srf_width, &srf_height);
+   srf_stride = evas_object_image_stride_get(surface);
+
+   has_alpha = evas_object_image_alpha_get(src);
+
+   switch (src_colorspace)
+     {
+      case EVAS_COLORSPACE_ARGB8888:
+        alloc_size = IMG_BYTE_SIZE_ARGB8888(src_stride, src_height, 
src_stride);
+        new_buffer = malloc(alloc_size);
+        if (!new_buffer)
+          return 3;
+
+        src_data = evas_object_image_data_get(src, 0);
+        msk_data = evas_object_image_data_get(mask, 0);
+        srf_data = evas_object_image_data_get(surface, 0);
+
+        _argb8888_image_mask_fill(new_buffer, src_data, msk_data,
+                                  srf_data, x_mask, y_mask,
+                                  x_surface, y_surface,
+                                  src_stride, src_width, src_height,
+                                  msk_stride, msk_width, msk_height,
+                                  srf_stride, srf_width, srf_height);
+        break;
+      case EVAS_COLORSPACE_RGB565_A5P:
+        /* TODO */
+        return 2;
+      default:
+        /* invalid colorspace */
+        return 2;
+     }
 
-    evas_object_image_data_update_add(src, 0, 0, src_width, src_height);
-    evas_object_image_data_copy_set(src, new_buffer);
+   evas_object_image_data_update_add(src, 0, 0, src_width, src_height);
+   evas_object_image_data_copy_set(src, new_buffer);
 
-    free(new_buffer);
+   free(new_buffer);
 
-    return 0;
+   return 0;
 }
===================================================================
RCS file: 
/cvs/e/e17/proto/python-efl/python-evas/evas/evas_object_image_rotate.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_object_image_rotate.c  12 Mar 2008 14:30:38 -0000      1.3
+++ evas_object_image_rotate.c  12 Mar 2008 18:53:55 -0000      1.4
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <Evas.h>
 
-#include "evas_object_image_rotate.h"
+#include "evas_object_image_python_extras.h"
 
 static inline int
 _calc_stride(int w)
@@ -15,422 +15,424 @@
 }
 
 static inline int
-_calc_image_byte_size(Evas_Colorspace colorspace, Rotation rotation,
-                      int stride, int w, int h, unsigned char has_alpha)
+_calc_image_byte_size(Evas_Colorspace colorspace, Evas_Object_Image_Rotation 
rotation, int stride, int w, int h, unsigned char has_alpha)
 {
-    int dst_stride, dst_height;
-    int image_byte_size;
+   int dst_stride, dst_height;
+   int image_byte_size;
 
-    if (rotation == ROTATE_90 || rotation == ROTATE_270) {
+   if ((rotation == ROTATE_90) || (rotation == ROTATE_270))
+     {
         dst_stride = _calc_stride(h);
         dst_height = w;
-    } else {
+     }
+   else
+     {
         dst_stride = stride;
         dst_height = h;
-    }
+     }
 
-    switch (colorspace) {
-        case EVAS_COLORSPACE_ARGB8888:
-            image_byte_size = IMG_BYTE_SIZE_ARGB8888(dst_stride, dst_height, 
has_alpha);
-            break;
-        case EVAS_COLORSPACE_RGB565_A5P:
-            image_byte_size = IMG_BYTE_SIZE_RGB565(dst_stride, dst_height, 
has_alpha);
-            break;
-        default:
-            image_byte_size = -1;
-            break;
-    }
+   switch (colorspace)
+     {
+      case EVAS_COLORSPACE_ARGB8888:
+        image_byte_size = IMG_BYTE_SIZE_ARGB8888(dst_stride, dst_height, 
has_alpha);
+        break;
+      case EVAS_COLORSPACE_RGB565_A5P:
+        image_byte_size = IMG_BYTE_SIZE_RGB565(dst_stride, dst_height, 
has_alpha);
+        break;
+      default:
+        image_byte_size = -1;
+        break;
+     }
 
-    return image_byte_size;
+   return image_byte_size;
 }
 
 static void
-_data8_image_rotate_90(char *dst, const char *src,
-                       int dst_stride, int src_stride,
-                       int out_x, int out_y, int w, int h)
+_data8_image_rotate_90(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA8 *dp, *sp;
-    int x, y;
+   DATA8 *dp, *sp;
+   int x, y;
 
-    sp = (DATA8 *) src;
-    dp = ((DATA8 *) dst) + ((out_x +
-         (w + out_y - 1) * dst_stride));
+   sp = (DATA8 *) src;
+   dp = ((DATA8 *) dst) + ((out_x +
+                           (w + out_y - 1) * dst_stride));
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA8 *dp_itr, *sp_itr;
 
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
-            *dp_itr = *sp_itr;
-
-            sp_itr++;
-            dp_itr -= dst_stride;
-        }
+        for (x = 0; x < w; x++)
+         {
+            *dp_itr = *sp_itr;
+
+            sp_itr++;
+            dp_itr -= dst_stride;
+         }
         sp += src_stride;
         dp++;
-    }
+     }
 }
 
 static void
-_data16_image_rotate_90(char *dst, const char *src,
-                        int dst_stride, int src_stride,
-                        int out_x, int out_y, int w, int h)
+_data16_image_rotate_90(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA16 *dp, *sp;
-    int x, y;
+   DATA16 *dp, *sp;
+   int x, y;
 
-    sp = (DATA16 *) src;
-    dp = ((DATA16 *) dst) + ((out_x +
-         (w + out_y - 1) * dst_stride));
+   sp = (DATA16 *) src;
+   dp = ((DATA16 *) dst) + ((out_x +
+                            (w + out_y - 1) * dst_stride));
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA16 *dp_itr, *sp_itr;
 
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
-            *dp_itr = *sp_itr;
-
-            sp_itr++;
-            dp_itr -= dst_stride;
-        }
+        for (x = 0; x < w; x++)
+         {
+            *dp_itr = *sp_itr;
+
+            sp_itr++;
+            dp_itr -= dst_stride;
+         }
         sp += src_stride;
         dp++;
-    }
+     }
 }
 
 static void
-_data32_image_rotate_90(char *dst, const char *src,
-                        int dst_stride, int src_stride,
-                        int out_x, int out_y, int w, int h)
+_data32_image_rotate_90(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA32 *dp, *sp;
-    int x, y;
+   DATA32 *dp, *sp;
+   int x, y;
 
-    sp = (DATA32 *) src;
-    dp = ((DATA32 *) dst) + ((out_x +
-         (w + out_y - 1) * dst_stride));
+   sp = (DATA32 *) src;
+   dp = ((DATA32 *) dst) + ((out_x +
+                            (w + out_y - 1) * dst_stride));
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA32 *dp_itr, *sp_itr;
 
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
-            *dp_itr = *sp_itr;
-
-            sp_itr++;
-            dp_itr -= dst_stride;
-        }
+        for (x = 0; x < w; x++)
+         {
+            *dp_itr = *sp_itr;
+
+            sp_itr++;
+            dp_itr -= dst_stride;
+         }
         sp += src_stride;
         dp++;
-    }
+     }
 }
 
 static void
-_data8_image_rotate_180(char *dst, const char *src,
-                        int dst_stride, int src_stride,
-                        int out_x, int out_y, int w, int h)
+_data8_image_rotate_180(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA8 *dp, *sp;
-    int x, y;
+   DATA8 *dp, *sp;
+   int x, y;
 
-    sp = (DATA8 *) src;
-    dp = ((DATA8 *) dst) + ((w + out_x - 1) +
-         (h + out_y - 1) * dst_stride);
+   sp = (DATA8 *) src;
+   dp = ((DATA8 *) dst) + ((w + out_x - 1) +
+                          (h + out_y - 1) * dst_stride);
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA8 *dp_itr, *sp_itr;
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
+        for (x = 0; x < w; x++)
+         {
              *dp_itr = *sp_itr;
 
              sp_itr++;
              dp_itr--;
-        }
+         }
         sp += src_stride;
         dp -= dst_stride;
-    }
+     }
 }
 
 static void
-_data16_image_rotate_180(char *dst, const char *src,
-                         int dst_stride, int src_stride,
-                         int out_x, int out_y, int w, int h)
+_data16_image_rotate_180(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA16 *dp, *sp;
-    int x, y;
+   DATA16 *dp, *sp;
+   int x, y;
 
-    sp = (DATA16 *) src;
-    dp = ((DATA16 *) dst) + ((w + out_x - 1) +
-         (h + out_y - 1) * dst_stride);
+   sp = (DATA16 *) src;
+   dp = ((DATA16 *) dst) + ((w + out_x - 1) +
+                           (h + out_y - 1) * dst_stride);
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA16 *dp_itr, *sp_itr;
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
+        for (x = 0; x < w; x++)
+         {
              *dp_itr = *sp_itr;
 
              sp_itr++;
              dp_itr--;
-        }
+         }
         sp += src_stride;
         dp -= dst_stride;
-    }
+     }
 }
 static void
-_data32_image_rotate_180(char *dst, const char *src,
-                         int dst_stride, int src_stride,
-                         int out_x, int out_y, int w, int h)
+_data32_image_rotate_180(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA32 *dp, *sp;
-    int x, y;
+   DATA32 *dp, *sp;
+   int x, y;
 
-    sp = (DATA32 *) src;
-    dp = ((DATA32 *) dst) + ((w + out_x - 1) +
-         (h + out_y - 1) * dst_stride);
+   sp = (DATA32 *) src;
+   dp = ((DATA32 *) dst) + ((w + out_x - 1) +
+                           (h + out_y - 1) * dst_stride);
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA32 *dp_itr, *sp_itr;
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
+        for (x = 0; x < w; x++)
+         {
              *dp_itr = *sp_itr;
 
              sp_itr++;
              dp_itr--;
-        }
+         }
         sp += src_stride;
         dp -= dst_stride;
-    }
+     }
 }
 
 static void
-_data8_image_rotate_270(char *dst, const char *src,
-                        int dst_stride, int src_stride,
-                        int out_x, int out_y, int w, int h)
+_data8_image_rotate_270(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA8 *dp, *sp;
-    int x, y;
+   DATA8 *dp, *sp;
+   int x, y;
 
-    sp = (DATA8 *) src;
-    dp = ((DATA8 *) dst) + ((h + out_x - 1) +
-         out_y * dst_stride);
+   sp = (DATA8 *) src;
+   dp = ((DATA8 *) dst) + ((h + out_x - 1) +
+                          out_y * dst_stride);
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA8 *dp_itr, *sp_itr;
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
+        for (x = 0; x < w; x++)
+         {
              *dp_itr = *sp_itr;
 
              sp_itr++;
              dp_itr += dst_stride;
-        }
+         }
         sp += src_stride;
         dp--;
-    }
+     }
 }
 
 static void
-_data16_image_rotate_270(char *dst, const char *src,
-                         int dst_stride, int src_stride,
-                         int out_x, int out_y, int w, int h)
+_data16_image_rotate_270(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA16 *dp, *sp;
-    int x, y;
+   DATA16 *dp, *sp;
+   int x, y;
 
-    sp = (DATA16 *) src;
-    dp = ((DATA16 *) dst) + ((h + out_x - 1) +
-         out_y * dst_stride);
+   sp = (DATA16 *) src;
+   dp = ((DATA16 *) dst) + ((h + out_x - 1) +
+                           out_y * dst_stride);
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA16 *dp_itr, *sp_itr;
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
+        for (x = 0; x < w; x++)
+         {
              *dp_itr = *sp_itr;
 
              sp_itr++;
              dp_itr += dst_stride;
-        }
+         }
         sp += src_stride;
         dp--;
-    }
+     }
 }
 
 static void
-_data32_image_rotate_270(char *dst, const char *src,
-                         int dst_stride, int src_stride,
-                         int out_x, int out_y, int w, int h)
+_data32_image_rotate_270(char *dst, const char *src, int dst_stride, int 
src_stride, int out_x, int out_y, int w, int h)
 {
-    DATA32 *dp, *sp;
-    int x, y;
+   DATA32 *dp, *sp;
+   int x, y;
 
-    sp = (DATA32 *) src;
-    dp = ((DATA32 *) dst) + ((h + out_x - 1) +
-         out_y * dst_stride);
+   sp = (DATA32 *) src;
+   dp = ((DATA32 *) dst) + ((h + out_x - 1) +
+                           out_y * dst_stride);
 
-    for (y = 0; y < h; y++) {
+   for (y = 0; y < h; y++)
+     {
         DATA32 *dp_itr, *sp_itr;
         sp_itr = sp;
         dp_itr = dp;
 
-        for (x = 0; x < w; x++) {
+        for (x = 0; x < w; x++)
+         {
              *dp_itr = *sp_itr;
 
              sp_itr++;
              dp_itr += dst_stride;
-        }
+         }
         sp += src_stride;
         dp--;
-    }
+     }
 }
 
 static void
-_rgb565_image_rotate(Rotation rotation,
-                     char *dst, const char *src,
-                     int src_stride, unsigned char has_alpha,
-                     int out_x, int out_y, int w, int h)
-{
-    int dst_stride;
-
-    char *dst_alpha;
-    const char *src_alpha;
-
-    if (has_alpha)
-        src_alpha = src + src_stride * h * 2;
-
-    switch (rotation) {
-        case ROTATE_90:
-            dst_stride = _calc_stride(h);
-            _data16_image_rotate_90(dst, src,
-                                    dst_stride, src_stride,
-                                    out_x, out_y, w, h);
-            if (has_alpha) {
-                dst_alpha = dst + dst_stride * w * 2;
-                _data8_image_rotate_90(dst_alpha, src_alpha,
-                                       dst_stride, src_stride,
-                                       out_x, out_y, w, h);
-            }
-            break;
-        case ROTATE_180:
-            dst_stride = src_stride;
-            _data16_image_rotate_180(dst, src,
-                                     dst_stride, src_stride,
-                                     out_x, out_y, w, h);
-            if (has_alpha) {
-                dst_alpha = dst + dst_stride * h * 2;
-                _data8_image_rotate_180(dst_alpha, src_alpha,
-                                        dst_stride, src_stride,
-                                        out_x, out_y, w, h);
-            }
-            break;
-        case ROTATE_270:
-            dst_stride = _calc_stride(h);
-            _data16_image_rotate_270(dst, src,
-                                     dst_stride, src_stride,
-                                     out_x, out_y, w, h);
-            if (has_alpha) {
-                dst_alpha = dst + dst_stride * w * 2;
-                _data8_image_rotate_270(dst_alpha, src_alpha,
-                                        dst_stride, src_stride,
-                                        out_x, out_y, w, h);
-            }
-            break;
-        case ROTATE_NONE:
-           break;
-    }
-}
-
-static void
-_argb8888_image_rotate(Rotation rotation,
-                       char *dst, const char *src,
-                       int src_stride,
-                       int out_x, int out_y, int w, int h)
-{
-    int dst_stride;
-
-    switch(rotation) {
-        case ROTATE_90:
-            dst_stride = h;
-            _data32_image_rotate_90(dst, src,
-                                    dst_stride, src_stride,
-                                    out_x, out_y, w, h);
-            break;
-        case ROTATE_180:
-            dst_stride = src_stride;
-            _data32_image_rotate_180(dst, src,
-                                     dst_stride, src_stride,
-                                     out_x, out_y, w, h);
-            break;
-        case ROTATE_270:
-            dst_stride = h;
-            _data32_image_rotate_270(dst, src,
-                                     dst_stride, src_stride,
-                                     out_x, out_y, w, h);
-            break;
-        case ROTATE_NONE:
-           break;
-    }
+_rgb565_image_rotate(Evas_Object_Image_Rotation rotation, char *dst, const 
char *src, int src_stride, unsigned char has_alpha, int out_x, int out_y, int 
w, int h)
+{
+   int dst_stride;
+   char *dst_alpha;
+   const char *src_alpha;
+
+   if (has_alpha)
+     src_alpha = src + src_stride * h * 2;
+
+   switch (rotation)
+     {
+      case ROTATE_90:
+        dst_stride = _calc_stride(h);
+        _data16_image_rotate_90(dst, src,
+                                dst_stride, src_stride,
+                                out_x, out_y, w, h);
+        if (has_alpha)
+          {
+             dst_alpha = dst + dst_stride * w * 2;
+             _data8_image_rotate_90(dst_alpha, src_alpha,
+                                    dst_stride, src_stride,
+                                    out_x, out_y, w, h);
+          }
+        break;
+      case ROTATE_180:
+        dst_stride = src_stride;
+        _data16_image_rotate_180(dst, src,
+                                 dst_stride, src_stride,
+                                 out_x, out_y, w, h);
+        if (has_alpha)
+          {
+             dst_alpha = dst + dst_stride * h * 2;
+             _data8_image_rotate_180(dst_alpha, src_alpha,
+                                     dst_stride, src_stride,
+                                     out_x, out_y, w, h);
+          }
+        break;
+      case ROTATE_270:
+        dst_stride = _calc_stride(h);
+        _data16_image_rotate_270(dst, src,
+                                 dst_stride, src_stride,
+                                 out_x, out_y, w, h);
+        if (has_alpha)
+          {
+             dst_alpha = dst + dst_stride * w * 2;
+             _data8_image_rotate_270(dst_alpha, src_alpha,
+                                     dst_stride, src_stride,
+                                     out_x, out_y, w, h);
+          }
+        break;
+      case ROTATE_NONE:
+        break;
+     }
+}
+
+static void
+_argb8888_image_rotate(Evas_Object_Image_Rotation rotation, char *dst, const 
char *src, int src_stride, int out_x, int out_y, int w, int h)
+{
+   int dst_stride;
+
+   switch(rotation)
+     {
+      case ROTATE_90:
+        dst_stride = h;
+        _data32_image_rotate_90(dst, src,
+                                dst_stride, src_stride,
+                                out_x, out_y, w, h);
+        break;
+      case ROTATE_180:
+        dst_stride = src_stride;
+        _data32_image_rotate_180(dst, src,
+                                 dst_stride, src_stride,
+                                 out_x, out_y, w, h);
+        break;
+      case ROTATE_270:
+        dst_stride = h;
+        _data32_image_rotate_270(dst, src,
+                                 dst_stride, src_stride,
+                                 out_x, out_y, w, h);
+        break;
+      case ROTATE_NONE:
+        break;
+     }
 }
 
 void
-evas_object_image_rotate(Evas_Object *image, Rotation rotation)
+evas_object_image_rotate(Evas_Object *image, Evas_Object_Image_Rotation 
rotation)
 {
-    Evas_Colorspace colorspace = evas_object_image_colorspace_get(image);
-    int image_byte_size;
-    int stride, width, height;
-    unsigned char has_alpha;
-    char *new_buffer;
-    char *src_data;
-
-    evas_object_image_size_get(image, &width, &height);
-    stride = evas_object_image_stride_get(image);
-    has_alpha = evas_object_image_alpha_get(image);
-
-    image_byte_size = _calc_image_byte_size(colorspace, rotation,
-                                            stride, width,
-                                            height, has_alpha);
-    if (image_byte_size <= 0)
-        return;
-
-    new_buffer = malloc(image_byte_size);
-    src_data = evas_object_image_data_get(image, FALSE);
-
-    switch (colorspace) {
-        case EVAS_COLORSPACE_ARGB8888:
-            _argb8888_image_rotate(rotation, new_buffer, src_data,
-                                   stride, 0, 0, width, height);
-            break;
-        case EVAS_COLORSPACE_RGB565_A5P:
-            _rgb565_image_rotate(rotation, new_buffer, src_data,
-                                 stride, has_alpha, 0, 0, width, height);
-            break;
-        case EVAS_COLORSPACE_YCBCR422P601_PL:
-          fputs("Colorspace YCBCR422P601_PL not handled\n", stderr);
-          break;
-        case EVAS_COLORSPACE_YCBCR422P709_PL:
-          fputs("Colorspace YCBCR422P709_PL not handled\n", stderr);
-          break;
-    }
+   Evas_Colorspace colorspace = evas_object_image_colorspace_get(image);
+   int image_byte_size;
+   int stride, width, height;
+   unsigned char has_alpha;
+   char *new_buffer;
+   char *src_data;
+
+   evas_object_image_size_get(image, &width, &height);
+   stride = evas_object_image_stride_get(image);
+   has_alpha = evas_object_image_alpha_get(image);
+
+   image_byte_size = _calc_image_byte_size(colorspace, rotation,
+                                          stride, width,
+                                          height, has_alpha);
+   if (image_byte_size <= 0)
+     return;
+
+   new_buffer = malloc(image_byte_size);
+   src_data = evas_object_image_data_get(image, 0);
+
+   switch (colorspace)
+     {
+      case EVAS_COLORSPACE_ARGB8888:
+        _argb8888_image_rotate(rotation, new_buffer, src_data,
+                               stride, 0, 0, width, height);
+        break;
+      case EVAS_COLORSPACE_RGB565_A5P:
+        _rgb565_image_rotate(rotation, new_buffer, src_data,
+                             stride, has_alpha, 0, 0, width, height);
+        break;
+      case EVAS_COLORSPACE_YCBCR422P601_PL:
+        fputs("Colorspace YCBCR422P601_PL not handled\n", stderr);
+        break;
+      case EVAS_COLORSPACE_YCBCR422P709_PL:
+        fputs("Colorspace YCBCR422P709_PL not handled\n", stderr);
+        break;
+     }
 
-    if (rotation == ROTATE_90 || rotation == ROTATE_270)
-        evas_object_image_size_set(image, height, width);
+   if ((rotation == ROTATE_90) || (rotation == ROTATE_270))
+     evas_object_image_size_set(image, height, width);
 
-    evas_object_image_data_update_add(image, 0, 0, width, height);
-    evas_object_image_data_copy_set(image, new_buffer);
+   evas_object_image_data_update_add(image, 0, 0, width, height);
+   evas_object_image_data_copy_set(image, new_buffer);
 
-    free(new_buffer);
+   free(new_buffer);
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to