+
+void
+evas_gl_common_context_image_mask_push(Evas_GL_Context *gc,
+ Evas_GL_Texture *tex,
+ Evas_GL_Texture *texm,
+ double sx, double sy, double sw, double sh,
+ double sxm, double sym, double swm,double shm,
+ int x, int y, int w, int h,
+ int r, int g, int b, int a,
+ Eina_Bool smooth)
+{
+ int pnum, nv, nc, nu, nm, nt, i;
+ GLfloat tx1, tx2, ty1, ty2;
+ GLfloat txm1, txm2, tym1, tym2;
+ Eina_Bool blend = 1;
+ GLuint prog = gc->shared->shader.img_mask.prog;
+ int pn = 0;
+
+#if 0
+ if (tex->gc->shared->info.bgra)
+ {
+ prog = gc->shared->shader.img_mask.prog;
+ }
+ else
+ {
+#warning Nash: FIXME: Need two shaders?
+ printf("Not good: Need other texture\n");
+ prog = gc->shared->shader.img.prog;
+ }
+#endif
+
+again:
+ vertex_array_size_check(gc, gc->state.top_pipe, 6);
+ pn = gc->state.top_pipe;
+#ifdef GLPIPES
+ if ((pn == 0) && (gc->pipe[pn].array.num == 0))
+ {
+ gc->pipe[pn].region.type = RTYPE_IMASK;
+ gc->pipe[pn].shader.cur_tex = tex->pt->texture;
+ gc->pipe[pn].shader.cur_texm = texm->pt->texture;
+ gc->pipe[pn].shader.cur_prog = prog;
+ gc->pipe[pn].shader.smooth = smooth;
+ gc->pipe[pn].shader.blend = blend;
+ gc->pipe[pn].shader.render_op = gc->dc->render_op;
+ gc->pipe[pn].shader.clip = 0;
+ gc->pipe[pn].shader.cx = 0;
+ gc->pipe[pn].shader.cy = 0;
+ gc->pipe[pn].shader.cw = 0;
+ gc->pipe[pn].shader.ch = 0;
+ gc->pipe[pn].array.line = 0;
+ gc->pipe[pn].array.use_vertex = 1;
+ // if nomul... dont need this
+ gc->pipe[pn].array.use_color = 1;
+ gc->pipe[pn].array.use_texuv = 1;
+ gc->pipe[pn].array.use_texuv2 = 0;
+ gc->pipe[pn].array.use_texuv3 = 0;
+ gc->pipe[pn].array.use_texm = 1;
+ }
+ else
+ {
+ int found = 0;
+
+ for (i = pn; i >= 0; i--)
+ {
+ if ((gc->pipe[i].region.type == RTYPE_IMASK)
+ && (gc->pipe[i].shader.cur_tex == tex->pt->texture)
+ && (gc->pipe[i].shader.cur_texm == texm->pt->texture)
+ && (gc->pipe[i].shader.cur_prog == prog)
+ && (gc->pipe[i].shader.smooth == smooth)
+ && (gc->pipe[i].shader.blend == blend)
+ && (gc->pipe[i].shader.render_op == gc->dc->render_op)
+ && (gc->pipe[i].shader.clip == 0)
+ )
+ {
+ found = 1;
+ pn = i;
+ break;
+ }
+ if (pipe_region_intersects(gc, i, x, y, w, h)) break;
+ }
+ if (!found)
+ {
+ pn = gc->state.top_pipe + 1;
+ if (pn >= gc->shared->info.tune.pipes.max)
+ {
+ shader_array_flush(gc);
+ goto again;
+ }
+ gc->state.top_pipe = pn;
+ gc->pipe[pn].region.type = RTYPE_IMASK;
+ gc->pipe[pn].shader.cur_tex = tex->pt->texture;
+ gc->pipe[pn].shader.cur_texm = texm->pt->texture;
+ gc->pipe[pn].shader.cur_prog = prog;
+ gc->pipe[pn].shader.smooth = smooth;
+ gc->pipe[pn].shader.blend = blend;
+ gc->pipe[pn].shader.render_op = gc->dc->render_op;
+ gc->pipe[pn].shader.clip = 0;
+ gc->pipe[pn].shader.cx = 0;
+ gc->pipe[pn].shader.cy = 0;
+ gc->pipe[pn].shader.cw = 0;
+ gc->pipe[pn].shader.ch = 0;
+ gc->pipe[pn].array.line = 0;
+ gc->pipe[pn].array.use_vertex = 1;
+ gc->pipe[pn].array.use_color = 1;
+ gc->pipe[pn].array.use_texuv = 1;
+ gc->pipe[pn].array.use_texuv2 = 0;
+ gc->pipe[pn].array.use_texuv3 = 0;
+ gc->pipe[pn].array.use_texm = 1;
+
+ }
+ }
+ if ((tex->im) && (tex->im->native.data))
+ {
+ if (gc->pipe[pn].array.im != tex->im)
+ {
+ shader_array_flush(gc);
+ pn = gc->state.top_pipe;
+ gc->pipe[pn].array.im = tex->im;
+ goto again;
+ }
+ }
+ if (tex->pt->dyn.img)
+ {
+ if (gc->pipe[pn].array.im != tex->im)
+ {
+ shader_array_flush(gc);
+ pn = gc->state.top_pipe;
+ gc->pipe[pn].array.im = tex->im;
+ goto again;
+ }
+ }
+#else
+ if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture)
+ || (gc->pipe[pn].shader.cur_prog != prog)
+ || (gc->pipe[pn].shader.smooth != smooth)
+ || (gc->pipe[pn].shader.blend != blend)
+ || (gc->pipe[pn].shader.render_op != gc->dc->render_op)
+ || (gc->pipe[pn].shader.clip != 0)
+ )
+ {
+ shader_array_flush(gc);
+ gc->pipe[pn].shader.cur_tex = tex->pt->texture;
+ gc->pipe[pn].shader.cur_texm = texm->pt->texture;
+ gc->pipe[pn].shader.cur_prog = prog;
+ gc->pipe[pn].shader.smooth = smooth;
+ gc->pipe[pn].shader.blend = blend;
+ gc->pipe[pn].shader.render_op = gc->dc->render_op;
+ gc->pipe[pn].shader.clip = 0;
+ gc->pipe[pn].shader.cx = 0;
+ gc->pipe[pn].shader.cy = 0;
+ gc->pipe[pn].shader.cw = 0;
+ gc->pipe[pn].shader.ch = 0;
+ }
+ if ((tex->im) && (tex->im->native.data))
+ {
+ if (gc->pipe[pn].array.im != tex->im)
+ {
+ shader_array_flush(gc);
+ gc->pipe[pn].array.im = tex->im;
+ }
+ }
+ if (tex->pt->dyn.img)
+ {
+ if (gc->pipe[pn].array.im != tex->im)
+ {
+ shader_array_flush(gc);
+ gc->pipe[pn].array.im = tex->im;
+ }
+ }
+
+ gc->pipe[pn].array.line = 0;
+ gc->pipe[pn].array.use_vertex = 1;
+ gc->pipe[pn].array.use_color = 1;
+ gc->pipe[pn].array.use_texuv = 1;
+ gc->pipe[pn].array.use_texuv2 = 0;
+ gc->pipe[pn].array.use_texuv3 = 0;
+ gc->pipe[pn].array.use_texm = 1;
+#endif
+
+ pipe_region_expand(gc, pn, x, y, w, h);
+
+ pnum = gc->pipe[pn].array.num;
+ nv = pnum * 3; nc = pnum * 4; nm = pnum * 2; nu = pnum * 2;
+ nt = pnum * 4;
+ gc->pipe[pn].array.num += 6;
+ array_alloc(gc, pn);
+
+ if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert))
+ {
+ tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
+ ty1 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
+ tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
+ ty2 = ((double)(tex->y) + sy) / (double)tex->pt->h;
+
+ txm1 = ((double)(texm->x) + sxm) / (double)texm->pt->w;
+ tym1 = ((double)(texm->y) + sym + shm) / (double)texm->pt->h;
+ txm2 = ((double)(texm->x) + sxm + swm) / (double)texm->pt->w;
+ tym2 = ((double)(texm->y) + sym) / (double)texm->pt->h;
+ }
+ else
+ {
+ printf("B:\n");
+ tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
+ ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h;
+ tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
+ ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
+
+ txm1 = (texm->x + sxm) / (double)texm->pt->w;
+ tym1 = (texm->y + sy) / (double)texm->pt->h;
+ txm2 = (texm->x + sxm + swm) / (double)texm->pt->w;
+ tym2 = (texm->y + sy + sh) / (double)texm->pt->h;
+ }
+ printf(" %3.6lf %3.6lf %3.6lf %3.6lf\n",sx,sy,sw,sh);
+ printf("m%3.6lf %3.6lf %3.6lf %3.6lf\n",sxm,sym,swm,shm);
+ printf(" %3f %3f %3f %3f\n",tx1,ty1,tx2,ty2);
+ printf("m%3f %3f %3f %3f\n",txm1,tym1,txm2,tym2);
+
+ PUSH_VERTEX(pn, x , y , 0);
+ PUSH_VERTEX(pn, x + w, y , 0);
+ PUSH_VERTEX(pn, x , y + h, 0);
+
+ PUSH_TEXUV(pn, tx1, ty1);
+ PUSH_TEXUV(pn, tx2, ty1);
+ PUSH_TEXUV(pn, tx1, ty2);
+
+ PUSH_TEXM(pn, txm1, tym1);
+ PUSH_TEXM(pn, txm2, tym1);
+ PUSH_TEXM(pn, txm1, tym2);
+
+ PUSH_VERTEX(pn, x + w, y , 0);
+ PUSH_VERTEX(pn, x + w, y + h, 0);
+ PUSH_VERTEX(pn, x , y + h, 0);
+
+ PUSH_TEXUV(pn, tx2, ty1);
+ PUSH_TEXUV(pn, tx2, ty2);
+ PUSH_TEXUV(pn, tx1, ty2);
+
+ PUSH_TEXM(pn, txm2, tym1);
+ PUSH_TEXM(pn, txm2, tym2);
+ PUSH_TEXM(pn, txm1, tym2);
+
+ // if nomul... dont need this
+ for (i = 0; i < 6; i++)
+ {
+ PUSH_COLOR(pn, r, g, b, a);
+ }
+}
+
+