summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c166
1 files changed, 83 insertions, 83 deletions
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index f273959d12..c21717359d 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -2866,87 +2866,87 @@ eng_image_max_size_get(void *data, int *maxw, int *maxh)
2866 if (maxh) *maxh = re->win->gl_context->shared->info.max_texture_size; 2866 if (maxh) *maxh = re->win->gl_context->shared->info.max_texture_size;
2867} 2867}
2868 2868
2869static Eina_Bool 2869static Eina_Bool
2870eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) 2870eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h)
2871{ 2871{
2872 Evas_GL_Image *im = image; 2872 Evas_GL_Image *im = image;
2873 int px, py, dx, dy, sx, sy, src_w, src_h; 2873 int px, py, dx, dy, sx, sy, src_w, src_h;
2874 double scale_w, scale_h; 2874 double scale_w, scale_h;
2875 2875
2876 if (!im) return EINA_FALSE; 2876 if (!im) return EINA_FALSE;
2877 2877
2878 if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) || 2878 if ((dst_region_x > x) || (x >= (dst_region_x + dst_region_w)) ||
2879 (dst_region_y > y) || (y >= (dst_region_y + dst_region_h))) 2879 (dst_region_y > y) || (y >= (dst_region_y + dst_region_h)))
2880 { 2880 {
2881 *alpha = 0; 2881 *alpha = 0;
2882 return EINA_FALSE; 2882 return EINA_FALSE;
2883 } 2883 }
2884 2884
2885 src_w = im->im->cache_entry.w; 2885 src_w = im->im->cache_entry.w;
2886 src_h = im->im->cache_entry.h; 2886 src_h = im->im->cache_entry.h;
2887 if ((src_w == 0) || (src_h == 0)) 2887 if ((src_w == 0) || (src_h == 0))
2888 { 2888 {
2889 *alpha = 0; 2889 *alpha = 0;
2890 return EINA_TRUE; 2890 return EINA_TRUE;
2891 } 2891 }
2892 2892
2893 EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob); 2893 EINA_SAFETY_ON_TRUE_GOTO(src_region_x < 0, error_oob);
2894 EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob); 2894 EINA_SAFETY_ON_TRUE_GOTO(src_region_y < 0, error_oob);
2895 EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob); 2895 EINA_SAFETY_ON_TRUE_GOTO(src_region_x + src_region_w > src_w, error_oob);
2896 EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob); 2896 EINA_SAFETY_ON_TRUE_GOTO(src_region_y + src_region_h > src_h, error_oob);
2897 2897
2898 scale_w = (double)dst_region_w / (double)src_region_w; 2898 scale_w = (double)dst_region_w / (double)src_region_w;
2899 scale_h = (double)dst_region_h / (double)src_region_h; 2899 scale_h = (double)dst_region_h / (double)src_region_h;
2900 2900
2901 /* point at destination */ 2901 /* point at destination */
2902 dx = x - dst_region_x; 2902 dx = x - dst_region_x;
2903 dy = y - dst_region_y; 2903 dy = y - dst_region_y;
2904 2904
2905 /* point at source */ 2905 /* point at source */
2906 sx = dx / scale_w; 2906 sx = dx / scale_w;
2907 sy = dy / scale_h; 2907 sy = dy / scale_h;
2908 2908
2909 /* pixel point (translated) */ 2909 /* pixel point (translated) */
2910 px = src_region_x + sx; 2910 px = src_region_x + sx;
2911 py = src_region_y + sy; 2911 py = src_region_y + sy;
2912 EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob); 2912 EINA_SAFETY_ON_TRUE_GOTO(px >= src_w, error_oob);
2913 EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob); 2913 EINA_SAFETY_ON_TRUE_GOTO(py >= src_h, error_oob);
2914 2914
2915 switch (im->im->cache_entry.space) 2915 switch (im->im->cache_entry.space)
2916 { 2916 {
2917 case EVAS_COLORSPACE_ARGB8888: 2917 case EVAS_COLORSPACE_ARGB8888:
2918 { 2918 {
2919 DATA32 *pixel; 2919 DATA32 *pixel;
2920 2920
2921 evas_cache_image_load_data(&im->im->cache_entry); 2921 evas_cache_image_load_data(&im->im->cache_entry);
2922 if (!im->im->cache_entry.flags.loaded) 2922 if (!im->im->cache_entry.flags.loaded)
2923 { 2923 {
2924 ERR("im %p has no pixels loaded yet", im); 2924 ERR("im %p has no pixels loaded yet", im);
2925 return EINA_FALSE; 2925 return EINA_FALSE;
2926 } 2926 }
2927 2927
2928 pixel = im->im->image.data; 2928 pixel = im->im->image.data;
2929 pixel += ((py * src_w) + px); 2929 pixel += ((py * src_w) + px);
2930 *alpha = ((*pixel) >> 24) & 0xff; 2930 *alpha = ((*pixel) >> 24) & 0xff;
2931 } 2931 }
2932 break; 2932 break;
2933 2933
2934 default: 2934 default:
2935 ERR("Colorspace %d not supported.", im->im->cache_entry.space); 2935 ERR("Colorspace %d not supported.", im->im->cache_entry.space);
2936 *alpha = 0; 2936 *alpha = 0;
2937 } 2937 }
2938 2938
2939 return EINA_TRUE; 2939 return EINA_TRUE;
2940 2940
2941 error_oob: 2941 error_oob:
2942 ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d", 2942 ERR("Invalid region src=(%d, %d, %d, %d), dst=(%d, %d, %d, %d), image=%dx%d",
2943 src_region_x, src_region_y, src_region_w, src_region_h, 2943 src_region_x, src_region_y, src_region_w, src_region_h,
2944 dst_region_x, dst_region_y, dst_region_w, dst_region_h, 2944 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
2945 src_w, src_h); 2945 src_w, src_h);
2946 *alpha = 0; 2946 *alpha = 0;
2947 return EINA_TRUE; 2947 return EINA_TRUE;
2948} 2948}
2949 2949
2950static int 2950static int
2951module_open(Evas_Module *em) 2951module_open(Evas_Module *em)
2952{ 2952{
@@ -3062,8 +3062,8 @@ module_open(Evas_Module *em)
3062 3062
3063 ORD(image_max_size_get); 3063 ORD(image_max_size_get);
3064 3064
3065 ORD(pixel_alpha_get); 3065 ORD(pixel_alpha_get);
3066 3066
3067 /* now advertise out own api */ 3067 /* now advertise out own api */
3068 em->functions = (void *)(&func); 3068 em->functions = (void *)(&func);
3069 return 1; 3069 return 1;