EFL_ALWAYS_INLINE void _soft8_convert_from_rgba_pt(const DATA32 * src, DATA8 * dst, DATA8 * alpha) { if (A_VAL(src) == 0) { *dst = 0; *alpha = 0; } else { *dst = GRY_8_FROM_RGB(src); *alpha = A_VAL(src); } }
static always_inline void _soft8_convert_from_rgba_pt(const DATA32 * src, DATA8 * dst, DATA8 * alpha) { if (A_VAL(src) == 0) { *dst = 0; *alpha = 0; } else { *dst = GRY_8_FROM_RGB(src); *alpha = A_VAL(src); } }
static void _soft8_rectangle_draw_int(Soft8_Image * dst, RGBA_Draw_Context * dc, Eina_Rectangle dr) { int dst_offset; if (_is_empty_rectangle(&dr)) return; RECTS_CLIP_TO_RECT(dr.x, dr.y, dr.w, dr.h, 0, 0, dst->cache_entry.w, dst->cache_entry.h); if (_is_empty_rectangle(&dr)) return; if (dc->clip.use) RECTS_CLIP_TO_RECT(dr.x, dr.y, dr.w, dr.h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); if (_is_empty_rectangle(&dr)) return; if (A_VAL(&dc->col.col) == 0) return; dst_offset = dr.x + (dr.y * dst->stride); if (!dst->cache_entry.flags.alpha) { DATA8 gry8; DATA8 alpha; alpha = A_VAL(&dc->col.col); gry8 = GRY_8_FROM_RGB(&dc->col.col); if (alpha == 0xff) _soft8_rectangle_draw_solid_solid(dst, dst_offset, dr.w, dr.h, gry8); else if (alpha > 0) _soft8_rectangle_draw_transp_solid (dst, dst_offset, dr.w, dr.h, gry8, alpha); } else ERR("Unsupported feature: drawing rectangle to non-opaque destination."); }
void evas_common_soft8_polygon_draw(Soft8_Image * dst, RGBA_Draw_Context * dc, RGBA_Polygon_Point * points, int x, int y) { RGBA_Polygon_Point *pt; RGBA_Vertex *point; RGBA_Edge *edges; int num_active_edges; int n; int i, j, k; int y0, y1, yi; int ext_x, ext_y, ext_w, ext_h; int *sorted_index; DATA8 alpha; DATA8 gry8; alpha = A_VAL(&dc->col.col); if (alpha == 0) return; alpha++; gry8 = GRY_8_FROM_RGB(&dc->col.col); ext_x = 0; ext_y = 0; ext_w = dst->cache_entry.w; ext_h = dst->cache_entry.h; if (dc->clip.use) RECTS_CLIP_TO_RECT(ext_x, ext_y, ext_w, ext_h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); if ((ext_w <= 0) || (ext_h <= 0)) return; n = 0; EINA_INLIST_FOREACH(points, pt) n++; if (n < 3) return; edges = malloc(sizeof(RGBA_Edge) * n); if (!edges) return; point = malloc(sizeof(RGBA_Vertex) * n); if (!point) { free(edges); return; } sorted_index = malloc(sizeof(int) * n); if (!sorted_index) { free(edges); free(point); return; } k = 0; EINA_INLIST_FOREACH(points, pt) { point[k].x = pt->x + x; point[k].y = pt->y + y; point[k].i = k; k++; }