2015-12-02 01:46:29 -08:00
|
|
|
#ifndef EFL_DRAW_H
|
|
|
|
#define EFL_DRAW_H
|
2015-08-16 23:18:26 -07:00
|
|
|
|
2015-12-02 01:46:29 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Efl.h>
|
|
|
|
|
2015-12-02 22:29:32 -08:00
|
|
|
typedef void (*RGBA_Comp_Func) (uint *dest, const uint *src, int length, uint mul_col, uint const_alpha);
|
|
|
|
typedef void (*RGBA_Comp_Func_Solid) (uint *dest, int length, uint color, uint const_alpha);
|
|
|
|
typedef void (*Alpha_Gfx_Func) (uint8_t *src, uint8_t *dst, int len);
|
2015-12-02 01:46:29 -08:00
|
|
|
|
|
|
|
int efl_draw_init(void);
|
|
|
|
|
|
|
|
RGBA_Comp_Func efl_draw_func_span_get(Efl_Gfx_Render_Op op, uint color, Eina_Bool src_alpha);
|
2015-12-02 23:19:27 -08:00
|
|
|
RGBA_Comp_Func_Solid efl_draw_func_solid_span_get(Efl_Gfx_Render_Op op, uint color);
|
2015-12-02 22:29:32 -08:00
|
|
|
Alpha_Gfx_Func efl_draw_alpha_func_get(Efl_Gfx_Render_Op op, Eina_Bool has_mask);
|
2015-12-02 01:46:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
/* common sw draw helpers */
|
2015-08-16 23:18:26 -07:00
|
|
|
|
|
|
|
#ifndef MIN
|
|
|
|
#define MIN( a, b ) ( (a) < (b) ? (a) : (b) )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAX
|
|
|
|
#define MAX( a, b ) ( (a) > (b) ? (a) : (b) )
|
|
|
|
#endif
|
|
|
|
|
2015-12-02 01:46:29 -08:00
|
|
|
#ifndef A_VAL
|
|
|
|
#ifndef WORDS_BIGENDIAN
|
|
|
|
/* x86 */
|
|
|
|
#define A_VAL(p) (((uint8_t *)(p))[3])
|
|
|
|
#define R_VAL(p) (((uint8_t *)(p))[2])
|
|
|
|
#define G_VAL(p) (((uint8_t *)(p))[1])
|
|
|
|
#define B_VAL(p) (((uint8_t *)(p))[0])
|
|
|
|
#define AR_VAL(p) ((uint16_t *)(p)[1])
|
|
|
|
#define GB_VAL(p) ((uint16_t *)(p)[0])
|
|
|
|
#else
|
|
|
|
/* ppc */
|
|
|
|
#define A_VAL(p) (((uint8_t *)(p))[0])
|
|
|
|
#define R_VAL(p) (((uint8_t *)(p))[1])
|
|
|
|
#define G_VAL(p) (((uint8_t *)(p))[2])
|
|
|
|
#define B_VAL(p) (((uint8_t *)(p))[3])
|
|
|
|
#define AR_VAL(p) ((uint16_t *)(p)[0])
|
|
|
|
#define GB_VAL(p) ((uint16_t *)(p)[1])
|
|
|
|
#endif
|
2015-08-16 23:18:26 -07:00
|
|
|
#endif
|
|
|
|
|
2015-12-02 01:46:29 -08:00
|
|
|
#define DRAW_ARGB_JOIN(a,r,g,b) \
|
2015-08-16 23:18:26 -07:00
|
|
|
(((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
|
|
|
|
|
2015-12-02 01:46:29 -08:00
|
|
|
#define DRAW_MUL4_SYM(x, y) \
|
2015-08-16 23:18:26 -07:00
|
|
|
( ((((((x) >> 16) & 0xff00) * (((y) >> 16) & 0xff00)) + 0xff0000) & 0xff000000) + \
|
|
|
|
((((((x) >> 8) & 0xff00) * (((y) >> 16) & 0xff)) + 0xff00) & 0xff0000) + \
|
|
|
|
((((((x) & 0xff00) * ((y) & 0xff00)) + 0xff0000) >> 16) & 0xff00) + \
|
|
|
|
(((((x) & 0xff) * ((y) & 0xff)) + 0xff) >> 8) )
|
|
|
|
|
2015-12-02 23:19:27 -08:00
|
|
|
#define DRAW_MUL_256(a, c) \
|
|
|
|
( (((((c) >> 8) & 0x00ff00ff) * (a)) & 0xff00ff00) + \
|
|
|
|
(((((c) & 0x00ff00ff) * (a)) >> 8) & 0x00ff00ff) )
|
|
|
|
|
2015-12-02 01:46:29 -08:00
|
|
|
static inline uint
|
2015-12-02 23:19:27 -08:00
|
|
|
draw_interpolate_256(uint x, uint a, uint y, uint b)
|
2015-09-11 22:31:49 -07:00
|
|
|
{
|
2015-12-02 01:46:29 -08:00
|
|
|
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
|
|
|
|
t >>= 8;
|
|
|
|
t &= 0xff00ff;
|
|
|
|
x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
|
|
|
|
x &= 0xff00ff00;
|
|
|
|
x |= t;
|
|
|
|
return x;
|
2015-09-11 22:31:49 -07:00
|
|
|
}
|
|
|
|
|
2015-08-16 23:18:26 -07:00
|
|
|
static inline void
|
2015-12-02 01:46:29 -08:00
|
|
|
draw_memset32(uint *dest, uint value, int length)
|
2015-08-16 23:18:26 -07:00
|
|
|
{
|
|
|
|
int n;
|
2015-12-02 01:46:29 -08:00
|
|
|
|
|
|
|
if (length <= 0)
|
2015-08-16 23:18:26 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
n = (length + 7) / 8;
|
|
|
|
switch (length & 0x07)
|
|
|
|
{
|
|
|
|
case 0: do { *dest++ = value;
|
|
|
|
case 7: *dest++ = value;
|
|
|
|
case 6: *dest++ = value;
|
|
|
|
case 5: *dest++ = value;
|
|
|
|
case 4: *dest++ = value;
|
|
|
|
case 3: *dest++ = value;
|
|
|
|
case 2: *dest++ = value;
|
|
|
|
case 1: *dest++ = value;
|
|
|
|
} while (--n > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-19 07:12:29 -07:00
|
|
|
#endif
|