fix actually supporting clip for maps in gl.

SVN revision: 52415
This commit is contained in:
Carsten Haitzler 2010-09-18 14:23:20 +00:00
parent 8df657a51a
commit 6f4d152810
3 changed files with 70 additions and 36 deletions

View File

@ -1808,7 +1808,6 @@ again:
}
}
// FIXME: we don't handle mapped yuv!!!! :(
// FIXME: we don't handle clipped maps right :(
void
evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
@ -1827,7 +1826,7 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
DATA32 cmul;
GLuint prog = gc->shared->shader.img.prog;
int pn = 0;
if (!tex->alpha) blend = 0;
if (a < 255) blend = 1;
if ((A_VAL(&(p[0].col)) < 0xff) || (A_VAL(&(p[1].col)) < 0xff) ||
@ -2303,36 +2302,37 @@ shader_array_flush(Evas_GL_Context *gc)
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
/* hmmm this breaks things. must find out why!
if (gc->pipe[i].shader.clip != gc->state.current.clip)
{
if (gc->pipe[i].shader.clip)
glEnable(GL_SCISSOR_TEST);
else
{
glDisable(GL_SCISSOR_TEST);
// glScissor(0, 0, 0, 0);
}
}
if (gc->pipe[i].shader.clip)
{
if ((gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cx != gc->state.current.cx))
{
glScissor(gc->pipe[i].shader.cx,
gc->h - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
}
// gc->pipe[i].clip.x,
// gc->h - gc->pipe[i].clip.y - gc->pipe[i].clip.h,
// gc->pipe[i].clip.w,
// gc->pipe[i].clip.h);
*
}
*/
#if 1
if (gc->pipe[i].shader.clip != gc->state.current.clip)
{
if (gc->pipe[i].shader.clip)
{
glEnable(GL_SCISSOR_TEST);
glScissor(gc->pipe[i].shader.cx,
gc->h - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
}
else
{
glDisable(GL_SCISSOR_TEST);
// glScissor(0, 0, 0, 0);
}
}
if (gc->pipe[i].shader.clip)
{
if ((gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cx != gc->state.current.cx))
{
glScissor(gc->pipe[i].shader.cx,
gc->h - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
}
}
#endif
glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->pipe[i].array.vertex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->pipe[i].array.color);

View File

@ -1638,13 +1638,49 @@ eng_image_scale_hint_get(void *data __UNUSED__, void *image)
static void
eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level)
{
Evas_GL_Image *gim = image;
Render_Engine *re;
re = (Render_Engine *)data;
if (!image) return;
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_image_map4_draw(re->win->gl_context, image, p, smooth, level);
if ((p[0].x == p[3].x) &&
(p[1].x == p[2].x) &&
(p[0].y == p[1].y) &&
(p[3].y == p[2].y) &&
(p[0].x <= p[1].x) &&
(p[0].y <= p[2].y) &&
(p[0].u == 0) &&
(p[0].v == 0) &&
(p[1].u == (gim->w << FP)) &&
(p[1].v == 0) &&
(p[2].u == (gim->w << FP)) &&
(p[2].v == (gim->h << FP)) &&
(p[3].u == 0) &&
(p[3].v == (gim->h << FP)) &&
(p[0].col == 0xffffffff) &&
(p[1].col == 0xffffffff) &&
(p[2].col == 0xffffffff) &&
(p[3].col == 0xffffffff))
{
int dx, dy, dw, dh;
dx = p[0].x >> FP;
dy = p[0].y >> FP;
dw = (p[2].x >> FP) - dx;
dh = (p[2].y >> FP) - dy;
eng_image_draw
(data, context, surface, image,
0, 0, gim->w, gim->h,
dx, dy, dw, dh, smooth);
}
else
{
evas_gl_common_image_map4_draw(re->win->gl_context, image, p,
smooth, level);
}
}
static void *

View File

@ -508,12 +508,10 @@ eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image,
static void
eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level)
{
RGBA_Image *im, *srf;
// RGBA_Map_Point *pt = p;
RGBA_Image *im;
if (!image) return;
im = image;
srf = surface;
if ((p[0].x == p[3].x) &&
(p[1].x == p[2].x) &&
(p[0].y == p[1].y) &&