From: Enlightenment C. <no...@cv...> - 2008-03-12 18:54:28
|
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); } |
From: Enlightenment C. <no...@cv...> - 2008-03-12 19:56:01
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas/evas Modified Files: evas_object_image_rotate.c evas_object_image_mask.c Log Message: Cleanup pointer types. Avoid doing casts all over the places. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas_object_image_rotate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evas_object_image_rotate.c 12 Mar 2008 18:53:55 -0000 1.4 +++ evas_object_image_rotate.c 12 Mar 2008 19:55:57 -0000 1.5 @@ -34,10 +34,12 @@ switch (colorspace) { case EVAS_COLORSPACE_ARGB8888: - image_byte_size = IMG_BYTE_SIZE_ARGB8888(dst_stride, dst_height, has_alpha); + 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); + image_byte_size = IMG_BYTE_SIZE_RGB565(dst_stride, dst_height, + has_alpha); break; default: image_byte_size = -1; @@ -48,18 +50,20 @@ } 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(DATA8 *dst, const DATA8 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA8 *dp, *sp; - int x, y; + const DATA8 *sp; + DATA8 *dp; + int y; - sp = (DATA8 *) src; - dp = ((DATA8 *) dst) + ((out_x + - (w + out_y - 1) * dst_stride)); + sp = src; + dp = dst + ((out_x + (w + out_y - 1) * dst_stride)); for (y = 0; y < h; y++) { - DATA8 *dp_itr, *sp_itr; + const DATA8 *sp_itr; + DATA8 *dp_itr; + int x; sp_itr = sp; dp_itr = dp; @@ -77,18 +81,20 @@ } 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(DATA16 *dst, const DATA16 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA16 *dp, *sp; - int x, y; + const DATA16 *sp; + DATA16 *dp; + int y; - sp = (DATA16 *) src; - dp = ((DATA16 *) dst) + ((out_x + - (w + out_y - 1) * dst_stride)); + sp = src; + dp = dst + ((out_x + (w + out_y - 1) * dst_stride)); for (y = 0; y < h; y++) { - DATA16 *dp_itr, *sp_itr; + const DATA16 *sp_itr; + DATA16 *dp_itr; + int x; sp_itr = sp; dp_itr = dp; @@ -106,18 +112,20 @@ } 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(DATA32 *dst, const DATA32 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA32 *dp, *sp; - int x, y; + const DATA32 *sp; + DATA32 *dp; + int y; - sp = (DATA32 *) src; - dp = ((DATA32 *) dst) + ((out_x + - (w + out_y - 1) * dst_stride)); + sp = src; + dp = dst + ((out_x + (w + out_y - 1) * dst_stride)); for (y = 0; y < h; y++) { - DATA32 *dp_itr, *sp_itr; + const DATA32 *sp_itr; + DATA32 *dp_itr; + int x; sp_itr = sp; dp_itr = dp; @@ -135,18 +143,21 @@ } 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(DATA8 *dst, const DATA8 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA8 *dp, *sp; - int x, y; + const DATA8 *sp; + DATA8 *dp; + int y; - sp = (DATA8 *) src; - dp = ((DATA8 *) dst) + ((w + out_x - 1) + - (h + out_y - 1) * dst_stride); + sp = src; + dp = dst + ((w + out_x - 1) + (h + out_y - 1) * dst_stride); for (y = 0; y < h; y++) { - DATA8 *dp_itr, *sp_itr; + const DATA8 *sp_itr; + DATA8 *dp_itr; + int x; + sp_itr = sp; dp_itr = dp; @@ -163,18 +174,21 @@ } 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(DATA16 *dst, const DATA16 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA16 *dp, *sp; - int x, y; + const DATA16 *sp; + DATA16 *dp; + int y; - sp = (DATA16 *) src; - dp = ((DATA16 *) dst) + ((w + out_x - 1) + - (h + out_y - 1) * dst_stride); + sp = src; + dp = dst + ((w + out_x - 1) + (h + out_y - 1) * dst_stride); for (y = 0; y < h; y++) { - DATA16 *dp_itr, *sp_itr; + const DATA16 *sp_itr; + DATA16 *dp_itr; + int x; + sp_itr = sp; dp_itr = dp; @@ -189,19 +203,23 @@ 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(DATA32 *dst, const DATA32 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA32 *dp, *sp; - int x, y; + const DATA32 *sp; + DATA32 *dp; + int y; - sp = (DATA32 *) src; - dp = ((DATA32 *) dst) + ((w + out_x - 1) + - (h + out_y - 1) * dst_stride); + sp = src; + dp = dst + ((w + out_x - 1) + (h + out_y - 1) * dst_stride); for (y = 0; y < h; y++) { - DATA32 *dp_itr, *sp_itr; + const DATA32 *sp_itr; + DATA32 *dp_itr; + int x; + sp_itr = sp; dp_itr = dp; @@ -218,18 +236,21 @@ } 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(DATA8 *dst, const DATA8 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA8 *dp, *sp; - int x, y; + const DATA8 *sp; + DATA8 *dp; + int y; - sp = (DATA8 *) src; - dp = ((DATA8 *) dst) + ((h + out_x - 1) + - out_y * dst_stride); + sp = src; + dp = dst + ((h + out_x - 1) + out_y * dst_stride); for (y = 0; y < h; y++) { - DATA8 *dp_itr, *sp_itr; + const DATA8 *sp_itr; + DATA8 *dp_itr; + int x; + sp_itr = sp; dp_itr = dp; @@ -246,18 +267,21 @@ } 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(DATA16 *dst, const DATA16 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA16 *dp, *sp; - int x, y; + const DATA16 *sp; + DATA16 *dp; + int y; - sp = (DATA16 *) src; - dp = ((DATA16 *) dst) + ((h + out_x - 1) + - out_y * dst_stride); + sp = src; + dp = dst + ((h + out_x - 1) + out_y * dst_stride); for (y = 0; y < h; y++) { - DATA16 *dp_itr, *sp_itr; + const DATA16 *sp_itr; + DATA16 *dp_itr; + int x; + sp_itr = sp; dp_itr = dp; @@ -274,18 +298,21 @@ } 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(DATA32 *dst, const DATA32 *src, int dst_stride, int src_stride, int out_x, int out_y, int w, int h) { - DATA32 *dp, *sp; - int x, y; + const DATA32 *sp; + DATA32 *dp; + int y; - sp = (DATA32 *) src; - dp = ((DATA32 *) dst) + ((h + out_x - 1) + - out_y * dst_stride); + sp = src; + dp = dst + ((h + out_x - 1) + out_y * dst_stride); for (y = 0; y < h; y++) { - DATA32 *dp_itr, *sp_itr; + const DATA32 *sp_itr; + DATA32 *dp_itr; + int x; + sp_itr = sp; dp_itr = dp; @@ -302,14 +329,14 @@ } static void -_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) +_rgb565_image_rotate(Evas_Object_Image_Rotation rotation, DATA16 *dst, const DATA16 *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; + DATA8 *dst_alpha; + const DATA8 *src_alpha; if (has_alpha) - src_alpha = src + src_stride * h * 2; + src_alpha = (const DATA8*)(src + src_stride * h); switch (rotation) { @@ -320,7 +347,7 @@ out_x, out_y, w, h); if (has_alpha) { - dst_alpha = dst + dst_stride * w * 2; + dst_alpha = (DATA8 *)(dst + dst_stride * w); _data8_image_rotate_90(dst_alpha, src_alpha, dst_stride, src_stride, out_x, out_y, w, h); @@ -333,7 +360,7 @@ out_x, out_y, w, h); if (has_alpha) { - dst_alpha = dst + dst_stride * h * 2; + dst_alpha = (DATA8 *)(dst + dst_stride * h); _data8_image_rotate_180(dst_alpha, src_alpha, dst_stride, src_stride, out_x, out_y, w, h); @@ -346,7 +373,7 @@ out_x, out_y, w, h); if (has_alpha) { - dst_alpha = dst + dst_stride * w * 2; + dst_alpha = (DATA8 *)(dst + dst_stride * w); _data8_image_rotate_270(dst_alpha, src_alpha, dst_stride, src_stride, out_x, out_y, w, h); @@ -358,7 +385,7 @@ } 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) +_argb8888_image_rotate(Evas_Object_Image_Rotation rotation, DATA32 *dst, const DATA32 *src, int src_stride, int out_x, int out_y, int w, int h) { int dst_stride; @@ -394,8 +421,7 @@ int image_byte_size; int stride, width, height; unsigned char has_alpha; - char *new_buffer; - char *src_data; + void *new_buffer, *src_data; evas_object_image_size_get(image, &width, &height); stride = evas_object_image_stride_get(image); @@ -408,6 +434,9 @@ return; new_buffer = malloc(image_byte_size); + if (!new_buffer) + return; + src_data = evas_object_image_data_get(image, 0); switch (colorspace) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas_object_image_mask.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evas_object_image_mask.c 12 Mar 2008 18:53:55 -0000 1.2 +++ evas_object_image_mask.c 12 Mar 2008 19:55:57 -0000 1.3 @@ -9,60 +9,61 @@ 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(DATA32 *dst, const DATA32 *src, const DATA32 *msk, const DATA32 *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; + int y; 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, - (pxa >> 16) & 0xFF, (pxb >> 16) & 0xFF); - g = MEDPIXEL((pixel >> 8) & 0xFF, - (pxa >> 8) & 0xFF, (pxb >> 8) & 0xFF); - b = MEDPIXEL(pixel & 0xFF, pxa & 0xFF, pxb & 0xFF); - pixel = (a << 24) | (r << 16) | (g << 8) | b; - } - } + { + int x; - *(BPIXEL(dp, x, y, src_stride)) = pixel; - } + for (x = 0; x < src_width; x++) + { + int xp, yp, xs, ys; + DATA32 pixel; + + xp = x - x_msk; + yp = y - y_msk; + xs = x - x_srf; + ys = y - y_srf; + + pixel = *(BPIXEL(src, 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)) + { + DATA32 pxa, pxb; + + pxa = *(BPIXEL(msk, xp, yp, msk_stride)); + pxb = *(BPIXEL(srf, xs, ys, srf_stride)); + if (pxa != 0) + { + int r, g, b, a; + + a = MEDPIXEL((pixel >> 24) & 0xFF, + (pxa >> 24) & 0xFF, (pxb >> 24) & 0xFF); + r = MEDPIXEL((pixel >> 16) & 0xFF, + (pxa >> 16) & 0xFF, (pxb >> 16) & 0xFF); + g = MEDPIXEL((pixel >> 8) & 0xFF, + (pxa >> 8) & 0xFF, (pxb >> 8) & 0xFF); + b = MEDPIXEL(pixel & 0xFF, pxa & 0xFF, pxb & 0xFF); + pixel = (a << 24) | (r << 16) | (g << 8) | b; + } + } + + *(BPIXEL(dst, 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) { int alloc_size; unsigned char has_alpha; - char *src_data; - char *msk_data; - char *srf_data; - char *new_buffer; + void *src_data, *msk_data, *srf_data, *new_buffer; int src_stride, src_width, src_height; int msk_stride, msk_width, msk_height; int srf_stride, srf_width, srf_height; @@ -77,10 +78,15 @@ evas_object_image_size_get(src, &src_width, &src_height); src_stride = evas_object_image_stride_get(src); + src_data = evas_object_image_data_get(src, 0); + evas_object_image_size_get(mask, &msk_width, &msk_height); msk_stride = evas_object_image_stride_get(mask); + msk_data = evas_object_image_data_get(mask, 0); + evas_object_image_size_get(surface, &srf_width, &srf_height); srf_stride = evas_object_image_stride_get(surface); + srf_data = evas_object_image_data_get(surface, 0); has_alpha = evas_object_image_alpha_get(src); @@ -91,10 +97,6 @@ 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, |
From: Enlightenment C. <no...@cv...> - 2008-03-12 19:57:56
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas/include Removed Files: evas_object_image_python_extras.h Log Message: Fix build of modules dependent on python-evas. Move evas_object_image_python_extras.h inside include/evas and install it so python-ecore doesn't fail. |
From: Enlightenment C. <no...@cv...> - 2008-03-12 19:57:56
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas/include/evas Modified Files: c_evas.pxd Added Files: evas_object_image_python_extras.h Log Message: Fix build of modules dependent on python-evas. Move evas_object_image_python_extras.h inside include/evas and install it so python-ecore doesn't fail. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/include/evas/c_evas.pxd,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- c_evas.pxd 12 Mar 2008 18:53:55 -0000 1.7 +++ c_evas.pxd 12 Mar 2008 19:57:49 -0000 1.8 @@ -531,7 +531,7 @@ void evas_object_text_style_pad_get(Evas_Object *obj, int *l, int *r, int *t, int *b) -cdef extern from "evas_object_image_python_extras.h": +cdef extern from "evas/evas_object_image_python_extras.h": ctypedef enum Evas_Object_Image_Rotation: ROTATE_NONE ROTATE_90 |
From: Enlightenment C. <no...@cv...> - 2008-03-12 19:58:22
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas/evas Modified Files: evas_object_image_mask.c evas_object_image_rotate.c Log Message: Fix build of modules dependent on python-evas. Move evas_object_image_python_extras.h inside include/evas and install it so python-ecore doesn't fail. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas_object_image_mask.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- evas_object_image_mask.c 12 Mar 2008 19:55:57 -0000 1.3 +++ evas_object_image_mask.c 12 Mar 2008 19:57:49 -0000 1.4 @@ -2,7 +2,7 @@ #include <stdlib.h> #include <Evas.h> -#include "evas_object_image_python_extras.h" +#include "evas/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 =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas_object_image_rotate.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- evas_object_image_rotate.c 12 Mar 2008 19:55:57 -0000 1.5 +++ evas_object_image_rotate.c 12 Mar 2008 19:57:49 -0000 1.6 @@ -2,7 +2,7 @@ #include <stdlib.h> #include <Evas.h> -#include "evas_object_image_python_extras.h" +#include "evas/evas_object_image_python_extras.h" static inline int _calc_stride(int w) |
From: Enlightenment C. <no...@cv...> - 2008-03-12 19:58:22
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas Modified Files: setup.py Log Message: Fix build of modules dependent on python-evas. Move evas_object_image_python_extras.h inside include/evas and install it so python-ecore doesn't fail. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/setup.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- setup.py 12 Mar 2008 17:42:06 -0000 1.26 +++ setup.py 12 Mar 2008 19:57:49 -0000 1.27 @@ -60,6 +60,7 @@ headers = ['evas/evas.c_evas.h', + 'include/evas/evas_object_image_python_extras.h', 'include/evas/python_evas_utils.h', 'include/evas/c_evas.pxd', 'include/evas/python.pxd', |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:24
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas/tests Modified Files: 01-canvas-basics.py 02-object-basics.py Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/tests/01-canvas-basics.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- 01-canvas-basics.py 19 Jul 2007 16:07:07 -0000 1.2 +++ 01-canvas-basics.py 10 Aug 2008 14:59:12 -0000 1.3 @@ -16,6 +16,8 @@ self.assertEqual(c.output_method_get(), evas.render_method_lookup(m)) self.assertEqual(c.size_get(), s) self.assertEqual(c.viewport_get(), v) + self.assertEqual(isinstance(str(c), str), True) + self.assertEqual(isinstance(repr(c), str), True) class CanvasMethods(unittest.TestCase): =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/tests/02-object-basics.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- 02-object-basics.py 19 Jul 2007 16:07:07 -0000 1.2 +++ 02-object-basics.py 10 Aug 2008 14:59:12 -0000 1.3 @@ -99,6 +99,14 @@ o2 = self.canvas.object_name_find("Test 123") self.assertEqual(o1, o2) + def testStr(self): + o = evas.Rectangle(self.canvas) + self.assertEqual(isinstance(str(o), str), True) + + def testRepr(self): + o = evas.Rectangle(self.canvas) + self.assertEqual(isinstance(repr(o), str), True) + class ObjectProperties(unittest.TestCase): |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:43
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-ecore/ecore/evas Modified Files: ecore.evas.c_ecore_evas_base.pxi Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/evas/ecore.evas.c_ecore_evas_base.pxi,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- ecore.evas.c_ecore_evas_base.pxi 7 Aug 2008 03:13:09 -0000 1.13 +++ ecore.evas.c_ecore_evas_base.pxi 10 Aug 2008 14:59:12 -0000 1.14 @@ -234,8 +234,8 @@ return "%s(Evas=%s)" % (self.__class__.__name__, self.evas) def __repr__(self): - return "%s(0x%x, refcount=%d, Ecore_Evas=0x%x, Evas=%r)" % \ - (self.__class__.__name__, <unsigned long>self, + return "%s(%#x, refcount=%d, Ecore_Evas=%#x, Evas=%r)" % \ + (self.__class__.__name__, <unsigned long><void *>self, PY_REFCOUNT(self), <unsigned long>self.obj, self.evas) |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:43
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-ecore/ecore Modified Files: ecore.c_ecore_animator.pxi ecore.c_ecore_events.pxi ecore.c_ecore_fd_handler.pxi ecore.c_ecore_idle_enterer.pxi ecore.c_ecore_idle_exiter.pxi ecore.c_ecore_idler.pxi ecore.c_ecore_timer.pxi Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_animator.pxi,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ecore.c_ecore_animator.pxi 7 Aug 2008 03:13:09 -0000 1.9 +++ ecore.c_ecore_animator.pxi 10 Aug 2008 14:59:12 -0000 1.10 @@ -72,9 +72,9 @@ (self.__class__.__name__, self.func, self.args, self.kargs) def __repr__(self): - return ("%s(0x%x, func=%s, args=%s, kargs=%s, Ecore_Animator=0x%x, " + return ("%s(%#x, func=%s, args=%s, kargs=%s, Ecore_Animator=%#x, " "refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.func, self.args, self.kargs, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_events.pxi,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ecore.c_ecore_events.pxi 7 Aug 2008 03:13:09 -0000 1.2 +++ ecore.c_ecore_events.pxi 10 Aug 2008 14:59:12 -0000 1.3 @@ -113,7 +113,7 @@ def __repr__(self): return ("%s(%#x, type=%d, func=%s, args=%s, kargs=%s, event_cls=%s, " "Ecore_Event_Handler=%#x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.type, self.func, self.args, self.kargs, self.event_cls, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_fd_handler.pxi,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- ecore.c_ecore_fd_handler.pxi 7 Aug 2008 03:13:09 -0000 1.10 +++ ecore.c_ecore_fd_handler.pxi 10 Aug 2008 14:59:12 -0000 1.11 @@ -118,9 +118,9 @@ else: fd = self.fd_get() flags = flags2str(self.active_get(7)) - return ("%s(0x%x, func=%s, args=%s, kargs=%s, fd=%s, flags=[%s], " - "Ecore_Fd_Handler=0x%x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + return ("%s(%#x, func=%s, args=%s, kargs=%s, fd=%s, flags=[%s], " + "Ecore_Fd_Handler=%#x, refcount=%d)") % \ + (self.__class__.__name__, <unsigned long><void *>self, self.func, self.args, self.kargs, fd, flags, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_idle_enterer.pxi,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ecore.c_ecore_idle_enterer.pxi 7 Aug 2008 03:13:09 -0000 1.9 +++ ecore.c_ecore_idle_enterer.pxi 10 Aug 2008 14:59:12 -0000 1.10 @@ -72,9 +72,9 @@ (self.__class__.__name__, self.func, self.args, self.kargs) def __repr__(self): - return ("%s(0x%x, func=%s, args=%s, kargs=%s, " - "Ecore_Idle_Enterer=0x%x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + return ("%s(%#x, func=%s, args=%s, kargs=%s, " + "Ecore_Idle_Enterer=%#x, refcount=%d)") % \ + (self.__class__.__name__, <unsigned long><void *>self, self.func, self.args, self.kargs, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_idle_exiter.pxi,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ecore.c_ecore_idle_exiter.pxi 7 Aug 2008 03:13:09 -0000 1.9 +++ ecore.c_ecore_idle_exiter.pxi 10 Aug 2008 14:59:12 -0000 1.10 @@ -70,9 +70,9 @@ (self.__class__.__name__, self.func, self.args, self.kargs) def __repr__(self): - return ("%s(0x%x, func=%s, args=%s, kargs=%s, Ecore_Idle_Exiter=0x%x, " + return ("%s(%#x, func=%s, args=%s, kargs=%s, Ecore_Idle_Exiter=%#x, " "refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.func, self.args, self.kargs, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_idler.pxi,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ecore.c_ecore_idler.pxi 7 Aug 2008 03:13:09 -0000 1.9 +++ ecore.c_ecore_idler.pxi 10 Aug 2008 14:59:12 -0000 1.10 @@ -70,9 +70,9 @@ (self.__class__.__name__, self.func, self.args, self.kargs) def __repr__(self): - return ("%s(0x%x, func=%s, args=%s, kargs=%s, Ecore_Idler=0x%x, " + return ("%s(%#x, func=%s, args=%s, kargs=%s, Ecore_Idler=%#x, " "refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.func, self.args, self.kargs, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/ecore.c_ecore_timer.pxi,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ecore.c_ecore_timer.pxi 7 Aug 2008 03:13:09 -0000 1.9 +++ ecore.c_ecore_timer.pxi 10 Aug 2008 14:59:12 -0000 1.10 @@ -73,10 +73,10 @@ self.func, self.args, self.kargs) def __repr__(self): - return ("%s(0x%x, interval=%f, func=%s, args=%s, kargs=%s, " - "Ecore_Timer=0x%x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, self._interval, - self.func, self.args, self.kargs, + return ("%s(%#x, interval=%f, func=%s, args=%s, kargs=%s, " + "Ecore_Timer=%#x, refcount=%d)") % \ + (self.__class__.__name__, <unsigned long><void *>self, + self._interval, self.func, self.args, self.kargs, <unsigned long>self.obj, PY_REFCOUNT(self)) def __dealloc__(self): |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:43
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-edje/edje Modified Files: edje.c_edje_object.pxi Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-edje/edje/edje.c_edje_object.pxi,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- edje.c_edje_object.pxi 7 Aug 2008 03:13:10 -0000 1.25 +++ edje.c_edje_object.pxi 10 Aug 2008 14:59:12 -0000 1.26 @@ -192,10 +192,10 @@ r, g, b, a = self.color_get() file, group = self.file_get() clip = bool(self.clip_get() is not None) - return ("%s(0x%x, type=%r, refcount=%d, Evas_Object=0x%x, name=%r, " + return ("%s(%#x, type=%r, refcount=%d, Evas_Object=%#x, name=%r, " "file=%r, group=%r, geometry=(%d, %d, %d, %d), " "color=(%d, %d, %d, %d), layer=%s, clip=%r, visible=%s)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.type_get(), PY_REFCOUNT(self), <unsigned long>self.obj, self.name_get(), file, group, x, y, w, h, r, g, b, a, self.layer_get(), clip, self.visible_get()) |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:43
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-ecore/ecore/x Modified Files: ecore.x.c_ecore_x_window.pxi Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-ecore/ecore/x/ecore.x.c_ecore_x_window.pxi,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ecore.x.c_ecore_x_window.pxi 7 Aug 2008 03:13:09 -0000 1.3 +++ ecore.x.c_ecore_x_window.pxi 10 Aug 2008 14:59:12 -0000 1.4 @@ -77,7 +77,7 @@ ecore_x_window_geometry_get(self.xid, &x, &y, &w, &h) parent = ecore_x_window_parent_get(self.xid) return "%s(%#x, xid=%#x, parent=%#x, x=%d, y=%d, w=%d, h=%d)" % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.xid, parent, x, y, w, h) def __richcmp__(self, other, int op): |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:44
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-evas/evas Modified Files: evas.c_evas_canvas.pxi evas.c_evas_object.pxi Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_canvas.pxi,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- evas.c_evas_canvas.pxi 7 Aug 2008 03:13:12 -0000 1.18 +++ evas.c_evas_canvas.pxi 10 Aug 2008 14:59:12 -0000 1.19 @@ -106,9 +106,9 @@ def __repr__(self): w, h = self.size_get() - return ("%s(0x%x, refcount=%d, Evas_Object=0x%x, size=(%d, %d), " + return ("%s(%#x, refcount=%d, Evas_Object=%#x, size=(%d, %d), " "method=%r)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, PY_REFCOUNT(self), <unsigned long>self.obj, w, h, self.output_method_get()) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_object.pxi,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- evas.c_evas_object.pxi 7 Aug 2008 03:13:12 -0000 1.26 +++ evas.c_evas_object.pxi 10 Aug 2008 14:59:12 -0000 1.27 @@ -246,10 +246,10 @@ x, y, w, h = self.geometry_get() r, g, b, a = self.color_get() clip = bool(self.clip_get() is not None) - return ("%s(0x%x, type=%r, refcount=%d, Evas_Object=0x%x, name=%r, " + return ("%s(%#x, type=%r, refcount=%d, Evas_Object=%#x, name=%r, " "geometry=(%d, %d, %d, %d), color=(%d, %d, %d, %d), " "layer=%s, clip=%r, visible=%s)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.type_get(), PY_REFCOUNT(self), <unsigned long>self.obj, self.name_get(), x, y, w, h, r, g, b, a, self.layer_get(), clip, self.visible_get()) |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:44
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-epsilon/epsilon Modified Files: epsilon.c_epsilon.pyx epsilon.request.pyx Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-epsilon/epsilon/epsilon.c_epsilon.pyx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- epsilon.c_epsilon.pyx 7 Aug 2008 03:13:11 -0000 1.3 +++ epsilon.c_epsilon.pyx 10 Aug 2008 14:59:12 -0000 1.4 @@ -58,9 +58,9 @@ self.thumb_size, self.resolution) def __repr__(self): - return ("%s(0x%x, path=%r, key=%s, thumb_file=%r, thumb_size=%r, " + return ("%s(%#x, path=%r, key=%s, thumb_file=%r, thumb_size=%r, " "resolution=%r, Epsilon=%#x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.file, self.key, self.thumb_file, self.thumb_size, self.resolution, <unsigned long>self.obj, PY_REFCOUNT(self)) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-epsilon/epsilon/epsilon.request.pyx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- epsilon.request.pyx 7 Aug 2008 03:13:11 -0000 1.5 +++ epsilon.request.pyx 10 Aug 2008 14:59:12 -0000 1.6 @@ -70,9 +70,9 @@ self.request_id, self.status) def __repr__(self): - return ("%s(0x%x, path=%r, dest=%r, size=%r, request_id=%r, status=%r, " + return ("%s(%#x, path=%r, dest=%r, size=%r, request_id=%r, status=%r, " "Epsilon_Request=%#x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.path, self.dest, self.size, self.request_id, self.status, <unsigned long>self.obj, PY_REFCOUNT(self)) |
From: Enlightenment C. <no...@cv...> - 2008-08-10 14:59:45
|
Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl Dir : e17/proto/python-efl/python-emotion/emotion Modified Files: emotion.c_emotion.pyx Log Message: Fix way to get the address of python objects. Cython changed the way casts are interpreted some time ago and <unsigned long>object is not valid anymore because it would check for an integer-capable object (ie: __init__()). Instead we must make it a void pointer (<void *>object) and then cast this to the integer type. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-emotion/emotion/emotion.c_emotion.pyx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- emotion.c_emotion.pyx 7 Aug 2008 03:13:11 -0000 1.10 +++ emotion.c_emotion.pyx 10 Aug 2008 14:59:12 -0000 1.11 @@ -81,10 +81,10 @@ def __repr__(self): x, y, w, h = self.geometry_get() r, g, b, a = self.color_get() - return ("%s(0x%x, type=%r, refcount=%d, Evas_Object=0x%x, name=%r, " + return ("%s(%#x, type=%r, refcount=%d, Evas_Object=%#x, name=%r, " "file=%r, geometry=(%d, %d, %d, %d), " "color=(%d, %d, %d, %d), layer=%s, clip=%r, visible=%s)") % \ - (self.__class__.__name__, <unsigned long>self, + (self.__class__.__name__, <unsigned long><void *>self, self.type_get(), PY_REFCOUNT(self), <unsigned long>self.obj, self.name_get(), self.file_get(), x, y, w, h, r, g, b, a, self.layer_get(), self.clip_get(), self.visible_get()) |