summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 22:01:16 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 22:05:50 +0900
commit2ac9e788c689f2ca850d373a19a9e85237198573 (patch)
tree9527243f2c171d42952064c1c53a99c9e9ecc518 /src/lib/evas/common
parente47edc250dc715a6b0f94be4b1cb81d32e9d97fe (diff)
Evas: Implement ARGY88 and GRY8 conversion to ARGB8888
This is adding support for a deprecated function, but apparently it is used. Also, remove crazy abort() inside the data_put function. Fixes T2991
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_convert_colorspace.c86
-rw-r--r--src/lib/evas/common/evas_convert_colorspace.h2
2 files changed, 86 insertions, 2 deletions
diff --git a/src/lib/evas/common/evas_convert_colorspace.c b/src/lib/evas/common/evas_convert_colorspace.c
index 0536380..afbac8f 100644
--- a/src/lib/evas/common/evas_convert_colorspace.c
+++ b/src/lib/evas/common/evas_convert_colorspace.c
@@ -47,6 +47,90 @@ evas_common_convert_rgb565_a5p_to_argb8888(void *data, int w, int h, int stride,
47} 47}
48 48
49static inline void * 49static inline void *
50evas_common_convert_agry88_to_argb8888(const void *data, int w, int h, int stride, Eina_Bool has_alpha)
51{
52 const DATA16 *src, *end;
53 DATA32 *ret, *dst;
54
55 src = data;
56 end = src + ((stride >> 1) * h);
57 ret = malloc(w * h * sizeof(DATA32));
58 dst = ret;
59
60 if (has_alpha)
61 {
62 for (; src < end; src++, dst++)
63 {
64 int c = (*src) & 0xFF;
65 *dst = ARGB_JOIN((*src >> 8), c, c, c);
66 }
67 }
68 else
69 {
70 for (; src < end; src++, dst++)
71 {
72 int c = (*src) & 0xFF;
73 *dst = ARGB_JOIN(0xFF, c, c, c);
74 }
75 }
76
77 return ret;
78}
79
80void *
81evas_common_convert_agry88_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
82{
83 switch (cspace) {
84 case EVAS_COLORSPACE_ARGB8888:
85 return evas_common_convert_agry88_to_argb8888(data, w, h, stride, has_alpha);
86 default:
87 return NULL;
88 }
89}
90
91static inline void *
92evas_common_convert_gry8_to_argb8888(const void *data, int w, int h, int stride, Eina_Bool has_alpha)
93{
94 const DATA8 *src, *end;
95 DATA32 *ret, *dst;
96
97 src = data;
98 end = src + (stride * h);
99 ret = malloc(w * h * sizeof(DATA32));
100 dst = ret;
101
102 if (has_alpha)
103 {
104 for (; src < end; src++, dst++)
105 {
106 int c = (*src) & 0xFF;
107 *dst = ARGB_JOIN(c, c, c, c);
108 }
109 }
110 else
111 {
112 for (; src < end; src++, dst++)
113 {
114 int c = (*src) & 0xFF;
115 *dst = ARGB_JOIN(0xFF, c, c, c);
116 }
117 }
118
119 return ret;
120}
121
122void *
123evas_common_convert_gry8_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
124{
125 switch (cspace) {
126 case EVAS_COLORSPACE_ARGB8888:
127 return evas_common_convert_gry8_to_argb8888(data, w, h, stride, has_alpha);
128 default:
129 return NULL;
130 }
131}
132
133static inline void *
50evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, Eina_Bool has_alpha) 134evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, Eina_Bool has_alpha)
51{ 135{
52 uint32_t *src, *end; 136 uint32_t *src, *end;
@@ -68,8 +152,6 @@ evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, Eina_Bo
68 return ret; 152 return ret;
69} 153}
70 154
71
72
73EAPI void * 155EAPI void *
74evas_common_convert_argb8888_to(void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace) 156evas_common_convert_argb8888_to(void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace)
75{ 157{
diff --git a/src/lib/evas/common/evas_convert_colorspace.h b/src/lib/evas/common/evas_convert_colorspace.h
index f3bec78..51a94f9 100644
--- a/src/lib/evas/common/evas_convert_colorspace.h
+++ b/src/lib/evas/common/evas_convert_colorspace.h
@@ -8,5 +8,7 @@ EAPI void *evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Co
8EAPI void *evas_common_convert_yuv_422_601_to (void *data, int w, int h, Evas_Colorspace cspace); 8EAPI void *evas_common_convert_yuv_422_601_to (void *data, int w, int h, Evas_Colorspace cspace);
9EAPI void *evas_common_convert_yuv_420_601_to (void *data, int w, int h, Evas_Colorspace cspace); 9EAPI void *evas_common_convert_yuv_420_601_to (void *data, int w, int h, Evas_Colorspace cspace);
10EAPI void *evas_common_convert_yuv_420T_601_to(void *data, int w, int h, Evas_Colorspace cspace); 10EAPI void *evas_common_convert_yuv_420T_601_to(void *data, int w, int h, Evas_Colorspace cspace);
11void *evas_common_convert_agry88_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
12void *evas_common_convert_gry8_to(const void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
11 13
12#endif /* _EVAS_CONVERT_COLORSPACE_H */ 14#endif /* _EVAS_CONVERT_COLORSPACE_H */