grad fixes from jose

SVN revision: 31159
This commit is contained in:
Carsten Haitzler 2007-08-04 12:33:12 +00:00
parent 1977933b18
commit 6437f4ed23
1 changed files with 32 additions and 17 deletions

View File

@ -163,10 +163,13 @@ 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)
evas_gl_common_gradient_draw(Evas_GL_Context *gc,
Evas_GL_Gradient *gr,
int x, int y, int w, int h)
{
int r, g, b, a;
RGBA_Draw_Context *dc;
double tx2, ty2;
if ((w < 1) || (h < 1)) return;
if (!gr || !gc || !gc->dc) return;
@ -225,16 +228,28 @@ evas_gl_common_gradient_draw(Evas_GL_Context *gc, Evas_GL_Gradient *gr, int x, i
if (!gr->tex) return;
}
evas_gl_common_context_texture_set(gc, gr->tex, 0, w, h);
if (gr->tex->rectangle)
{
tx2 = w;
ty2 = h;
}
else
{
tx2 = (double)w / (double)(gr->tex->w);
ty2 = (double)h / (double)(gr->tex->h);
}
evas_gl_common_context_texture_set(gc, gr->tex, 0,
gr->tex->tw, gr->tex->th);
evas_gl_common_context_read_buf_set(gc, GL_BACK);
evas_gl_common_context_write_buf_set(gc, GL_BACK);
glBegin(GL_QUADS);
glTexCoord2d(0.0, 0.0); glVertex2i(x, y);
glTexCoord2d(1.0, 0.0); glVertex2i(x + w, y);
glTexCoord2d(1.0, 1.0); glVertex2i(x + w, y + h);
glTexCoord2d(0.0, 1.0); glVertex2i(x, y + h);
glTexCoord2d(tx2, 0.0); glVertex2i(x + w, y);
glTexCoord2d(tx2, ty2); glVertex2i(x + w, y + h);
glTexCoord2d(0.0, ty2); glVertex2i(x, y + h);
glEnd();
gr->changed = 0;
gr->tw = w; gr->th = h;