aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_image_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_image_data.c')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_image_data.c151
1 files changed, 0 insertions, 151 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_image_data.c b/libraries/evas/src/lib/engines/common/evas_image_data.c
deleted file mode 100644
index 2815ff8..0000000
--- a/libraries/evas/src/lib/engines/common/evas_image_data.c
+++ /dev/null
@@ -1,151 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <assert.h>
6
7#include "evas_common.h"
8#include "evas_private.h"
9#include "evas_image.h"
10
11int
12evas_common_rgba_image_from_data(Image_Entry* ie_dst, int w, int h, DATA32 *image_data, int alpha, int cspace)
13{
14 RGBA_Image *dst = (RGBA_Image *) ie_dst;
15
16 switch (cspace)
17 {
18 case EVAS_COLORSPACE_ARGB8888:
19 dst->cache_entry.w = w;
20 dst->cache_entry.h = h;
21 dst->image.data = image_data;
22 dst->image.no_free = 1;
23 dst->cache_entry.flags.alpha = alpha ? 1 : 0;
24 break;
25 case EVAS_COLORSPACE_YCBCR422P601_PL:
26 case EVAS_COLORSPACE_YCBCR422P709_PL:
27 case EVAS_COLORSPACE_YCBCR422601_PL:
28 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
29 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
30 w &= ~0x1;
31 dst->cache_entry.w = w;
32 dst->cache_entry.h = h;
33 dst->cs.data = image_data;
34 dst->cs.no_free = 1;
35 break;
36 default:
37 abort();
38 break;
39 }
40 dst->cache_entry.space = cspace;
41 evas_common_image_colorspace_dirty(dst);
42 _evas_common_rgba_image_post_surface(ie_dst);
43 return 0;
44}
45
46int
47evas_common_rgba_image_from_copied_data(Image_Entry* ie_dst, int w, int h, DATA32 *image_data, int alpha, int cspace)
48{
49 RGBA_Image *dst = (RGBA_Image *) ie_dst;
50
51 /* FIXME: Is dst->image.data valid. */
52 switch (cspace)
53 {
54 case EVAS_COLORSPACE_ARGB8888:
55 dst->cache_entry.flags.alpha = alpha ? 1 : 0;
56 if (image_data)
57 memcpy(dst->image.data, image_data, w * h * sizeof(DATA32));
58 break;
59 case EVAS_COLORSPACE_YCBCR422P601_PL:
60 case EVAS_COLORSPACE_YCBCR422P709_PL:
61 case EVAS_COLORSPACE_YCBCR422601_PL:
62 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
63 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
64 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char*) * 2);
65 if (image_data && (dst->cs.data))
66 memcpy(dst->cs.data, image_data, dst->cache_entry.h * sizeof(unsigned char*) * 2);
67 break;
68 default:
69 abort();
70 break;
71 }
72
73 dst->cache_entry.space = cspace;
74 evas_common_image_colorspace_dirty(dst);
75 _evas_common_rgba_image_post_surface(ie_dst);
76 return 0;
77}
78
79int
80evas_common_rgba_image_size_set(Image_Entry *ie_dst, const Image_Entry *ie_im, unsigned int w, unsigned int h __UNUSED__)
81{
82 RGBA_Image *dst = (RGBA_Image *) ie_dst;
83 RGBA_Image *im = (RGBA_Image *) ie_im;
84
85 if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
86 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
87 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL) ||
88 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR420TM12601_PL) ||
89 (im->cache_entry.space == EVAS_COLORSPACE_YCBCR420NV12601_PL))
90 {
91 w &= ~0x1;
92 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2);
93 }
94
95 dst->flags = im->flags;
96 dst->cs.no_free = 0;
97 evas_common_image_colorspace_dirty(dst);
98
99 _evas_common_rgba_image_post_surface(ie_dst);
100 return 0;
101}
102
103int
104evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace)
105{
106 RGBA_Image *dst = (RGBA_Image *) ie_dst;
107
108 switch (cspace)
109 {
110 case EVAS_COLORSPACE_ARGB8888:
111 if (dst->cs.data)
112 {
113 if (!dst->cs.no_free) free(dst->cs.data);
114 dst->cs.data = NULL;
115 dst->cs.no_free = 0;
116 }
117 break;
118 case EVAS_COLORSPACE_YCBCR422P601_PL:
119 case EVAS_COLORSPACE_YCBCR422P709_PL:
120 case EVAS_COLORSPACE_YCBCR422601_PL:
121 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
122 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
123 if (dst->image.no_free)
124 {
125 ie_dst->allocated.w = 0;
126 ie_dst->allocated.h = 0;
127#ifdef BUILD_ASYNC_PRELOAD
128 ie_dst->flags.preload_done = 0;
129#endif
130 ie_dst->flags.loaded = 0;
131 dst->image.data = NULL;
132 dst->image.no_free = 0;
133 /* FIXME: Must allocate image.data surface cleanly. */
134 }
135 if (dst->cs.data)
136 {
137 if (!dst->cs.no_free) free(dst->cs.data);
138 }
139 dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2);
140 dst->cs.no_free = 0;
141 break;
142 default:
143 abort();
144 break;
145 }
146 dst->cache_entry.space = cspace;
147 evas_common_image_colorspace_dirty(dst);
148
149 _evas_common_rgba_image_post_surface(ie_dst);
150 return 0;
151}