evas: fix evas_object_image_data_convert.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 23 Aug 2011 16:06:41 +0000 (16:06 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 23 Aug 2011 16:06:41 +0000 (16:06 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@62722 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_image.c
src/lib/engines/common/evas_convert_colorspace.c
src/lib/engines/common/evas_convert_colorspace.h

index 5afd994..c06fbbc 100644 (file)
@@ -38,7 +38,7 @@ struct _Evas_Object_Image
       const char    *file;
       const char    *key;
       int            frame;
-      int            cspace;
+      Evas_Colorspace cspace;
 
       unsigned char  smooth_scale : 1;
       unsigned char  has_alpha :1;
@@ -836,7 +836,7 @@ evas_object_image_data_convert(Evas_Object *obj, Evas_Colorspace to_cspace)
                                                                  obj);
      }
    if (!o->engine_data) return NULL;
-   if (!o->cur.cspace == to_cspace) return NULL;
+   if (o->cur.cspace == to_cspace) return NULL;
    data = NULL;
    o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output,
                                                                  o->engine_data,
@@ -3605,6 +3605,7 @@ evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_C
 {
    void *out = NULL;
 
+   fprintf(stderr, "data: %p (%i)\n", data, o->cur.cspace);
    if (!data)
      return NULL;
 
@@ -3626,7 +3627,21 @@ evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_C
                                                  o->cur.has_alpha,
                                                  to_cspace);
          break;
+        case EVAS_COLORSPACE_YCBCR422601_PL:
+           fprintf(stderr, "EVAS_COLORSPACE_YCBCR422601_PL:\n");
+          out = evas_common_convert_yuv_422_601_to(data,
+                                                   o->cur.image.w,
+                                                   o->cur.image.h,
+                                                   to_cspace);
+          break;
+        case EVAS_COLORSPACE_YCBCR422P601_PL:
+          out = evas_common_convert_yuv_422P_601_to(data,
+                                                    o->cur.image.w,
+                                                    o->cur.image.h,
+                                                    to_cspace);
+          break;
        default:
+           fprintf(stderr, "unknow colorspace: %i\n", o->cur.cspace);
          break;
      }
 
index fa5faec..6ee1560 100644 (file)
@@ -96,5 +96,49 @@ evas_common_convert_rgb565_a5p_to(void *data, int w, int h, int stride, Eina_Boo
    return NULL;
 }
 
+EAPI void *
+evas_common_convert_yuv_422_601_to(void *data, int w, int h, Evas_Colorspace cspace)
+{
+   switch (cspace)
+     {
+      case EVAS_COLORSPACE_ARGB8888:
+        {
+           void *dst;
+
+           fprintf(stderr, "to argb888\n");
+
+           dst = malloc(sizeof (unsigned int) * w * h);
+           if (!dst) return NULL;
+
+           evas_common_convert_yuv_422_601_rgba(data, dst, w, h);
+           return dst;
+        }
+      default:
+         break;
+     }
+   return NULL;
+}
+
+EAPI void *
+evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Colorspace cspace)
+{
+   switch (cspace)
+     {
+      case EVAS_COLORSPACE_ARGB8888:
+        {
+           void *dst;
+
+           dst = malloc(sizeof (unsigned int) * w * h);
+           if (!dst) return NULL;
+
+           evas_common_convert_yuv_420p_601_rgba(data, dst, w, h);
+           break;
+        }
+      default:
+         break;
+     }
+   return NULL;
+}
+
 
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
index 354a08c..16ec4e5 100644 (file)
@@ -4,6 +4,7 @@
 
 EAPI void *evas_common_convert_argb8888_to                         (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
 EAPI void *evas_common_convert_rgb565_a5p_to                       (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
-
+EAPI void *evas_common_convert_yuv_422P_601_to                     (void *data, int w, int h, Evas_Colorspace cspace);
+EAPI void *evas_common_convert_yuv_422_601_to                      (void *data, int w, int h, Evas_Colorspace cspace);
 
 #endif /* _EVAS_CONVERT_COLORSPACE_H */