3 #include "evas_common.h"
4 #include "evas_private.h"
5 #include "evas_image.h"
8 evas_common_rgba_image_from_data(Image_Entry* ie_dst, int w, int h, DATA32 *image_data, int alpha, int cspace)
10 RGBA_Image *dst = (RGBA_Image *) ie_dst;
14 case EVAS_COLORSPACE_ARGB8888:
15 dst->cache_entry.w = w;
16 dst->cache_entry.h = h;
17 dst->image.data = image_data;
18 dst->image.no_free = 1;
19 dst->cache_entry.flags.alpha = alpha ? 1 : 0;
21 case EVAS_COLORSPACE_YCBCR422P601_PL:
22 case EVAS_COLORSPACE_YCBCR422P709_PL:
23 case EVAS_COLORSPACE_YCBCR422601_PL:
24 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
25 case EVAS_COLORSPACE_YCBCR420NV12601_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);
38 _evas_common_rgba_image_post_surface(ie_dst);
43 evas_common_rgba_image_from_copied_data(Image_Entry* ie_dst, int w, int h, DATA32 *image_data, int alpha, int cspace)
45 RGBA_Image *dst = (RGBA_Image *) ie_dst;
47 /* FIXME: Is dst->image.data valid. */
50 case EVAS_COLORSPACE_ARGB8888:
51 dst->cache_entry.flags.alpha = alpha ? 1 : 0;
53 memcpy(dst->image.data, image_data, w * h * sizeof(DATA32));
55 case EVAS_COLORSPACE_YCBCR422P601_PL:
56 case EVAS_COLORSPACE_YCBCR422P709_PL:
57 case EVAS_COLORSPACE_YCBCR422601_PL:
58 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
59 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
60 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char*) * 2);
61 if (image_data && (dst->cs.data))
62 memcpy(dst->cs.data, image_data, dst->cache_entry.h * sizeof(unsigned char*) * 2);
69 dst->cache_entry.space = cspace;
70 evas_common_image_colorspace_dirty(dst);
71 _evas_common_rgba_image_post_surface(ie_dst);
76 evas_common_rgba_image_size_set(Image_Entry *ie_dst, const Image_Entry *ie_im, unsigned int w, unsigned int h __UNUSED__)
78 RGBA_Image *dst = (RGBA_Image *) ie_dst;
79 RGBA_Image *im = (RGBA_Image *) ie_im;
81 if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
82 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
83 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL) ||
84 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR420TM12601_PL) ||
85 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR420NV12601_PL))
88 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2);
91 dst->flags = im->flags;
93 evas_common_image_colorspace_dirty(dst);
95 _evas_common_rgba_image_post_surface(ie_dst);
100 evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace)
102 RGBA_Image *dst = (RGBA_Image *) ie_dst;
106 case EVAS_COLORSPACE_ARGB8888:
109 if (!dst->cs.no_free) free(dst->cs.data);
114 case EVAS_COLORSPACE_YCBCR422P601_PL:
115 case EVAS_COLORSPACE_YCBCR422P709_PL:
116 case EVAS_COLORSPACE_YCBCR422601_PL:
117 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
118 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
119 if (dst->image.no_free)
121 ie_dst->allocated.w = 0;
122 ie_dst->allocated.h = 0;
123 #ifdef BUILD_ASYNC_PRELOAD
124 ie_dst->flags.preload_done = 0;
126 ie_dst->flags.loaded = 0;
127 dst->image.data = NULL;
128 dst->image.no_free = 0;
129 /* FIXME: Must allocate image.data surface cleanly. */
133 if (!dst->cs.no_free) free(dst->cs.data);
135 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2);
142 dst->cache_entry.space = cspace;
143 evas_common_image_colorspace_dirty(dst);
145 _evas_common_rgba_image_post_surface(ie_dst);