summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2014-03-17 14:52:47 +0900
committerCedric BAIL <cedric.bail@free.fr>2014-04-01 22:00:14 +0900
commit05239d8dd24da4ec296b356adfb12d76a9130f6d (patch)
tree7b45407f332b5a29b4273e21f9c211aaa89dafe0
parentb56d7bba605d2bd156f438d6dd2da6818474bde3 (diff)
evas: let loader specify there prefered color space.
-rw-r--r--src/lib/evas/Evas_Common.h17
-rw-r--r--src/lib/evas/Evas_Loader.h23
-rw-r--r--src/lib/evas/cache/evas_cache.h2
-rw-r--r--src/lib/evas/cache/evas_cache_image.c2
-rw-r--r--src/lib/evas/common/evas_image_data.c2
-rw-r--r--src/lib/evas/common/evas_image_load.c3
-rw-r--r--src/lib/evas/include/evas_common_private.h3
7 files changed, 30 insertions, 22 deletions
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 801846b683..3012548210 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -178,23 +178,6 @@ typedef enum _Evas_Font_Hinting_Flags
178} Evas_Font_Hinting_Flags; /**< Flags for Font Hinting */ 178} Evas_Font_Hinting_Flags; /**< Flags for Font Hinting */
179 179
180/** 180/**
181 * Colorspaces for pixel data supported by Evas
182 * @ingroup Evas_Object_Image
183 */
184typedef enum _Evas_Colorspace
185{
186 EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */
187 /* these are not currently supported - but planned for the future */
188 EVAS_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
189 EVAS_COLORSPACE_YCBCR422P709_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
190 EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
191 EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
192 EVAS_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */
193 EVAS_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */
194 EVAS_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */
195} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
196
197/**
198 * How to pack items into cells in a table. 181 * How to pack items into cells in a table.
199 * @ingroup Evas_Object_Table 182 * @ingroup Evas_Object_Table
200 * 183 *
diff --git a/src/lib/evas/Evas_Loader.h b/src/lib/evas/Evas_Loader.h
index c37bbaac88..209af13a9a 100644
--- a/src/lib/evas/Evas_Loader.h
+++ b/src/lib/evas/Evas_Loader.h
@@ -146,17 +146,38 @@ typedef enum _Evas_Image_Scale_Hint
146 EVAS_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over time, thus turning scaling cache @b on for its data */ 146 EVAS_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over time, thus turning scaling cache @b on for its data */
147} Evas_Image_Scale_Hint; /**< How an image's data is to be treated by Evas, with regard to scaling cache */ 147} Evas_Image_Scale_Hint; /**< How an image's data is to be treated by Evas, with regard to scaling cache */
148 148
149/**
150 * Colorspaces for pixel data supported by Evas
151 * @ingroup Evas_Object_Image
152 */
153typedef enum _Evas_Colorspace
154{
155 EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */
156 /* these are not currently supported - but planned for the future */
157 EVAS_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
158 EVAS_COLORSPACE_YCBCR422P709_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
159 EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
160 EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
161 EVAS_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */
162 EVAS_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */
163 EVAS_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */
164 EVAS_COLORSPACE_ETC1, /**< OpenGL ETC1 encoding of RGB texture @since 1.10 */
165} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
166
149struct _Evas_Image_Property 167struct _Evas_Image_Property
150{ 168{
151 unsigned int w; 169 unsigned int w;
152 unsigned int h; 170 unsigned int h;
153 171
154 unsigned char scale; 172 unsigned char scale;
155 173
156 Eina_Bool rotated; 174 Eina_Bool rotated;
157 Eina_Bool alpha; 175 Eina_Bool alpha;
158 Eina_Bool premul; 176 Eina_Bool premul;
159 Eina_Bool alpha_sparse; 177 Eina_Bool alpha_sparse;
178
179 const Evas_Colorspace *cspaces; /**< Specify the color space handled by the loader @since 1.10 */
180 Evas_Colorspace cspace; /**< Specify the color space handle by the engine @since 1.10 */
160}; 181};
161 182
162struct _Evas_Image_Animated 183struct _Evas_Image_Animated
diff --git a/src/lib/evas/cache/evas_cache.h b/src/lib/evas/cache/evas_cache.h
index 3046f7c20e..da6ac2cfd0 100644
--- a/src/lib/evas/cache/evas_cache.h
+++ b/src/lib/evas/cache/evas_cache.h
@@ -139,7 +139,7 @@ EAPI void evas_cache_image_surface_alloc(Image_Entry *im, un
139EAPI DATA32* evas_cache_image_pixels(Image_Entry *im); 139EAPI DATA32* evas_cache_image_pixels(Image_Entry *im);
140EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace); 140EAPI Image_Entry* evas_cache_image_copied_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
141EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace); 141EAPI Image_Entry* evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
142EAPI void evas_cache_image_colorspace(Image_Entry *im, int cspace); 142EAPI void evas_cache_image_colorspace(Image_Entry *im, Evas_Colorspace cspace);
143EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache); 143EAPI Image_Entry* evas_cache_image_empty(Evas_Cache_Image *cache);
144EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h); 144EAPI Image_Entry* evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h);
145 145
diff --git a/src/lib/evas/cache/evas_cache_image.c b/src/lib/evas/cache/evas_cache_image.c
index 8dea982d11..65fc6d2656 100644
--- a/src/lib/evas/cache/evas_cache_image.c
+++ b/src/lib/evas/cache/evas_cache_image.c
@@ -1368,7 +1368,7 @@ evas_cache_image_empty(Evas_Cache_Image *cache)
1368} 1368}
1369 1369
1370EAPI void 1370EAPI void
1371evas_cache_image_colorspace(Image_Entry *im, int cspace) 1371evas_cache_image_colorspace(Image_Entry *im, Evas_Colorspace cspace)
1372{ 1372{
1373 if (im->space == cspace) return; 1373 if (im->space == cspace) return;
1374 im->space = cspace; 1374 im->space = cspace;
diff --git a/src/lib/evas/common/evas_image_data.c b/src/lib/evas/common/evas_image_data.c
index e58918833e..ccf7581ca2 100644
--- a/src/lib/evas/common/evas_image_data.c
+++ b/src/lib/evas/common/evas_image_data.c
@@ -113,7 +113,7 @@ evas_common_rgba_image_size_set(Image_Entry *ie_dst, const Image_Entry *ie_im, u
113} 113}
114 114
115int 115int
116evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace) 116evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, Evas_Colorspace cspace)
117{ 117{
118 RGBA_Image *dst = (RGBA_Image *) ie_dst; 118 RGBA_Image *dst = (RGBA_Image *) ie_dst;
119 Eina_Bool change = (dst->cache_entry.space != cspace); 119 Eina_Bool change = (dst->cache_entry.space != cspace);
diff --git a/src/lib/evas/common/evas_image_load.c b/src/lib/evas/common/evas_image_load.c
index 52d3295ec4..133f7399da 100644
--- a/src/lib/evas/common/evas_image_load.c
+++ b/src/lib/evas/common/evas_image_load.c
@@ -225,6 +225,8 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error)
225 ie->h = property.h; 225 ie->h = property.h;
226 ie->scale = property.scale; 226 ie->scale = property.scale;
227 ie->flags.alpha = property.alpha; 227 ie->flags.alpha = property.alpha;
228 if (property.cspaces)
229 ie->cspaces = property.cspaces;
228 if (ie->load_opts.orientation && 230 if (ie->load_opts.orientation &&
229 ie->load_opts.degree != 0) 231 ie->load_opts.degree != 0)
230 ie->flags.rotated = EINA_TRUE; 232 ie->flags.rotated = EINA_TRUE;
@@ -413,6 +415,7 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
413 property.rotated = ie->flags.rotated; 415 property.rotated = ie->flags.rotated;
414 property.premul = EINA_FALSE; 416 property.premul = EINA_FALSE;
415 property.alpha_sparse = EINA_FALSE; 417 property.alpha_sparse = EINA_FALSE;
418 property.cspace = ie->space;
416 419
417 evas_cache_image_surface_alloc(ie, ie->w, ie->h); 420 evas_cache_image_surface_alloc(ie, ie->w, ie->h);
418 421
diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h
index b1fc6d9c97..b376cd3c82 100644
--- a/src/lib/evas/include/evas_common_private.h
+++ b/src/lib/evas/include/evas_common_private.h
@@ -593,7 +593,8 @@ struct _Image_Entry
593#endif 593#endif
594 594
595 Evas_Image_Load_Opts load_opts; 595 Evas_Image_Load_Opts load_opts;
596 int space; 596 Evas_Colorspace space;
597 const Evas_Colorspace *cspaces; // owned by the loader, live as long as the loader
597 598
598 unsigned int w; 599 unsigned int w;
599 unsigned int h; 600 unsigned int h;