diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/lib/engines/common/evas_draw_main.c | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_draw_main.c b/libraries/evas/src/lib/engines/common/evas_draw_main.c index 7652708..def19a8 100644 --- a/libraries/evas/src/lib/engines/common/evas_draw_main.c +++ b/libraries/evas/src/lib/engines/common/evas_draw_main.c | |||
@@ -75,6 +75,14 @@ evas_common_draw_context_free(RGBA_Draw_Context *dc) | |||
75 | { | 75 | { |
76 | if (!dc) return; | 76 | if (!dc) return; |
77 | 77 | ||
78 | #ifdef HAVE_PIXMAN | ||
79 | if (dc->col.pixman_color_image) | ||
80 | { | ||
81 | pixman_image_unref(dc->col.pixman_color_image); | ||
82 | dc->col.pixman_color_image = NULL; | ||
83 | } | ||
84 | #endif | ||
85 | |||
78 | evas_common_draw_context_apply_clean_cutouts(&dc->cutout); | 86 | evas_common_draw_context_apply_clean_cutouts(&dc->cutout); |
79 | free(dc); | 87 | free(dc); |
80 | } | 88 | } |
@@ -133,6 +141,20 @@ evas_common_draw_context_set_color(RGBA_Draw_Context *dc, int r, int g, int b, i | |||
133 | G_VAL(&(dc->col.col)) = (DATA8)g; | 141 | G_VAL(&(dc->col.col)) = (DATA8)g; |
134 | B_VAL(&(dc->col.col)) = (DATA8)b; | 142 | B_VAL(&(dc->col.col)) = (DATA8)b; |
135 | A_VAL(&(dc->col.col)) = (DATA8)a; | 143 | A_VAL(&(dc->col.col)) = (DATA8)a; |
144 | #ifdef HAVE_PIXMAN | ||
145 | if (dc && dc->col.pixman_color_image) | ||
146 | pixman_image_unref(dc->col.pixman_color_image); | ||
147 | |||
148 | pixman_color_t pixman_color; | ||
149 | |||
150 | pixman_color.alpha = (dc->col.col & 0xff000000) >> 16; | ||
151 | pixman_color.red = (dc->col.col & 0x00ff0000) >> 8; | ||
152 | pixman_color.green = (dc->col.col & 0x0000ff00); | ||
153 | pixman_color.blue = (dc->col.col & 0x000000ff) << 8; | ||
154 | |||
155 | dc->col.pixman_color_image = pixman_image_create_solid_fill(&pixman_color); | ||
156 | #endif | ||
157 | |||
136 | } | 158 | } |
137 | 159 | ||
138 | EAPI void | 160 | EAPI void |
@@ -159,12 +181,42 @@ evas_common_draw_context_set_mask(RGBA_Draw_Context *dc, RGBA_Image *mask, int x | |||
159 | dc->mask.y = y; | 181 | dc->mask.y = y; |
160 | dc->mask.w = w; | 182 | dc->mask.w = w; |
161 | dc->mask.h = h; | 183 | dc->mask.h = h; |
184 | |||
185 | #ifdef HAVE_PIXMAN | ||
186 | if (mask->pixman.im) | ||
187 | pixman_image_unref(mask->pixman.im); | ||
188 | |||
189 | if (mask->cache_entry.flags.alpha) | ||
190 | { | ||
191 | mask->pixman.im = pixman_image_create_bits(PIXMAN_a8r8g8b8, w, h, | ||
192 | (uint32_t *)mask->mask.mask, | ||
193 | w * 4); | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | mask->pixman.im = pixman_image_create_bits(PIXMAN_x8r8g8b8, w, h, | ||
198 | (uint32_t *)mask->mask.mask, | ||
199 | w * 4); | ||
200 | } | ||
201 | #endif | ||
202 | |||
162 | } | 203 | } |
163 | 204 | ||
164 | EAPI void | 205 | EAPI void |
165 | evas_common_draw_context_unset_mask(RGBA_Draw_Context *dc) | 206 | evas_common_draw_context_unset_mask(RGBA_Draw_Context *dc) |
166 | { | 207 | { |
167 | dc->mask.mask = NULL; | 208 | dc->mask.mask = NULL; |
209 | |||
210 | #ifdef HAVE_PIXMAN | ||
211 | RGBA_Image *mask; | ||
212 | mask = (RGBA_Image *)dc->mask.mask; | ||
213 | |||
214 | if (mask && mask->pixman.im) | ||
215 | { | ||
216 | pixman_image_unref(mask->pixman.im); | ||
217 | mask->pixman.im = NULL; | ||
218 | } | ||
219 | #endif | ||
168 | } | 220 | } |
169 | 221 | ||
170 | 222 | ||
@@ -179,32 +231,32 @@ evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w, | |||
179 | { | 231 | { |
180 | #if 1 // this is a bit faster | 232 | #if 1 // this is a bit faster |
181 | int xa1, xa2, xb1, xb2; | 233 | int xa1, xa2, xb1, xb2; |
182 | 234 | ||
183 | xa1 = x; | 235 | xa1 = x; |
184 | xa2 = xa1 + w - 1; | 236 | xa2 = xa1 + w - 1; |
185 | xb1 = dc->clip.x; | 237 | xb1 = dc->clip.x; |
186 | if (xa2 < xb1) return; | 238 | if (xa2 < xb1) return; |
187 | xb2 = xb1 + dc->clip.w - 1; | 239 | xb2 = xb1 + dc->clip.w - 1; |
188 | if (xa1 >= xb2) return; | 240 | if (xa1 >= xb2) return; |
189 | if (xa2 > xb2) xa2 = xb2; | 241 | if (xa2 > xb2) xa2 = xb2; |
190 | if (xb1 > xa1) xa1 = xb1; | 242 | if (xb1 > xa1) xa1 = xb1; |
191 | x = xa1; | 243 | x = xa1; |
192 | w = xa2 - xa1 + 1; | 244 | w = xa2 - xa1 + 1; |
193 | 245 | ||
194 | xa1 = y; | 246 | xa1 = y; |
195 | xa2 = xa1 + h - 1; | 247 | xa2 = xa1 + h - 1; |
196 | xb1 = dc->clip.y; | 248 | xb1 = dc->clip.y; |
197 | if (xa2 < xb1) return; | 249 | if (xa2 < xb1) return; |
198 | xb2 = xb1 + dc->clip.h - 1; | 250 | xb2 = xb1 + dc->clip.h - 1; |
199 | if (xa1 >= xb2) return; | 251 | if (xa1 >= xb2) return; |
200 | if (xa2 > xb2) xa2 = xb2; | 252 | if (xa2 > xb2) xa2 = xb2; |
201 | if (xb1 > xa1) xa1 = xb1; | 253 | if (xb1 > xa1) xa1 = xb1; |
202 | y = xa1; | 254 | y = xa1; |
203 | h = xa2 - xa1 + 1; | 255 | h = xa2 - xa1 + 1; |
204 | #else | 256 | #else |
205 | RECTS_CLIP_TO_RECT(x, y, w, h, | 257 | RECTS_CLIP_TO_RECT(x, y, w, h, |
206 | dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); | 258 | dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); |
207 | #endif | 259 | #endif |
208 | if ((w < 1) || (h < 1)) return; | 260 | if ((w < 1) || (h < 1)) return; |
209 | } | 261 | } |
210 | evas_common_draw_context_cutouts_add(&dc->cutout, x, y, w, h); | 262 | evas_common_draw_context_cutouts_add(&dc->cutout, x, y, w, h); |
@@ -513,7 +565,7 @@ evas_common_draw_context_apply_cutouts(RGBA_Draw_Context *dc) | |||
513 | 565 | ||
514 | if (!dc->clip.use) return NULL; | 566 | if (!dc->clip.use) return NULL; |
515 | if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL; | 567 | if ((dc->clip.w <= 0) || (dc->clip.h <= 0)) return NULL; |
516 | 568 | ||
517 | 569 | ||
518 | res = evas_common_draw_context_cutouts_new(); | 570 | res = evas_common_draw_context_cutouts_new(); |
519 | evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); | 571 | evas_common_draw_context_cutouts_add(res, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); |