fix scossor clip on 90 degree rots.

SVN revision: 58381
This commit is contained in:
Carsten Haitzler 2011-04-06 07:32:33 +00:00
parent 073dd42baa
commit 70bc3602c7
1 changed files with 42 additions and 6 deletions

View File

@ -2584,6 +2584,30 @@ evas_gl_common_context_flush(Evas_Engine_GL_Context *gc)
shader_array_flush(gc);
}
static void
scissor_rot(Evas_Engine_GL_Context *gc __UNUSED__,
int rot, int gw, int gh, int cx, int cy, int cw, int ch)
{
switch (rot)
{
case 0: // UP this way: ^
glScissor(cx, cy, cw, ch);
break;
case 90: // UP this way: <
glScissor(gh - (cy + ch), cx, ch, cw);
break;
case 180: // UP this way: v
glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch);
break;
case 270: // UP this way: >
glScissor(cy, gw - (cx + cw), ch, cw);
break;
default: // assume up is up
glScissor(cx, cy, cw, ch);
break;
}
}
static void
shader_array_flush(Evas_Engine_GL_Context *gc)
{
@ -2741,9 +2765,15 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
if (fbo) cy = gc->pipe[i].shader.cy;
glEnable(GL_SCISSOR_TEST);
// FIXME: handle gc->rot IF gc->pipe[0].shader.surface == gc->def_surface
glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
if (!fbo)
scissor_rot(gc, gc->rot, gw, gh,
gc->pipe[i].shader.cx,
cy,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
else
glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
setclip = 1;
}
else
@ -2761,9 +2791,15 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
{
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
if (fbo) cy = gc->pipe[i].shader.cy;
// FIXME: handle gc->rot IF gc->pipe[0].shader.surface == gc->def_surface
glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
if (!fbo)
scissor_rot(gc, gc->rot, gw, gh,
gc->pipe[i].shader.cx,
cy,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
else
glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
}
}