cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=05239d8dd24da4ec296b356adfb12d76a9130f6d

commit 05239d8dd24da4ec296b356adfb12d76a9130f6d
Author: Cedric BAIL <cedric.b...@samsung.com>
Date:   Mon Mar 17 14:52:47 2014 +0900

    evas: let loader specify there prefered color space.
---
 src/lib/evas/Evas_Common.h                 | 17 -----------------
 src/lib/evas/Evas_Loader.h                 | 23 ++++++++++++++++++++++-
 src/lib/evas/cache/evas_cache.h            |  2 +-
 src/lib/evas/cache/evas_cache_image.c      |  2 +-
 src/lib/evas/common/evas_image_data.c      |  2 +-
 src/lib/evas/common/evas_image_load.c      |  3 +++
 src/lib/evas/include/evas_common_private.h |  3 ++-
 7 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 801846b..3012548 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
 } Evas_Font_Hinting_Flags; /**< Flags for Font Hinting */
 
 /**
- * Colorspaces for pixel data supported by Evas
- * @ingroup Evas_Object_Image
- */
-typedef enum _Evas_Colorspace
-{
-   EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, 
accessed 1 32bit word at a time */
-   /* these are not currently supported - but planned for the future */
-   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 */
-   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 */
-   EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits 
of the 8 being used per alpha byte */
-   EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
-   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 */
-   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. */
-   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. */
-} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
-
-/**
  * How to pack items into cells in a table.
  * @ingroup Evas_Object_Table
  *
diff --git a/src/lib/evas/Evas_Loader.h b/src/lib/evas/Evas_Loader.h
index c37bbaa..209af13 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
    EVAS_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over 
time, thus turning scaling cache @b on for its data */
 } Evas_Image_Scale_Hint; /**< How an image's data is to be treated by Evas, 
with regard to scaling cache */
 
+/**
+ * Colorspaces for pixel data supported by Evas
+ * @ingroup Evas_Object_Image
+ */
+typedef enum _Evas_Colorspace
+{
+   EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, 
accessed 1 32bit word at a time */
+   /* these are not currently supported - but planned for the future */
+   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 */
+   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 */
+   EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits 
of the 8 being used per alpha byte */
+   EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
+   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 */
+   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. */
+   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. */
+   EVAS_COLORSPACE_ETC1, /**< OpenGL ETC1 encoding of RGB texture @since 1.10 
*/
+} Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
+
 struct _Evas_Image_Property
 {
    unsigned int  w;
    unsigned int  h;
-   
+
    unsigned char scale;
 
    Eina_Bool     rotated;
    Eina_Bool     alpha;
    Eina_Bool     premul;
    Eina_Bool     alpha_sparse;
+
+   const Evas_Colorspace *cspaces; /**< Specify the color space handled by the 
loader @since 1.10 */
+   Evas_Colorspace cspace; /**< Specify the color space handle by the engine 
@since 1.10 */
 };
 
 struct _Evas_Image_Animated
diff --git a/src/lib/evas/cache/evas_cache.h b/src/lib/evas/cache/evas_cache.h
index 3046f7c..da6ac2c 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
 EAPI DATA32*                  evas_cache_image_pixels(Image_Entry *im);
 EAPI Image_Entry*             evas_cache_image_copied_data(Evas_Cache_Image 
*cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int 
cspace);
 EAPI Image_Entry*             evas_cache_image_data(Evas_Cache_Image *cache, 
unsigned int w, unsigned int h, DATA32 *image_data, int alpha, int cspace);
-EAPI void                     evas_cache_image_colorspace(Image_Entry *im, int 
cspace);
+EAPI void                     evas_cache_image_colorspace(Image_Entry *im, 
Evas_Colorspace cspace);
 EAPI Image_Entry*             evas_cache_image_empty(Evas_Cache_Image *cache);
 EAPI Image_Entry*             evas_cache_image_size_set(Image_Entry *im, 
unsigned int w, unsigned int h);
 
diff --git a/src/lib/evas/cache/evas_cache_image.c 
b/src/lib/evas/cache/evas_cache_image.c
index 8dea982..65fc6d2 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)
 }
 
 EAPI void
-evas_cache_image_colorspace(Image_Entry *im, int cspace)
+evas_cache_image_colorspace(Image_Entry *im, Evas_Colorspace cspace)
 {
    if (im->space == cspace) return;
    im->space = cspace;
diff --git a/src/lib/evas/common/evas_image_data.c 
b/src/lib/evas/common/evas_image_data.c
index e589188..ccf7581 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
 }
 
 int
-evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace)
+evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, Evas_Colorspace 
cspace)
 {
    RGBA_Image   *dst = (RGBA_Image *) ie_dst;
    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 52d3295..133f739 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)
              ie->h = property.h;
              ie->scale = property.scale;
              ie->flags.alpha = property.alpha;
+             if (property.cspaces)
+               ie->cspaces = property.cspaces;
             if (ie->load_opts.orientation &&
                 ie->load_opts.degree != 0)
               ie->flags.rotated = EINA_TRUE;
@@ -413,6 +415,7 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
    property.rotated = ie->flags.rotated;
    property.premul = EINA_FALSE;
    property.alpha_sparse = EINA_FALSE;
+   property.cspace = ie->space;
 
    evas_cache_image_surface_alloc(ie, ie->w, ie->h);
 
diff --git a/src/lib/evas/include/evas_common_private.h 
b/src/lib/evas/include/evas_common_private.h
index b1fc6d9..b376cd3 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
 #endif
 
    Evas_Image_Load_Opts   load_opts;
-   int                    space;
+   Evas_Colorspace        space;
+   const Evas_Colorspace *cspaces; // owned by the loader, live as long as the 
loader
 
    unsigned int           w;
    unsigned int           h;

-- 


Reply via email to