2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
7 #include "evas_common.h"
8 #include "evas_private.h"
11 evas_common_rgba_image_from_data(Image_Entry* ie_dst, int w, int h, DATA32 *image_data, int alpha, int cspace)
13 RGBA_Image *dst = (RGBA_Image *) ie_dst;
17 case EVAS_COLORSPACE_ARGB8888:
18 dst->cache_entry.w = w;
19 dst->cache_entry.h = h;
20 dst->image.data = image_data;
21 dst->image.no_free = 1;
22 dst->cache_entry.flags.alpha = alpha ? 1 : 0;
24 case EVAS_COLORSPACE_YCBCR422P601_PL:
25 case EVAS_COLORSPACE_YCBCR422P709_PL:
27 dst->cache_entry.w = w;
28 dst->cache_entry.h = h;
29 dst->cs.data = image_data;
36 dst->cache_entry.space = cspace;
37 evas_common_image_colorspace_dirty(dst);
42 evas_common_rgba_image_from_copied_data(Image_Entry* ie_dst, int w, int h, DATA32 *image_data, int alpha, int cspace)
44 RGBA_Image *dst = (RGBA_Image *) ie_dst;
46 /* FIXME: Is dst->image.data valid. */
49 case EVAS_COLORSPACE_ARGB8888:
50 dst->cache_entry.flags.alpha = alpha ? 1 : 0;
52 memcpy(dst->image.data, image_data, w * h * sizeof(DATA32));
54 case EVAS_COLORSPACE_YCBCR422P601_PL:
55 case EVAS_COLORSPACE_YCBCR422P709_PL:
56 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char*) * 2);
57 if (image_data && (dst->cs.data))
58 memcpy(dst->cs.data, image_data, dst->cache_entry.h * sizeof(unsigned char*) * 2);
65 dst->cache_entry.space = cspace;
66 evas_common_image_colorspace_dirty(dst);
71 evas_common_rgba_image_size_set(Image_Entry *ie_dst, const Image_Entry *ie_im, int w, int h)
73 RGBA_Image *dst = (RGBA_Image *) ie_dst;
74 RGBA_Image *im = (RGBA_Image *) ie_im;
76 if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
77 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL))
80 dst->flags = im->flags;
82 if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
83 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL))
84 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2);
85 evas_common_image_colorspace_dirty(dst);
91 evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace)
93 RGBA_Image *dst = (RGBA_Image *) ie_dst;
97 case EVAS_COLORSPACE_ARGB8888:
100 if (!dst->cs.no_free) free(dst->cs.data);
105 case EVAS_COLORSPACE_YCBCR422P601_PL:
106 case EVAS_COLORSPACE_YCBCR422P709_PL:
107 if (dst->image.no_free)
109 dst->image.data = NULL;
110 dst->image.no_free = 0;
111 /* FIXME: Must allocate image.data surface cleanly. */
115 if (!dst->cs.no_free) free(dst->cs.data);
117 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2);
124 dst->cache_entry.space = cspace;
125 evas_common_image_colorspace_dirty(dst);