forked from enlightenment/efl
1. line support in gl engine - as if anyone uses lines
2. fix clipping for gl maps - was setting them when it shouldnt. SVN revision: 44782
This commit is contained in:
parent
65c4336b0b
commit
fa435074e0
|
@ -956,6 +956,8 @@ evas_render_updates_internal(Evas *e,
|
|||
cx, cy, cw, ch);
|
||||
e->engine.func->context_cutout_clear(e->engine.data.output,
|
||||
e->engine.data.context);
|
||||
e->engine.func->context_clip_unset(e->engine.data.output,
|
||||
e->engine.data.context);
|
||||
}
|
||||
/* render all object that intersect with rect */
|
||||
for (i = 0; i < e->active_objects.count; ++i)
|
||||
|
@ -982,11 +984,18 @@ evas_render_updates_internal(Evas *e,
|
|||
(eina_array_data_get(&e->temporary_objects, offset) == obj))
|
||||
offset++;
|
||||
x = cx; y = cy; w = cw; h = ch;
|
||||
RECTS_CLIP_TO_RECT(x, y, w, h,
|
||||
obj->cur.cache.clip.x + off_x,
|
||||
obj->cur.cache.clip.y + off_y,
|
||||
obj->cur.cache.clip.w,
|
||||
obj->cur.cache.clip.h);
|
||||
if (obj->cur.clipper)
|
||||
{
|
||||
if (_evas_render_has_map(obj))
|
||||
{
|
||||
evas_object_clip_recalc(obj);
|
||||
}
|
||||
RECTS_CLIP_TO_RECT(x, y, w, h,
|
||||
obj->cur.cache.clip.x + off_x,
|
||||
obj->cur.cache.clip.y + off_y,
|
||||
obj->cur.cache.clip.w,
|
||||
obj->cur.cache.clip.h);
|
||||
}
|
||||
if (((w > 0) && (h > 0)) || (obj->smart.smart))
|
||||
{
|
||||
e->engine.func->context_clip_set(e->engine.data.output,
|
||||
|
|
|
@ -174,7 +174,7 @@ evas_object_clip_recalc(Evas_Object *obj)
|
|||
return;
|
||||
if (obj->layer->evas->events_frozen > 0) return;
|
||||
evas_object_coords_recalc(obj);
|
||||
if (obj->cur.map)
|
||||
if ((obj->cur.map) && (obj->cur.usemap))
|
||||
{
|
||||
cx = obj->cur.map->normal_geometry.x;
|
||||
cy = obj->cur.map->normal_geometry.y;
|
||||
|
|
|
@ -40,11 +40,11 @@ evas_gl_rectangle.c \
|
|||
evas_gl_texture.c \
|
||||
evas_gl_image.c \
|
||||
evas_gl_font.c \
|
||||
evas_gl_polygon.c
|
||||
evas_gl_polygon.c \
|
||||
evas_gl_line.c
|
||||
|
||||
#evas_gl_gradient.c \
|
||||
#evas_gl_line.c \
|
||||
#evas_gl_misc.c \
|
||||
#evas_gl_gradient.c \
|
||||
#evas_gl_polygon.c \
|
||||
#
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ struct _Evas_GL_Context
|
|||
GLfloat *texuv;
|
||||
GLfloat *texuv2;
|
||||
GLfloat *texuv3;
|
||||
Eina_Bool line : 1;
|
||||
} array;
|
||||
struct {
|
||||
Eina_Bool size : 1;
|
||||
|
@ -227,7 +228,11 @@ void evas_gl_common_context_free(Evas_GL_Context *gc);
|
|||
void evas_gl_common_context_use(Evas_GL_Context *gc);
|
||||
void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h);
|
||||
void evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, Evas_GL_Image *surface);
|
||||
|
||||
|
||||
void evas_gl_common_context_line_push(Evas_GL_Context *gc,
|
||||
int x1, int y1, int x2, int y2,
|
||||
int clip, int cx, int cy, int cw, int ch,
|
||||
int r, int g, int b, int a);
|
||||
void evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
|
||||
int x, int y, int w, int h,
|
||||
int r, int g, int b, int a);
|
||||
|
@ -291,55 +296,11 @@ Evas_GL_Polygon *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, in
|
|||
Evas_GL_Polygon *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly);
|
||||
void evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly);
|
||||
|
||||
void evas_gl_common_line_draw(Evas_GL_Context *gc, int x1, int y1, int x2, int y2);
|
||||
|
||||
void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b);
|
||||
void (*glsym_glBindFramebuffer) (GLenum a, GLuint b);
|
||||
void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e);
|
||||
void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Evas_GL_Gradient *evas_gl_common_gradient_new(void);
|
||||
void evas_gl_common_gradient_free(Evas_GL_Gradient *gr);
|
||||
void evas_gl_common_gradient_color_stop_add(Evas_GL_Gradient *gr, int r, int g, int b, int a, int delta);
|
||||
void evas_gl_common_gradient_alpha_stop_add(Evas_GL_Gradient *gr, int a, int delta);
|
||||
void evas_gl_common_gradient_color_data_set(Evas_GL_Gradient *gr, void *data, int len, int has_alpha);
|
||||
void evas_gl_common_gradient_alpha_data_set(Evas_GL_Gradient *gr, void *alpha_data, int len);
|
||||
void evas_gl_common_gradient_clear(Evas_GL_Gradient *gr);
|
||||
void evas_gl_common_gradient_fill_set(Evas_GL_Gradient *gr, int x, int y, int w, int h);
|
||||
void evas_gl_common_gradient_fill_angle_set(Evas_GL_Gradient *gr, double angle);
|
||||
void evas_gl_common_gradient_fill_spread_set(Evas_GL_Gradient *gr, int spread);
|
||||
void evas_gl_common_gradient_map_angle_set(Evas_GL_Gradient *gr, double angle);
|
||||
void evas_gl_common_gradient_map_offset_set(Evas_GL_Gradient *gr, float offset);
|
||||
void evas_gl_common_gradient_map_direction_set(Evas_GL_Gradient *gr, int direction);
|
||||
void evas_gl_common_gradient_type_set(Evas_GL_Gradient *gr, char *name, char *params);
|
||||
int evas_gl_common_gradient_is_opaque(Evas_GL_Context *gc, Evas_GL_Gradient *gr, int x, int y, int w, int h);
|
||||
int evas_gl_common_gradient_is_visible(Evas_GL_Context *gc, Evas_GL_Gradient *gr, int x, int y, int w, int h);
|
||||
void evas_gl_common_gradient_render_pre(Evas_GL_Context *gc, Evas_GL_Gradient *gr);
|
||||
void evas_gl_common_gradient_render_post(Evas_GL_Gradient *gr);
|
||||
void evas_gl_common_gradient_draw(Evas_GL_Context *gc, Evas_GL_Gradient *gr,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
void evas_gl_common_swap_rect(Evas_GL_Context *gc, int x, int y, int w, int h);
|
||||
|
||||
void evas_gl_common_line_draw(Evas_GL_Context *gc, int x1, int y1, int x2, int y2);
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
|
|
@ -397,6 +397,47 @@ _evas_gl_common_context_array_alloc(Evas_GL_Context *gc)
|
|||
gc->array.alloc * sizeof(GLfloat) * 2);
|
||||
}
|
||||
|
||||
void
|
||||
evas_gl_common_context_line_push(Evas_GL_Context *gc,
|
||||
int x1, int y1, int x2, int y2,
|
||||
int clip, int cx, int cy, int cw, int ch,
|
||||
int r, int g, int b, int a)
|
||||
{
|
||||
int pnum, nv, nc, nu, nt, i;
|
||||
Eina_Bool blend = 0;
|
||||
|
||||
shader_array_flush(gc);
|
||||
|
||||
if (a < 255) blend = 1;
|
||||
if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0;
|
||||
gc->shader.cur_tex = 0;
|
||||
gc->shader.cur_prog = gc->shared->shader.rect.prog;
|
||||
gc->shader.blend = blend;
|
||||
gc->shader.render_op = gc->dc->render_op;
|
||||
gc->shader.clip = clip;
|
||||
gc->shader.cx = cx;
|
||||
gc->shader.cy = cy;
|
||||
gc->shader.cw = cw;
|
||||
gc->shader.ch = ch;
|
||||
|
||||
gc->array.line = 1;
|
||||
pnum = gc->array.num;
|
||||
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
|
||||
gc->array.num += 1;
|
||||
_evas_gl_common_context_array_alloc(gc);
|
||||
|
||||
PUSH_VERTEX(x1 , y1 , 0);
|
||||
PUSH_VERTEX(x2 , y2 , 0);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
PUSH_COLOR(r, g, b, a);
|
||||
}
|
||||
|
||||
shader_array_flush(gc);
|
||||
gc->array.line = 0;
|
||||
}
|
||||
|
||||
void
|
||||
evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
|
||||
int x, int y, int w, int h,
|
||||
|
@ -827,7 +868,10 @@ shader_array_flush(Evas_GL_Context *gc)
|
|||
if (gc->shader.clip)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
else
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
// glScissor(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (gc->shader.clip)
|
||||
{
|
||||
|
@ -835,10 +879,12 @@ shader_array_flush(Evas_GL_Context *gc)
|
|||
(gc->shader.cx != gc->shader.current.cx) ||
|
||||
(gc->shader.cx != gc->shader.current.cx) ||
|
||||
(gc->shader.cx != gc->shader.current.cx))
|
||||
glScissor(gc->shader.cx,
|
||||
gc->h - gc->shader.cy - gc->shader.ch,
|
||||
gc->shader.cw,
|
||||
gc->shader.ch);
|
||||
{
|
||||
glScissor(gc->shader.cx,
|
||||
gc->h - gc->shader.cy - gc->shader.ch,
|
||||
gc->shader.cw,
|
||||
gc->shader.ch);
|
||||
}
|
||||
// gc->clip.x,
|
||||
// gc->h - gc->clip.y - gc->clip.h,
|
||||
// gc->clip.w,
|
||||
|
@ -849,25 +895,34 @@ shader_array_flush(Evas_GL_Context *gc)
|
|||
glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->array.vertex);
|
||||
glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->array.color);
|
||||
glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv);
|
||||
if ((gc->array.texuv2) && (gc->array.texuv3))
|
||||
{
|
||||
glEnableVertexAttribArray(SHAD_TEXUV2);
|
||||
glEnableVertexAttribArray(SHAD_TEXUV3);
|
||||
glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2);
|
||||
glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv3);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texu);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texv);
|
||||
}
|
||||
else
|
||||
|
||||
if (gc->array.line)
|
||||
{
|
||||
glDisableVertexAttribArray(SHAD_TEXUV2);
|
||||
glDisableVertexAttribArray(SHAD_TEXUV3);
|
||||
glDrawArrays(GL_LINES, 0, gc->array.num);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((gc->array.texuv2) && (gc->array.texuv3))
|
||||
{
|
||||
glEnableVertexAttribArray(SHAD_TEXUV2);
|
||||
glEnableVertexAttribArray(SHAD_TEXUV3);
|
||||
glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2);
|
||||
glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv3);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texu);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texv);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisableVertexAttribArray(SHAD_TEXUV2);
|
||||
glDisableVertexAttribArray(SHAD_TEXUV3);
|
||||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, gc->array.num);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, gc->array.num);
|
||||
}
|
||||
gc->shader.current.cur_prog = gc->shader.cur_prog;
|
||||
gc->shader.current.cur_tex = gc->shader.cur_tex;
|
||||
gc->shader.current.blend = gc->shader.blend;
|
||||
|
|
|
@ -312,8 +312,6 @@ evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im,
|
|||
|
||||
_evas_gl_common_image_update(gc, im);
|
||||
|
||||
// FIXME: need to handle clipping with a scissor. only sane way to do it.
|
||||
|
||||
glFlush();
|
||||
|
||||
c = gc->dc->clip.use;
|
||||
|
|
|
@ -3,28 +3,30 @@
|
|||
void
|
||||
evas_gl_common_line_draw(Evas_GL_Context *gc, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
RGBA_Draw_Context *dc;
|
||||
int r, g, b, a;
|
||||
RGBA_Draw_Context *dc = gc->dc;
|
||||
|
||||
a = (dc->col.col >> 24) & 0xff;
|
||||
r = (dc->col.col >> 16) & 0xff;
|
||||
g = (dc->col.col >> 8 ) & 0xff;
|
||||
b = (dc->col.col ) & 0xff;
|
||||
evas_gl_common_context_color_set(gc, r, g, b, a);
|
||||
if (a < 255) evas_gl_common_context_blend_set(gc, 1);
|
||||
else evas_gl_common_context_blend_set(gc, 0);
|
||||
if (dc->clip.use)
|
||||
evas_gl_common_context_clip_set(gc, 1,
|
||||
dc->clip.x, dc->clip.y,
|
||||
dc->clip.w, dc->clip.h);
|
||||
int c, cx, cy, cw, ch;
|
||||
|
||||
dc = gc->dc;
|
||||
if (dc->mul.use)
|
||||
{
|
||||
a = (dc->mul.col >> 24) & 0xff;
|
||||
r = (dc->mul.col >> 16) & 0xff;
|
||||
g = (dc->mul.col >> 8 ) & 0xff;
|
||||
b = (dc->mul.col ) & 0xff;
|
||||
}
|
||||
else
|
||||
evas_gl_common_context_clip_set(gc, 0,
|
||||
0, 0, 0, 0);
|
||||
evas_gl_common_context_texture_set(gc, NULL, 0, 0, 0);
|
||||
evas_gl_common_context_read_buf_set(gc, GL_BACK);
|
||||
evas_gl_common_context_write_buf_set(gc, GL_BACK);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2i(x1, y1);
|
||||
glVertex2i(x2, y2);
|
||||
glEnd();
|
||||
{
|
||||
r = g = b = a = 255;
|
||||
}
|
||||
|
||||
glFlush();
|
||||
|
||||
c = gc->dc->clip.use;
|
||||
cx = gc->dc->clip.x; cy = gc->dc->clip.y;
|
||||
cw = gc->dc->clip.w; ch = gc->dc->clip.h;
|
||||
|
||||
evas_gl_common_context_line_push(gc, x1, y1, x2, y2,
|
||||
c, cx, cy, cw, ch,
|
||||
r, g, b, a);
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2,
|
|||
eng_window_use(re->win);
|
||||
evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
|
||||
re->win->gl_context->dc = context;
|
||||
//-// evas_gl_common_line_draw(re->win->gl_context, x1, y1, x2, y2);
|
||||
evas_gl_common_line_draw(re->win->gl_context, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -390,55 +390,76 @@ eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
|
|||
static void
|
||||
eng_gradient2_color_np_stop_insert(void *data __UNUSED__, void *gradient __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__, float pos __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_color_np_stop_insert(gradient, r, g, b, a, pos);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_clear(void *data __UNUSED__, void *gradient __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_clear(gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_fill_transform_set(void *data __UNUSED__, void *gradient __UNUSED__, void *transform __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_fill_transform_set(gradient, transform);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_fill_spread_set
|
||||
(void *data __UNUSED__, void *gradient __UNUSED__, int spread __UNUSED__)
|
||||
eng_gradient2_fill_spread_set(void *data __UNUSED__, void *gradient __UNUSED__, int spread __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_fill_spread_set(gradient, spread);
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_gradient2_linear_new(void *data __UNUSED__)
|
||||
{
|
||||
return NULL;
|
||||
return evas_common_gradient2_linear_new();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_linear_free(void *data __UNUSED__, void *linear_gradient __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_free(linear_gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_linear_fill_set(void *data __UNUSED__, void *linear_gradient __UNUSED__, float x0 __UNUSED__, float y0 __UNUSED__, float x1 __UNUSED__, float y1 __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_linear_fill_set(linear_gradient, x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient2_linear_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
return 1;
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient;
|
||||
|
||||
if (!dc || !gr || !gr->type.geometer) return 0;
|
||||
return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
|
||||
gr->type.geometer->has_mask(gr, dc->render_op));
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient2_linear_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
|
||||
if (!dc || !linear_gradient) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_linear_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__)
|
||||
{
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient;
|
||||
int len;
|
||||
|
||||
if (!dc || !gr || !gr->type.geometer) return;
|
||||
gr->type.geometer->geom_update(gr);
|
||||
len = gr->type.geometer->get_map_len(gr);
|
||||
evas_common_gradient2_map(dc, gr, len);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -449,39 +470,86 @@ eng_gradient2_linear_render_post(void *data __UNUSED__, void *linear_gradient __
|
|||
static void
|
||||
eng_gradient2_linear_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
eng_window_use(re->win);
|
||||
re->win->gl_context->dc = context;
|
||||
{
|
||||
Evas_GL_Image *gim;
|
||||
RGBA_Image *im;
|
||||
RGBA_Draw_Context *dc = context;
|
||||
int op = dc->render_op, cuse = dc->clip.use;
|
||||
|
||||
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
||||
im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
|
||||
|
||||
dc->render_op = _EVAS_RENDER_FILL;
|
||||
dc->clip.use = 0;
|
||||
|
||||
// draw to buf, copy to tex, draw tex
|
||||
evas_common_gradient2_draw(im, dc, 0, 0, w, h, linear_gradient);
|
||||
|
||||
gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
|
||||
im->image.data, 1,
|
||||
EVAS_COLORSPACE_ARGB8888);
|
||||
dc->render_op = op;
|
||||
dc->clip.use = cuse;
|
||||
evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
evas_gl_common_image_free(gim);
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_gradient2_radial_new(void *data __UNUSED__)
|
||||
{
|
||||
return NULL;
|
||||
return evas_common_gradient2_radial_new();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_radial_free(void *data __UNUSED__, void *radial_gradient __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_free(radial_gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_radial_fill_set(void *data __UNUSED__, void *radial_gradient __UNUSED__, float cx __UNUSED__, float cy __UNUSED__, float rx __UNUSED__, float ry __UNUSED__)
|
||||
{
|
||||
evas_common_gradient2_radial_fill_set(radial_gradient, cx, cy, rx, ry);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient2_radial_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
return 1;
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient;
|
||||
|
||||
if (!dc || !gr || !gr->type.geometer) return 0;
|
||||
return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
|
||||
gr->type.geometer->has_mask(gr, dc->render_op));
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient2_radial_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
|
||||
if (!dc || !radial_gradient) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient2_radial_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__)
|
||||
{
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient;
|
||||
int len;
|
||||
|
||||
if (!dc || !gr || !gr->type.geometer) return;
|
||||
gr->type.geometer->geom_update(gr);
|
||||
len = gr->type.geometer->get_map_len(gr);
|
||||
evas_common_gradient2_map(dc, gr, len);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -492,126 +560,157 @@ eng_gradient2_radial_render_post(void *data __UNUSED__, void *radial_gradient __
|
|||
static void
|
||||
eng_gradient2_radial_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
|
||||
{
|
||||
Render_Engine *re;
|
||||
|
||||
re = (Render_Engine *)data;
|
||||
eng_window_use(re->win);
|
||||
re->win->gl_context->dc = context;
|
||||
{
|
||||
Evas_GL_Image *gim;
|
||||
RGBA_Image *im;
|
||||
RGBA_Draw_Context *dc = context;
|
||||
int op = dc->render_op, cuse = dc->clip.use;
|
||||
|
||||
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
||||
im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
|
||||
|
||||
dc->render_op = _EVAS_RENDER_FILL;
|
||||
dc->clip.use = 0;
|
||||
|
||||
// draw to buf, copy to tex, draw tex
|
||||
evas_common_gradient2_draw(im, dc, 0, 0, w, h, radial_gradient);
|
||||
|
||||
gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
|
||||
im->image.data, 1,
|
||||
EVAS_COLORSPACE_ARGB8888);
|
||||
dc->render_op = op;
|
||||
dc->clip.use = cuse;
|
||||
evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
evas_gl_common_image_free(gim);
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_gradient_new(void *data __UNUSED__)
|
||||
{
|
||||
//--// return evas_gl_common_gradient_new();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_color_stop_add(void *data __UNUSED__, void *gradient, int r, int g, int b, int a, int delta)
|
||||
{
|
||||
//--// evas_gl_common_gradient_color_stop_add(gradient, r, g, b, a, delta);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_alpha_stop_add(void *data __UNUSED__, void *gradient, int a, int delta)
|
||||
{
|
||||
//--// evas_gl_common_gradient_alpha_stop_add(gradient, a, delta);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_clear(void *data __UNUSED__, void *gradient)
|
||||
{
|
||||
//--// evas_gl_common_gradient_clear(gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_color_data_set(void *data __UNUSED__, void *gradient, void *map, int len, int has_alpha)
|
||||
{
|
||||
//--// evas_gl_common_gradient_color_data_set(gradient, map, len, has_alpha);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_alpha_data_set(void *data __UNUSED__, void *gradient, void *alpha_map, int len)
|
||||
{
|
||||
//--// evas_gl_common_gradient_alpha_data_set(gradient, alpha_map, len);
|
||||
return evas_common_gradient_new();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_free(void *data __UNUSED__, void *gradient)
|
||||
{
|
||||
//--// evas_gl_common_gradient_free(gradient);
|
||||
evas_common_gradient_free(gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_color_stop_add(void *data __UNUSED__, void *gradient, int r, int g, int b, int a, int delta)
|
||||
{
|
||||
evas_common_gradient_color_stop_add(gradient, r, g, b, a, delta);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_alpha_stop_add(void *data __UNUSED__, void *gradient, int a, int delta)
|
||||
{
|
||||
evas_common_gradient_alpha_stop_add(gradient, a, delta);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_color_data_set(void *data __UNUSED__, void *gradient, void *map, int len, int has_alpha)
|
||||
{
|
||||
evas_common_gradient_color_data_set(gradient, map, len, has_alpha);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_alpha_data_set(void *data __UNUSED__, void *gradient, void *alpha_map, int len)
|
||||
{
|
||||
evas_common_gradient_alpha_data_set(gradient, alpha_map, len);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_clear(void *data __UNUSED__, void *gradient)
|
||||
{
|
||||
evas_common_gradient_clear(gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_fill_set(void *data __UNUSED__, void *gradient, int x, int y, int w, int h)
|
||||
{
|
||||
//--// evas_gl_common_gradient_fill_set(gradient, x, y, w, h);
|
||||
evas_common_gradient_fill_set(gradient, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_fill_angle_set(void *data __UNUSED__, void *gradient, double angle)
|
||||
{
|
||||
//--// evas_gl_common_gradient_fill_angle_set(gradient, angle);
|
||||
evas_common_gradient_fill_angle_set(gradient, angle);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_fill_spread_set(void *data __UNUSED__, void *gradient, int spread)
|
||||
{
|
||||
//--// evas_gl_common_gradient_fill_spread_set(gradient, spread);
|
||||
evas_common_gradient_fill_spread_set(gradient, spread);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_angle_set(void *data __UNUSED__, void *gradient, double angle)
|
||||
{
|
||||
//--// evas_gl_common_gradient_map_angle_set(gradient, angle);
|
||||
evas_common_gradient_map_angle_set(gradient, angle);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_offset_set(void *data __UNUSED__, void *gradient, float offset)
|
||||
{
|
||||
//--// evas_gl_common_gradient_map_offset_set(gradient, offset);
|
||||
evas_common_gradient_map_offset_set(gradient, offset);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_direction_set(void *data __UNUSED__, void *gradient, int direction)
|
||||
{
|
||||
//--// evas_gl_common_gradient_map_direction_set(gradient, direction);
|
||||
evas_common_gradient_map_direction_set(gradient, direction);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_type_set(void *data __UNUSED__, void *gradient, char *name, char *params)
|
||||
{
|
||||
//--// evas_gl_common_gradient_type_set(gradient, name, params);
|
||||
evas_common_gradient_type_set(gradient, name, params);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient_is_opaque(void *data, void *context, void *gradient, int x, int y, int w, int h)
|
||||
{
|
||||
Render_Engine *re = (Render_Engine *)data;
|
||||
|
||||
re->win->gl_context->dc = context;
|
||||
//--// return evas_gl_common_gradient_is_opaque(re->win->gl_context, gradient, x, y, w, h);
|
||||
return 0;
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
RGBA_Gradient *gr = (RGBA_Gradient *)gradient;
|
||||
|
||||
if (!dc || !gr || !gr->type.geometer) return 0;
|
||||
return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
|
||||
gr->type.geometer->has_mask(gr, dc->render_op));
|
||||
}
|
||||
|
||||
static int
|
||||
eng_gradient_is_visible(void *data, void *context, void *gradient, int x, int y, int w, int h)
|
||||
{
|
||||
Render_Engine *re = (Render_Engine *)data;
|
||||
|
||||
re->win->gl_context->dc = context;
|
||||
//--// return evas_gl_common_gradient_is_visible(re->win->gl_context, gradient, x, y, w, h);
|
||||
return 0;
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
|
||||
if (!dc || !gradient) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_render_pre(void *data, void *context, void *gradient)
|
||||
{
|
||||
Render_Engine *re = (Render_Engine *)data;
|
||||
|
||||
re->win->gl_context->dc = context;
|
||||
//--// evas_gl_common_gradient_render_pre(re->win->gl_context, gradient);
|
||||
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
|
||||
RGBA_Gradient *gr = (RGBA_Gradient *)gradient;
|
||||
int len;
|
||||
|
||||
if (!dc || !gr || !gr->type.geometer) return;
|
||||
gr->type.geometer->geom_set(gr);
|
||||
len = gr->type.geometer->get_map_len(gr);
|
||||
evas_common_gradient_map(dc, gr, len);
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gradient_render_post(void *data __UNUSED__, void *gradient)
|
||||
{
|
||||
//--// evas_gl_common_gradient_render_post(gradient);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -622,7 +721,30 @@ eng_gradient_draw(void *data, void *context, void *surface __UNUSED__, void *gra
|
|||
re = (Render_Engine *)data;
|
||||
eng_window_use(re->win);
|
||||
re->win->gl_context->dc = context;
|
||||
//--// evas_gl_common_gradient_draw(re->win->gl_context, gradient, x, y, w, h);
|
||||
{
|
||||
Evas_GL_Image *gim;
|
||||
RGBA_Image *im;
|
||||
RGBA_Draw_Context *dc = context;
|
||||
int op = dc->render_op, cuse = dc->clip.use;
|
||||
|
||||
im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
|
||||
im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
|
||||
|
||||
dc->render_op = _EVAS_RENDER_FILL;
|
||||
dc->clip.use = 0;
|
||||
|
||||
// draw to buf, copy to tex, draw tex
|
||||
evas_common_gradient_draw(im, dc, 0, 0, w, h, gradient);
|
||||
|
||||
gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
|
||||
im->image.data, 1,
|
||||
EVAS_COLORSPACE_ARGB8888);
|
||||
dc->render_op = op;
|
||||
dc->clip.use = cuse;
|
||||
evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
|
||||
evas_cache_image_drop(&im->cache_entry);
|
||||
evas_gl_common_image_free(gim);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue