summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-12-01 18:26:47 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-07 15:06:03 +0900
commita2604956f968c4c07755867d5132aa3ebf77a066 (patch)
treee4b8fd5ff50f1c736cf42c21485e593c86d4f6bb /src/modules
parent1fac1dcf5730981fe4054efffdea05b18c3fb17e (diff)
Evas masking: Add support for BGRA/ARGB masking
Also, refactor font & image GL masking.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h23
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c427
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_font.c58
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c73
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_enum.x2
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x104
-rw-r--r--src/modules/evas/engines/gl_common/shader/img_mask_bgra_frag.shd17
-rw-r--r--src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd16
-rw-r--r--src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd16
-rw-r--r--src/modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd19
-rw-r--r--src/modules/evas/engines/gl_common/shader/img_mask_frag.shd3
-rw-r--r--src/modules/evas/engines/gl_common/shader/img_mask_nomul_frag.shd3
12 files changed, 398 insertions, 363 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index c314e4d88e..b201183f64 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -722,42 +722,41 @@ void evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
722 Evas_GL_Texture *tex, 722 Evas_GL_Texture *tex,
723 double sx, double sy, double sw, double sh, 723 double sx, double sy, double sw, double sh,
724 int x, int y, int w, int h, 724 int x, int y, int w, int h,
725 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
725 int r, int g, int b, int a, 726 int r, int g, int b, int a,
726 Eina_Bool smooth, Eina_Bool tex_only); 727 Eina_Bool smooth, Eina_Bool tex_only);
727void evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc, 728void evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
728 Evas_GL_Texture *tex, 729 Evas_GL_Texture *tex,
729 double sx, double sy, double sw, double sh, 730 double sx, double sy, double sw, double sh,
730 int x, int y, int w, int h, 731 int x, int y, int w, int h,
732 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
731 int r, int g, int b, int a); 733 int r, int g, int b, int a);
732void evas_gl_common_context_masked_font_push(Evas_Engine_GL_Context *gc,
733 Evas_GL_Texture *tex,
734 double sx, double sy, double sw, double sh,
735 int x, int y, int w, int h,
736 int r, int g, int b, int a,
737 Evas_GL_Texture *texa,
738 int mx, int my, int mw, int mh);
739void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc, 734void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
740 Evas_GL_Texture *tex, 735 Evas_GL_Texture *tex,
741 double sx, double sy, double sw, double sh, 736 double sx, double sy, double sw, double sh,
742 int x, int y, int w, int h, 737 int x, int y, int w, int h,
738 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
743 int r, int g, int b, int a, 739 int r, int g, int b, int a,
744 Eina_Bool smooth); 740 Eina_Bool smooth);
745void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc, 741void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
746 Evas_GL_Texture *tex, 742 Evas_GL_Texture *tex,
747 double sx, double sy, double sw, double sh, 743 double sx, double sy, double sw, double sh,
748 int x, int y, int w, int h, 744 int x, int y, int w, int h,
745 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
749 int r, int g, int b, int a, 746 int r, int g, int b, int a,
750 Eina_Bool smooth); 747 Eina_Bool smooth);
751void evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc, 748void evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
752 Evas_GL_Texture *tex, 749 Evas_GL_Texture *tex,
753 double sx, double sy, double sw, double sh, 750 double sx, double sy, double sw, double sh,
754 int x, int y, int w, int h, 751 int x, int y, int w, int h,
752 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
755 int r, int g, int b, int a, 753 int r, int g, int b, int a,
756 Eina_Bool smooth); 754 Eina_Bool smooth);
757void evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc, 755void evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
758 Evas_GL_Texture *tex, 756 Evas_GL_Texture *tex,
759 double sx, double sy, double sw, double sh, 757 double sx, double sy, double sw, double sh,
760 int x, int y, int w, int h, 758 int x, int y, int w, int h,
759 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
761 int r, int g, int b, int a, 760 int r, int g, int b, int a,
762 Eina_Bool smooth); 761 Eina_Bool smooth);
763void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, 762void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
@@ -765,19 +764,11 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g
765 int npoints, 764 int npoints,
766 RGBA_Map_Point *p, 765 RGBA_Map_Point *p,
767 int clip, int cx, int cy, int cw, int ch, 766 int clip, int cx, int cy, int cw, int ch,
767 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
768 int r, int g, int b, int a, 768 int r, int g, int b, int a,
769 Eina_Bool smooth, 769 Eina_Bool smooth,
770 Eina_Bool tex_only, 770 Eina_Bool tex_only,
771 Evas_Colorspace cspace); 771 Evas_Colorspace cspace);
772void evas_gl_common_context_masked_image_push(Evas_Engine_GL_Context *gc,
773 Evas_GL_Texture *tex,
774 Evas_GL_Texture *mask_tex,
775 double sx, double sy,
776 double sw, double sh,
777 int x, int y, int w, int h,
778 int mx, int my, int mw, int mh,
779 int r, int g, int b, int a,
780 Eina_Bool smooth, Eina_Bool tex_only);
781 772
782int evas_gl_common_shader_program_init(Evas_GL_Shared *shared); 773int evas_gl_common_shader_program_init(Evas_GL_Shared *shared);
783void evas_gl_common_shader_program_init_done(void); 774void evas_gl_common_shader_program_init_done(void);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index abe448e21b..00e4489560 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -856,6 +856,11 @@ evas_gl_common_context_new(void)
856 SHADER_TEXTURE_ADD(shared, IMG_MASK_NOMUL, tex); 856 SHADER_TEXTURE_ADD(shared, IMG_MASK_NOMUL, tex);
857 SHADER_TEXTURE_ADD(shared, IMG_MASK_NOMUL, texa); 857 SHADER_TEXTURE_ADD(shared, IMG_MASK_NOMUL, texa);
858 858
859 SHADER_TEXTURE_ADD(shared, IMG_MASK_BGRA, tex);
860 SHADER_TEXTURE_ADD(shared, IMG_MASK_BGRA, texa);
861 SHADER_TEXTURE_ADD(shared, IMG_MASK_BGRA_NOMUL, tex);
862 SHADER_TEXTURE_ADD(shared, IMG_MASK_BGRA_NOMUL, texa);
863
859 SHADER_TEXTURE_ADD(shared, FONT_MASK, tex); 864 SHADER_TEXTURE_ADD(shared, FONT_MASK, tex);
860 SHADER_TEXTURE_ADD(shared, FONT_MASK, texa); 865 SHADER_TEXTURE_ADD(shared, FONT_MASK, texa);
861 866
@@ -1331,18 +1336,21 @@ static inline Evas_GL_Shader
1331evas_gl_common_shader_choice(int npoints EINA_UNUSED, 1336evas_gl_common_shader_choice(int npoints EINA_UNUSED,
1332 RGBA_Map_Point *p, 1337 RGBA_Map_Point *p,
1333 int r, int g, int b, int a, 1338 int r, int g, int b, int a,
1339 Eina_Bool has_mask,
1334 Evas_GL_Shader nomul, 1340 Evas_GL_Shader nomul,
1335 Evas_GL_Shader mul) 1341 Evas_GL_Shader mul,
1342 Evas_GL_Shader mask_nomul,
1343 Evas_GL_Shader mask_mul)
1336{ 1344{
1337 if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) 1345 if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
1338 { 1346 {
1339 if (!p) return nomul; 1347 if (!p) return (has_mask ? mask_nomul : nomul);
1340 1348
1341 if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && 1349 if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) &&
1342 (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) 1350 (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff))
1343 return nomul; 1351 return (has_mask ? mask_nomul : nomul);
1344 } 1352 }
1345 return mul; 1353 return (has_mask ? mask_mul : mul);
1346} 1354}
1347 1355
1348static int 1356static int
@@ -1650,11 +1658,12 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1650 Evas_GL_Texture *tex, 1658 Evas_GL_Texture *tex,
1651 double sx, double sy, double sw, double sh, 1659 double sx, double sy, double sw, double sh,
1652 int x, int y, int w, int h, 1660 int x, int y, int w, int h,
1661 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
1653 int r, int g, int b, int a, 1662 int r, int g, int b, int a,
1654 Eina_Bool smooth, Eina_Bool tex_only) 1663 Eina_Bool smooth, Eina_Bool tex_only)
1655{ 1664{
1656 Evas_GL_Texture_Pool *pt; 1665 Evas_GL_Texture_Pool *pt;
1657 int pnum, nv, nc, nu, ns, i; 1666 int pnum, nv, nc, nu, ns, na, i;
1658 GLfloat tx1, tx2, ty1, ty2; 1667 GLfloat tx1, tx2, ty1, ty2;
1659 GLfloat offsetx, offsety; 1668 GLfloat offsetx, offsety;
1660 Eina_Bool blend = EINA_FALSE; 1669 Eina_Bool blend = EINA_FALSE;
@@ -1662,7 +1671,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1662 int pn = 0, sam = 0; 1671 int pn = 0, sam = 0;
1663 1672
1664 if (!(gc->dc->render_op == EVAS_RENDER_COPY) && 1673 if (!(gc->dc->render_op == EVAS_RENDER_COPY) &&
1665 ((a < 255) || (tex->alpha))) blend = EINA_TRUE; 1674 ((a < 255) || (tex->alpha) || (!!mtex))) blend = EINA_TRUE;
1666 1675
1667 if (gc->filter_prog) 1676 if (gc->filter_prog)
1668 { 1677 {
@@ -1674,26 +1683,30 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1674 { 1683 {
1675 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1684 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1676 { 1685 {
1677 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1686 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1678 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA)].prog; 1687 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA,
1688 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1679 sam = 1; 1689 sam = 1;
1680 } 1690 }
1681 else if ((smooth) && (sw >= (w * 2))) 1691 else if ((smooth) && (sw >= (w * 2)))
1682 { 1692 {
1683 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1693 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1684 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA)].prog; 1694 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA,
1695 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1685 sam = 1; 1696 sam = 1;
1686 } 1697 }
1687 else if ((smooth) && (sh >= (h * 2))) 1698 else if ((smooth) && (sh >= (h * 2)))
1688 { 1699 {
1689 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1700 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1690 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA)].prog; 1701 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA,
1702 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1691 sam = 1; 1703 sam = 1;
1692 } 1704 }
1693 else 1705 else
1694 { 1706 {
1695 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1707 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1696 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA)].prog; 1708 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA,
1709 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1697 } 1710 }
1698 } 1711 }
1699 else 1712 else
@@ -1701,41 +1714,49 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1701 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1714 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1702 { 1715 {
1703 if ((!tex->alpha) && (tex->pt->native)) 1716 if ((!tex->alpha) && (tex->pt->native))
1704 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1717 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1705 SHADER_TEX_22_NOMUL_AFILL, SHADER_TEX_22_AFILL)].prog; 1718 SHADER_TEX_22_NOMUL_AFILL, SHADER_TEX_22_AFILL,
1719 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1706 else 1720 else
1707 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1721 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1708 SHADER_TEX_22_NOMUL, SHADER_TEX_22)].prog; 1722 SHADER_TEX_22_NOMUL, SHADER_TEX_22,
1723 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1709 sam = 1; 1724 sam = 1;
1710 } 1725 }
1711 else if ((smooth) && (sw >= (w * 2))) 1726 else if ((smooth) && (sw >= (w * 2)))
1712 { 1727 {
1713 if ((!tex->alpha) && (tex->pt->native)) 1728 if ((!tex->alpha) && (tex->pt->native))
1714 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1729 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1715 SHADER_TEX_21_NOMUL_AFILL, SHADER_TEX_21_AFILL)].prog; 1730 SHADER_TEX_21_NOMUL_AFILL, SHADER_TEX_21_AFILL,
1731 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1716 else 1732 else
1717 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1733 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1718 SHADER_TEX_21_NOMUL, SHADER_TEX_21)].prog; 1734 SHADER_TEX_21_NOMUL, SHADER_TEX_21,
1735 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1719 sam = 1; 1736 sam = 1;
1720 } 1737 }
1721 else if ((smooth) && (sh >= (h * 2))) 1738 else if ((smooth) && (sh >= (h * 2)))
1722 { 1739 {
1723 if ((!tex->alpha) && (tex->pt->native)) 1740 if ((!tex->alpha) && (tex->pt->native))
1724 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1741 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1725 SHADER_TEX_12_NOMUL_AFILL, SHADER_TEX_12_AFILL)].prog; 1742 SHADER_TEX_12_NOMUL_AFILL, SHADER_TEX_12_AFILL,
1743 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1726 else 1744 else
1727 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1745 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1728 SHADER_TEX_12_NOMUL, SHADER_TEX_12)].prog; 1746 SHADER_TEX_12_NOMUL, SHADER_TEX_12,
1747 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1729 sam = 1; 1748 sam = 1;
1730 } 1749 }
1731 else 1750 else
1732 { 1751 {
1733 if ((!tex->alpha) && (tex->pt->native)) 1752 if ((!tex->alpha) && (tex->pt->native))
1734 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1753 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1735 SHADER_TEX_NOMUL_AFILL, SHADER_TEX_AFILL)].prog; 1754 SHADER_TEX_NOMUL_AFILL, SHADER_TEX_AFILL,
1755 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1736 else 1756 else
1737 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1757 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1738 SHADER_TEX_NOMUL, SHADER_TEX)].prog; 1758 SHADER_TEX_NOMUL, SHADER_TEX,
1759 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1739 } 1760 }
1740 } 1761 }
1741 } 1762 }
@@ -1745,52 +1766,60 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1745 { 1766 {
1746 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1767 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1747 { 1768 {
1748 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1769 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1749 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA)].prog; 1770 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA,
1771 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1750 sam = 1; 1772 sam = 1;
1751 } 1773 }
1752 else if ((smooth) && (sw >= (w * 2))) 1774 else if ((smooth) && (sw >= (w * 2)))
1753 { 1775 {
1754 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1776 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1755 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA)].prog; 1777 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA,
1778 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1756 sam = 1; 1779 sam = 1;
1757 } 1780 }
1758 else if ((smooth) && (sh >= (h * 2))) 1781 else if ((smooth) && (sh >= (h * 2)))
1759 { 1782 {
1760 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1783 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1761 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA)].prog; 1784 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA,
1785 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1762 sam = 1; 1786 sam = 1;
1763 } 1787 }
1764 else 1788 else
1765 { 1789 {
1766 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1790 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1767 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA)].prog; 1791 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA,
1792 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
1768 } 1793 }
1769 } 1794 }
1770 else 1795 else
1771 { 1796 {
1772 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1797 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1773 { 1798 {
1774 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1799 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1775 SHADER_IMG_22_NOMUL, SHADER_IMG_22)].prog; 1800 SHADER_IMG_22_NOMUL, SHADER_IMG_22,
1801 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1776 sam = 1; 1802 sam = 1;
1777 } 1803 }
1778 else if ((smooth) && (sw >= (w * 2))) 1804 else if ((smooth) && (sw >= (w * 2)))
1779 { 1805 {
1780 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1806 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1781 SHADER_IMG_21_NOMUL, SHADER_IMG_21)].prog; 1807 SHADER_IMG_21_NOMUL, SHADER_IMG_21,
1808 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1782 sam = 1; 1809 sam = 1;
1783 } 1810 }
1784 else if ((smooth) && (sh >= (h * 2))) 1811 else if ((smooth) && (sh >= (h * 2)))
1785 { 1812 {
1786 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1813 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1787 SHADER_IMG_12_NOMUL, SHADER_IMG_12)].prog; 1814 SHADER_IMG_12_NOMUL, SHADER_IMG_12,
1815 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1788 sam = 1; 1816 sam = 1;
1789 } 1817 }
1790 else 1818 else
1791 { 1819 {
1792 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 1820 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1793 SHADER_IMG_NOMUL, SHADER_IMG)].prog; 1821 SHADER_IMG_NOMUL, SHADER_IMG,
1822 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
1794 } 1823 }
1795 } 1824 }
1796 } 1825 }
@@ -1824,6 +1853,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1824 1853
1825 gc->pipe[pn].region.type = RTYPE_IMAGE; 1854 gc->pipe[pn].region.type = RTYPE_IMAGE;
1826 gc->pipe[pn].shader.cur_tex = pt->texture; 1855 gc->pipe[pn].shader.cur_tex = pt->texture;
1856 gc->pipe[pn].shader.cur_texa = mtex ? mtex->pt->texture : 0;
1827 gc->pipe[pn].shader.cur_prog = prog; 1857 gc->pipe[pn].shader.cur_prog = prog;
1828 gc->pipe[pn].shader.smooth = smooth; 1858 gc->pipe[pn].shader.smooth = smooth;
1829 gc->pipe[pn].shader.blend = blend; 1859 gc->pipe[pn].shader.blend = blend;
@@ -1840,13 +1870,13 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1840 gc->pipe[pn].array.use_texuv = 1; 1870 gc->pipe[pn].array.use_texuv = 1;
1841 gc->pipe[pn].array.use_texuv2 = 0; 1871 gc->pipe[pn].array.use_texuv2 = 0;
1842 gc->pipe[pn].array.use_texuv3 = 0; 1872 gc->pipe[pn].array.use_texuv3 = 0;
1843 gc->pipe[pn].array.use_texa = 0; 1873 gc->pipe[pn].array.use_texa = !!mtex;
1844 gc->pipe[pn].array.use_texsam = sam; 1874 gc->pipe[pn].array.use_texsam = sam;
1845 1875
1846 pipe_region_expand(gc, pn, x, y, w, h); 1876 pipe_region_expand(gc, pn, x, y, w, h);
1847 1877
1848 pnum = gc->pipe[pn].array.num; 1878 pnum = gc->pipe[pn].array.num;
1849 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; ns = pnum * 2; 1879 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; ns = pnum * 2; na = pnum * 2;
1850 gc->pipe[pn].array.num += 6; 1880 gc->pipe[pn].array.num += 6;
1851 array_alloc(gc, pn); 1881 array_alloc(gc, pn);
1852 1882
@@ -1894,108 +1924,26 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1894 PUSH_TEXSAM(pn, samx, samy); 1924 PUSH_TEXSAM(pn, samx, samy);
1895 PUSH_TEXSAM(pn, samx, samy); 1925 PUSH_TEXSAM(pn, samx, samy);
1896 } 1926 }
1897
1898 // if nomul... dont need this
1899 for (i = 0; i < 6; i++)
1900 {
1901 PUSH_COLOR(pn, r, g, b, a);
1902 }
1903}
1904
1905void
1906evas_gl_common_context_masked_font_push(Evas_Engine_GL_Context *gc,
1907 Evas_GL_Texture *tex,
1908 double sx, double sy, double sw, double sh,
1909 int x, int y, int w, int h,
1910 int r, int g, int b, int a,
1911 Evas_GL_Texture *texa,
1912 int mx, int my, int mw, int mh)
1913{
1914 int pnum, nv, nc, nu, na, i;
1915 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
1916 GLuint prog = gc->shared->shader[SHADER_FONT_MASK].prog;
1917 int pn = 0;
1918
1919 pn = _evas_gl_common_context_push(RTYPE_FONT,
1920 gc, tex,
1921 prog,
1922 x, y, w, h,
1923 1,
1924 0,
1925 0, 0, 0, 0, 0);
1926 1927
1927 gc->pipe[pn].region.type = RTYPE_FONT; 1928 if (mtex)
1928 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
1929 gc->pipe[pn].shader.cur_texa = texa->pt->texture;
1930 gc->pipe[pn].shader.cur_prog = prog;
1931 gc->pipe[pn].shader.smooth = 0;
1932 gc->pipe[pn].shader.blend = 1;
1933 gc->pipe[pn].shader.render_op = gc->dc->render_op;
1934 gc->pipe[pn].shader.clip = 0;
1935 gc->pipe[pn].shader.cx = 0;
1936 gc->pipe[pn].shader.cy = 0;
1937 gc->pipe[pn].shader.cw = 0;
1938 gc->pipe[pn].shader.ch = 0;
1939 gc->pipe[pn].array.line = 0;
1940 gc->pipe[pn].array.use_vertex = 1;
1941 gc->pipe[pn].array.use_color = 1;
1942 gc->pipe[pn].array.use_texuv = 1;
1943 gc->pipe[pn].array.use_texuv2 = 0;
1944 gc->pipe[pn].array.use_texuv3 = 0;
1945 gc->pipe[pn].array.use_texa = 1; //
1946 gc->pipe[pn].array.use_texsam = 0;
1947
1948 pipe_region_expand(gc, pn, x, y, w, h);
1949
1950 pnum = gc->pipe[pn].array.num;
1951 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; na = pnum * 2;
1952 gc->pipe[pn].array.num += 6;
1953 array_alloc(gc, pn);
1954
1955 if (sw == 0.0)
1956 {
1957 tx1 = tex->sx1;
1958 ty1 = tex->sy1;
1959 tx2 = tex->sx2;
1960 ty2 = tex->sy2;
1961 }
1962 else
1963 { 1929 {
1964 tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; 1930 GLfloat t2x1, t2x2, t2y1, t2y2;
1965 ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h;
1966 tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
1967 ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
1968 }
1969 1931
1970 t2x1 = (texa->x + mx) / (double)texa->pt->w; 1932 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
1971 t2y1 = (texa->y + my) / (double)texa->pt->h; 1933 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
1972 t2x2 = (texa->x + mx + mw) / (double)texa->pt->w; 1934 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
1973 t2y2 = (texa->y + my + mh) / (double)texa->pt->h; 1935 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
1974 1936
1975 PUSH_VERTEX(pn, x , y , 0); 1937 PUSH_TEXA(pn, t2x1, t2y1);
1976 PUSH_VERTEX(pn, x + w, y , 0); 1938 PUSH_TEXA(pn, t2x2, t2y1);
1977 PUSH_VERTEX(pn, x , y + h, 0); 1939 PUSH_TEXA(pn, t2x1, t2y2);
1978
1979 PUSH_TEXUV(pn, tx1, ty1);
1980 PUSH_TEXUV(pn, tx2, ty1);
1981 PUSH_TEXUV(pn, tx1, ty2);
1982
1983 PUSH_TEXA(pn, t2x1, t2y1);
1984 PUSH_TEXA(pn, t2x2, t2y1);
1985 PUSH_TEXA(pn, t2x1, t2y2);
1986
1987 PUSH_VERTEX(pn, x + w, y , 0);
1988 PUSH_VERTEX(pn, x + w, y + h, 0);
1989 PUSH_VERTEX(pn, x , y + h, 0);
1990
1991 PUSH_TEXUV(pn, tx2, ty1);
1992 PUSH_TEXUV(pn, tx2, ty2);
1993 PUSH_TEXUV(pn, tx1, ty2);
1994
1995 PUSH_TEXA(pn, t2x2, t2y1);
1996 PUSH_TEXA(pn, t2x2, t2y2);
1997 PUSH_TEXA(pn, t2x1, t2y2);
1998 1940
1941 PUSH_TEXA(pn, t2x2, t2y1);
1942 PUSH_TEXA(pn, t2x2, t2y2);
1943 PUSH_TEXA(pn, t2x1, t2y2);
1944 }
1945
1946 // if nomul... dont need this
1999 for (i = 0; i < 6; i++) 1947 for (i = 0; i < 6; i++)
2000 { 1948 {
2001 PUSH_COLOR(pn, r, g, b, a); 1949 PUSH_COLOR(pn, r, g, b, a);
@@ -2007,13 +1955,19 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2007 Evas_GL_Texture *tex, 1955 Evas_GL_Texture *tex,
2008 double sx, double sy, double sw, double sh, 1956 double sx, double sy, double sw, double sh,
2009 int x, int y, int w, int h, 1957 int x, int y, int w, int h,
1958 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2010 int r, int g, int b, int a) 1959 int r, int g, int b, int a)
2011{ 1960{
2012 int pnum, nv, nc, nu, i; 1961 int pnum, nv, nc, nu, na, i;
2013 GLfloat tx1, tx2, ty1, ty2; 1962 GLfloat tx1, tx2, ty1, ty2;
2014 GLuint prog = gc->shared->shader[SHADER_FONT].prog; 1963 GLuint prog;
2015 int pn = 0; 1964 int pn = 0;
2016 1965
1966 if (!mtex)
1967 prog = gc->shared->shader[SHADER_FONT].prog;
1968 else
1969 prog = gc->shared->shader[SHADER_FONT_MASK].prog;
1970
2017 pn = _evas_gl_common_context_push(RTYPE_FONT, 1971 pn = _evas_gl_common_context_push(RTYPE_FONT,
2018 gc, tex, 1972 gc, tex,
2019 prog, 1973 prog,
@@ -2024,6 +1978,7 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2024 1978
2025 gc->pipe[pn].region.type = RTYPE_FONT; 1979 gc->pipe[pn].region.type = RTYPE_FONT;
2026 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 1980 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
1981 gc->pipe[pn].shader.cur_texa = mtex ? mtex->pt->texture : 0;
2027 gc->pipe[pn].shader.cur_prog = prog; 1982 gc->pipe[pn].shader.cur_prog = prog;
2028 gc->pipe[pn].shader.smooth = 0; 1983 gc->pipe[pn].shader.smooth = 0;
2029 gc->pipe[pn].shader.blend = 1; 1984 gc->pipe[pn].shader.blend = 1;
@@ -2039,13 +1994,13 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2039 gc->pipe[pn].array.use_texuv = 1; 1994 gc->pipe[pn].array.use_texuv = 1;
2040 gc->pipe[pn].array.use_texuv2 = 0; 1995 gc->pipe[pn].array.use_texuv2 = 0;
2041 gc->pipe[pn].array.use_texuv3 = 0; 1996 gc->pipe[pn].array.use_texuv3 = 0;
2042 gc->pipe[pn].array.use_texa = 0; 1997 gc->pipe[pn].array.use_texa = !!mtex;
2043 gc->pipe[pn].array.use_texsam = 0; 1998 gc->pipe[pn].array.use_texsam = 0;
2044 1999
2045 pipe_region_expand(gc, pn, x, y, w, h); 2000 pipe_region_expand(gc, pn, x, y, w, h);
2046 2001
2047 pnum = gc->pipe[pn].array.num; 2002 pnum = gc->pipe[pn].array.num;
2048 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; 2003 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; na = 2 * pnum;
2049 gc->pipe[pn].array.num += 6; 2004 gc->pipe[pn].array.num += 6;
2050 array_alloc(gc, pn); 2005 array_alloc(gc, pn);
2051 2006
@@ -2080,6 +2035,24 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2080 PUSH_TEXUV(pn, tx2, ty2); 2035 PUSH_TEXUV(pn, tx2, ty2);
2081 PUSH_TEXUV(pn, tx1, ty2); 2036 PUSH_TEXUV(pn, tx1, ty2);
2082 2037
2038 if (mtex)
2039 {
2040 GLfloat t2x1, t2x2, t2y1, t2y2;
2041
2042 t2x1 = (mtex->x + mx) / (double)mtex->pt->w;
2043 t2y1 = (mtex->y + my) / (double)mtex->pt->h;
2044 t2x2 = (mtex->x + mx + mw) / (double)mtex->pt->w;
2045 t2y2 = (mtex->y + my + mh) / (double)mtex->pt->h;
2046
2047 PUSH_TEXA(pn, t2x1, t2y1);
2048 PUSH_TEXA(pn, t2x2, t2y1);
2049 PUSH_TEXA(pn, t2x1, t2y2);
2050
2051 PUSH_TEXA(pn, t2x2, t2y1);
2052 PUSH_TEXA(pn, t2x2, t2y2);
2053 PUSH_TEXA(pn, t2x1, t2y2);
2054 }
2055
2083 for (i = 0; i < 6; i++) 2056 for (i = 0; i < 6; i++)
2084 { 2057 {
2085 PUSH_COLOR(pn, r, g, b, a); 2058 PUSH_COLOR(pn, r, g, b, a);
@@ -2091,6 +2064,7 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2091 Evas_GL_Texture *tex, 2064 Evas_GL_Texture *tex,
2092 double sx, double sy, double sw, double sh, 2065 double sx, double sy, double sw, double sh,
2093 int x, int y, int w, int h, 2066 int x, int y, int w, int h,
2067 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2094 int r, int g, int b, int a, 2068 int r, int g, int b, int a,
2095 Eina_Bool smooth) 2069 Eina_Bool smooth)
2096{ 2070{
@@ -2102,7 +2076,9 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2102 2076
2103 if (a < 255) blend = 1; 2077 if (a < 255) blend = 1;
2104 2078
2105 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 2079#warning YUV+mask
2080 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2081 SHADER_YUV_NOMUL, SHADER_YUV,
2106 SHADER_YUV_NOMUL, SHADER_YUV)].prog; 2082 SHADER_YUV_NOMUL, SHADER_YUV)].prog;
2107 2083
2108 pn = _evas_gl_common_context_push(RTYPE_YUV, 2084 pn = _evas_gl_common_context_push(RTYPE_YUV,
@@ -2196,6 +2172,7 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2196 Evas_GL_Texture *tex, 2172 Evas_GL_Texture *tex,
2197 double sx, double sy, double sw, double sh, 2173 double sx, double sy, double sw, double sh,
2198 int x, int y, int w, int h, 2174 int x, int y, int w, int h,
2175 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2199 int r, int g, int b, int a, 2176 int r, int g, int b, int a,
2200 Eina_Bool smooth) 2177 Eina_Bool smooth)
2201{ 2178{
@@ -2207,7 +2184,9 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2207 2184
2208 if (a < 255) blend = 1; 2185 if (a < 255) blend = 1;
2209 2186
2210 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 2187#warning mask
2188 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2189 SHADER_YUY2_NOMUL, SHADER_YUY2,
2211 SHADER_YUY2_NOMUL, SHADER_YUY2)].prog; 2190 SHADER_YUY2_NOMUL, SHADER_YUY2)].prog;
2212 2191
2213 pn = _evas_gl_common_context_push(RTYPE_YUY2, 2192 pn = _evas_gl_common_context_push(RTYPE_YUY2,
@@ -2292,6 +2271,7 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2292 Evas_GL_Texture *tex, 2271 Evas_GL_Texture *tex,
2293 double sx, double sy, double sw, double sh, 2272 double sx, double sy, double sw, double sh,
2294 int x, int y, int w, int h, 2273 int x, int y, int w, int h,
2274 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2295 int r, int g, int b, int a, 2275 int r, int g, int b, int a,
2296 Eina_Bool smooth) 2276 Eina_Bool smooth)
2297{ 2277{
@@ -2303,7 +2283,9 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2303 2283
2304 if (a < 255) blend = 1; 2284 if (a < 255) blend = 1;
2305 2285
2306 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, 2286#warning mask
2287 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2288 SHADER_NV12_NOMUL, SHADER_NV12,
2307 SHADER_NV12_NOMUL, SHADER_NV12)].prog; 2289 SHADER_NV12_NOMUL, SHADER_NV12)].prog;
2308 2290
2309 pn = _evas_gl_common_context_push(RTYPE_NV12, 2291 pn = _evas_gl_common_context_push(RTYPE_NV12,
@@ -2391,6 +2373,7 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2391 double sx, double sy, 2373 double sx, double sy,
2392 double sw, double sh, 2374 double sw, double sh,
2393 int x, int y, int w, int h, 2375 int x, int y, int w, int h,
2376 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2394 int r, int g, int b, int a, 2377 int r, int g, int b, int a,
2395 Eina_Bool smooth) 2378 Eina_Bool smooth)
2396 2379
@@ -2407,8 +2390,11 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2407 GLuint prog; 2390 GLuint prog;
2408 int pn; 2391 int pn;
2409 2392
2393#warning rgba+a+mask
2410 prog = gc->shared->shader[evas_gl_common_shader_choice 2394 prog = gc->shared->shader[evas_gl_common_shader_choice
2411 (0, NULL, r, g, b, a, SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR)].prog; 2395 (0, NULL, r, g, b, a, !!mtex,
2396 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR,
2397 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR)].prog;
2412 2398
2413 pn = _evas_gl_common_context_push(RTYPE_IMAGE, 2399 pn = _evas_gl_common_context_push(RTYPE_IMAGE,
2414 gc, tex, 2400 gc, tex,
@@ -2494,6 +2480,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2494 int npoints, 2480 int npoints,
2495 RGBA_Map_Point *p, 2481 RGBA_Map_Point *p,
2496 int clip, int cx, int cy, int cw, int ch, 2482 int clip, int cx, int cy, int cw, int ch,
2483 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2497 int r, int g, int b, int a, 2484 int r, int g, int b, int a,
2498 Eina_Bool smooth, Eina_Bool tex_only, 2485 Eina_Bool smooth, Eina_Bool tex_only,
2499 Evas_Colorspace cspace) 2486 Evas_Colorspace cspace)
@@ -2531,18 +2518,21 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2531 { 2518 {
2532 case EVAS_COLORSPACE_YCBCR422P601_PL: 2519 case EVAS_COLORSPACE_YCBCR422P601_PL:
2533 case EVAS_COLORSPACE_YCBCR422P709_PL: 2520 case EVAS_COLORSPACE_YCBCR422P709_PL:
2534 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2521 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2522 SHADER_YUV_NOMUL, SHADER_YUV,
2535 SHADER_YUV_NOMUL, SHADER_YUV)].prog; 2523 SHADER_YUV_NOMUL, SHADER_YUV)].prog;
2536 utexture = EINA_TRUE; 2524 utexture = EINA_TRUE;
2537 break; 2525 break;
2538 case EVAS_COLORSPACE_YCBCR422601_PL: 2526 case EVAS_COLORSPACE_YCBCR422601_PL:
2539 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2527 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2528 SHADER_YUY2_NOMUL, SHADER_YUY2,
2540 SHADER_YUY2_NOMUL, SHADER_YUY2)].prog; 2529 SHADER_YUY2_NOMUL, SHADER_YUY2)].prog;
2541 uvtexture = EINA_TRUE; 2530 uvtexture = EINA_TRUE;
2542 break; 2531 break;
2543 case EVAS_COLORSPACE_YCBCR420NV12601_PL: 2532 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
2544 case EVAS_COLORSPACE_YCBCR420TM12601_PL: 2533 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
2545 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2534 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2535 SHADER_NV12_NOMUL, SHADER_NV12,
2546 SHADER_NV12_NOMUL, SHADER_NV12)].prog; 2536 SHADER_NV12_NOMUL, SHADER_NV12)].prog;
2547 uvtexture = EINA_TRUE; 2537 uvtexture = EINA_TRUE;
2548 break; 2538 break;
@@ -2552,28 +2542,30 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2552 { 2542 {
2553 if (tex->pt->dyn.img) 2543 if (tex->pt->dyn.img)
2554 { 2544 {
2555 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2545 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2556 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA)].prog; 2546 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA,
2547 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
2557 } 2548 }
2558 else 2549 else
2559 { 2550 {
2560 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2551 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2561 SHADER_TEX_NOMUL, SHADER_TEX)].prog; 2552 SHADER_TEX_NOMUL, SHADER_TEX,
2553 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
2562 } 2554 }
2563 } 2555 }
2564 else 2556 else
2565 { 2557 {
2566 if (tex->gc->shared->info.bgra) 2558 if (tex->gc->shared->info.bgra)
2567 { 2559 {
2568 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2560 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2569 SHADER_IMG_BGRA_NOMUL, 2561 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA,
2570 SHADER_IMG_BGRA)].prog; 2562 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog;
2571 } 2563 }
2572 else 2564 else
2573 { 2565 {
2574 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, 2566 prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, !!mtex,
2575 SHADER_IMG_NOMUL, 2567 SHADER_IMG_NOMUL, SHADER_IMG,
2576 SHADER_IMG)].prog; 2568 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
2577 } 2569 }
2578 } 2570 }
2579 } 2571 }
@@ -2753,109 +2745,6 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2753 } 2745 }
2754} 2746}
2755 2747
2756void
2757evas_gl_common_context_masked_image_push(Evas_Engine_GL_Context *gc,
2758 Evas_GL_Texture *tex,
2759 Evas_GL_Texture *mask_tex,
2760 double sx, double sy,
2761 double sw, double sh,
2762 int x, int y, int w, int h,
2763 int mx, int my, int mw, int mh,
2764 int r, int g, int b, int a,
2765 Eina_Bool smooth, Eina_Bool tex_only)
2766{
2767 // FIXME: How to implement support for yuv, rgb_a_pair & map stuff?
2768 // NOTE: If image (tex) has no alpha this is very similar to RGB+A pair
2769
2770 // FIXME: Optimize for image vs. texture?
2771 (void)tex_only;
2772
2773 int pnum, nv, nc, nu, na, i;
2774 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2775 GLuint prog;
2776 int pn;
2777
2778 // TODO: Big IF here (image type, etc --> needs tons of new shaders!)
2779 prog = gc->shared->shader[evas_gl_common_shader_choice
2780 (0, NULL, r, g, b, a, SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog;
2781
2782 pn = _evas_gl_common_context_push(RTYPE_IMAGE,
2783 gc, tex,
2784 prog,
2785 x, y, w, h,
2786 EINA_TRUE,
2787 smooth,
2788 EINA_FALSE, 0, 0, 0, 0);
2789
2790 gc->pipe[pn].region.type = RTYPE_IMAGE;
2791 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2792 gc->pipe[pn].shader.cur_texa = mask_tex->pt->texture;
2793 gc->pipe[pn].shader.cur_prog = prog;
2794 gc->pipe[pn].shader.smooth = smooth;
2795 gc->pipe[pn].shader.blend = EINA_TRUE;
2796 gc->pipe[pn].shader.render_op = gc->dc->render_op;
2797 gc->pipe[pn].shader.clip = 0;
2798 gc->pipe[pn].shader.cx = 0;
2799 gc->pipe[pn].shader.cy = 0;
2800 gc->pipe[pn].shader.cw = 0;
2801 gc->pipe[pn].shader.ch = 0;
2802 gc->pipe[pn].array.line = 0;
2803 gc->pipe[pn].array.use_vertex = EINA_TRUE;
2804 // if nomul... dont need this
2805 gc->pipe[pn].array.use_color = EINA_TRUE;
2806 gc->pipe[pn].array.use_texuv = EINA_TRUE;
2807 gc->pipe[pn].array.use_texuv2 = EINA_FALSE;
2808 gc->pipe[pn].array.use_texuv3 = EINA_FALSE;
2809 gc->pipe[pn].array.use_texa = EINA_TRUE;
2810 gc->pipe[pn].array.use_texsam = EINA_FALSE;
2811
2812 pipe_region_expand(gc, pn, x, y, w, h);
2813
2814 pnum = gc->pipe[pn].array.num;
2815 nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; na = pnum * 2;
2816 gc->pipe[pn].array.num += 6;
2817 array_alloc(gc, pn);
2818
2819 tx1 = (tex->x + sx) / (double)tex->pt->w;
2820 ty1 = (tex->y + sy) / (double)tex->pt->h;
2821 tx2 = (tex->x + sx + sw) / (double)tex->pt->w;
2822 ty2 = (tex->y + sy + sh) / (double)tex->pt->h;
2823
2824 t2x1 = (mask_tex->x + mx) / (double)mask_tex->pt->w;
2825 t2y1 = (mask_tex->y + my) / (double)mask_tex->pt->h;
2826 t2x2 = (mask_tex->x + mx + mw) / (double)mask_tex->pt->w;
2827 t2y2 = (mask_tex->y + my + mh) / (double)mask_tex->pt->h;
2828
2829 PUSH_VERTEX(pn, x , y , 0);
2830 PUSH_VERTEX(pn, x + w, y , 0);
2831 PUSH_VERTEX(pn, x , y + h, 0);
2832
2833 PUSH_TEXUV(pn, tx1, ty1);
2834 PUSH_TEXUV(pn, tx2, ty1);
2835 PUSH_TEXUV(pn, tx1, ty2);
2836
2837 PUSH_TEXA(pn, t2x1, t2y1);
2838 PUSH_TEXA(pn, t2x2, t2y1);
2839 PUSH_TEXA(pn, t2x1, t2y2);
2840
2841 PUSH_VERTEX(pn, x + w, y , 0);
2842 PUSH_VERTEX(pn, x + w, y + h, 0);
2843 PUSH_VERTEX(pn, x , y + h, 0);
2844
2845 PUSH_TEXUV(pn, tx2, ty1);
2846 PUSH_TEXUV(pn, tx2, ty2);
2847 PUSH_TEXUV(pn, tx1, ty2);
2848
2849 PUSH_TEXA(pn, t2x2, t2y1);
2850 PUSH_TEXA(pn, t2x2, t2y2);
2851 PUSH_TEXA(pn, t2x1, t2y2);
2852
2853 for (i = 0; i < 6; i++)
2854 {
2855 PUSH_COLOR(pn, r, g, b, a);
2856 }
2857}
2858
2859EAPI void 2748EAPI void
2860evas_gl_common_context_flush(Evas_Engine_GL_Context *gc) 2749evas_gl_common_context_flush(Evas_Engine_GL_Context *gc)
2861{ 2750{
diff --git a/src/modules/evas/engines/gl_common/evas_gl_font.c b/src/modules/evas/engines/gl_common/evas_gl_font.c
index b7663a2b44..e43318a5f3 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_font.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_font.c
@@ -61,14 +61,14 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
61{ 61{
62 Evas_Engine_GL_Context *gc = context; 62 Evas_Engine_GL_Context *gc = context;
63 RGBA_Draw_Context *dc = draw_context; 63 RGBA_Draw_Context *dc = draw_context;
64 Evas_GL_Texture *tex; 64 Evas_GL_Texture *tex, *mtex = NULL;
65 Cutout_Rect *rct; 65 Cutout_Rect *rct;
66 int r, g, b, a; 66 int r, g, b, a;
67 double ssx, ssy, ssw, ssh; 67 double ssx, ssy, ssw, ssh;
68 int c, cx, cy, cw, ch; 68 int c, cx, cy, cw, ch;
69 int i; 69 int i;
70 int sx, sy, sw, sh; 70 int sx, sy, sw, sh;
71 double mx, my, mw, mh, mmx, mmy, mmw, mmh; 71 double mmx, mmy, mmw, mmh;
72 72
73 if (dc != gc->dc) return; 73 if (dc != gc->dc) return;
74 tex = fg->ext_dat; 74 tex = fg->ext_dat;
@@ -85,34 +85,33 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
85 // FIXME: This code path does not handle half the stuff the other path does... 85 // FIXME: This code path does not handle half the stuff the other path does...
86 Evas_GL_Image *mask = gc->dc->clip.mask; 86 Evas_GL_Image *mask = gc->dc->clip.mask;
87 int nx, ny, nw, nh, dx, dy, dw, dh; 87 int nx, ny, nw, nh, dx, dy, dw, dh;
88 double mx, my, mw, mh;
88 89
89 nx = x; ny = y; nw = tex->w; nh = tex->h; 90 if (mask->tex)
90 RECTS_CLIP_TO_RECT(nx, ny, nw, nh, 91 {
91 gc->dc->clip.x, gc->dc->clip.y, 92 nx = x; ny = y; nw = tex->w; nh = tex->h;
92 gc->dc->clip.w, gc->dc->clip.h); 93 RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
93 if ((nw < 1) || (nh < 1)) return; 94 gc->dc->clip.x, gc->dc->clip.y,
95 gc->dc->clip.w, gc->dc->clip.h);
96 if ((nw < 1) || (nh < 1)) return;
94 97
95 ssx = (double)sx + ((double)(sw * (nx - x)) / (double)(tex->w)); 98 ssx = (double)sx + ((double)(sw * (nx - x)) / (double)(tex->w));
96 ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h)); 99 ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h));
97 ssw = ((double)sw * (double)(nw)) / (double)(tex->w); 100 ssw = ((double)sw * (double)(nw)) / (double)(tex->w);
98 ssh = ((double)sh * (double)(nh)) / (double)(tex->h); 101 ssh = ((double)sh * (double)(nh)) / (double)(tex->h);
99 102
100 dx = x; dy = y; dw = sw; dh = sh; 103 dx = x; dy = y; dw = sw; dh = sh;
101 mx = gc->dc->clip.mask_x; my = gc->dc->clip.mask_y; mw = mask->w; mh = mask->h; 104 mx = gc->dc->clip.mask_x; my = gc->dc->clip.mask_y; mw = mask->w; mh = mask->h;
102 //RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch); 105 //RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
103 RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh); 106 RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
104 107
105 mmx = (double)(mx - gc->dc->clip.mask_x) + ((double)(mw * (nx - dx)) / (double)(dw)); 108 mmx = (double)(mx - gc->dc->clip.mask_x) + ((double)(mw * (nx - dx)) / (double)(dw));
106 mmy = (double)(my - gc->dc->clip.mask_y) + ((double)(mh * (ny - dy)) / (double)(dh)); 109 mmy = (double)(my - gc->dc->clip.mask_y) + ((double)(mh * (ny - dy)) / (double)(dh));
107 mmw = ((double)mw * (double)(nw)) / (double)(dw); 110 mmw = ((double)mw * (double)(nw)) / (double)(dw);
108 mmh = ((double)mh * (double)(nh)) / (double)(dh); 111 mmh = ((double)mh * (double)(nh)) / (double)(dh);
109 112
110 evas_gl_common_context_masked_font_push(gc, tex, 113 mtex = mask->tex;
111 ssx, ssy, ssw, ssh, 114 }
112 nx, ny, nw, nh,
113 r, g, b, a,
114 mask->tex, mmx, mmy, mmw, mmh);
115 return;
116 } 115 }
117 116
118 if ((!gc->dc->cutout.rects) || 117 if ((!gc->dc->cutout.rects) ||
@@ -134,6 +133,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
134 0.0, 0.0, 0.0, 0.0, 133 0.0, 0.0, 0.0, 0.0,
135// sx, sy, sw, sh, 134// sx, sy, sw, sh,
136 x, y, tex->w, tex->h, 135 x, y, tex->w, tex->h,
136 mtex, mmx, mmy, mmw, mmh,
137 r, g, b, a); 137 r, g, b, a);
138 return; 138 return;
139 } 139 }
@@ -144,6 +144,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
144 evas_gl_common_context_font_push(gc, tex, 144 evas_gl_common_context_font_push(gc, tex,
145 ssx, ssy, ssw, ssh, 145 ssx, ssy, ssw, ssh,
146 nx, ny, nw, nh, 146 nx, ny, nw, nh,
147 mtex, mmx, mmy, mmw, mmh,
147 r, g, b, a); 148 r, g, b, a);
148 } 149 }
149 else 150 else
@@ -152,6 +153,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
152 0.0, 0.0, 0.0, 0.0, 153 0.0, 0.0, 0.0, 0.0,
153// sx, sy, sw, sh, 154// sx, sy, sw, sh,
154 x, y, tex->w, tex->h, 155 x, y, tex->w, tex->h,
156 mtex, mmx, mmy, mmw, mmh,
155 r, g, b, a); 157 r, g, b, a);
156 } 158 }
157 return; 159 return;
@@ -181,6 +183,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
181 0.0, 0.0, 0.0, 0.0, 183 0.0, 0.0, 0.0, 0.0,
182// sx, sy, sw, sh, 184// sx, sy, sw, sh,
183 x, y, tex->w, tex->h, 185 x, y, tex->w, tex->h,
186 mtex, mmx, mmy, mmw, mmh,
184 r, g, b, a); 187 r, g, b, a);
185 continue; 188 continue;
186 } 189 }
@@ -191,6 +194,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
191 evas_gl_common_context_font_push(gc, tex, 194 evas_gl_common_context_font_push(gc, tex,
192 ssx, ssy, ssw, ssh, 195 ssx, ssy, ssw, ssh,
193 nx, ny, nw, nh, 196 nx, ny, nw, nh,
197 mtex, mmx, mmy, mmw, mmh,
194 r, g, b, a); 198 r, g, b, a);
195 } 199 }
196 evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects); 200 evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 583a6a6baf..05965803c0 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -948,6 +948,7 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
948 948
949 evas_gl_common_context_image_map_push(gc, im->tex, npoints, p, 949 evas_gl_common_context_image_map_push(gc, im->tex, npoints, p,
950 c, cx, cy, cw, ch, 950 c, cx, cy, cw, ch,
951 NULL, 0, 0, 0, 0,
951 r, g, b, a, smooth, im->tex_only, 952 r, g, b, a, smooth, im->tex_only,
952 im->cs.space); 953 im->cs.space);
953} 954}
@@ -963,8 +964,9 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
963 Eina_Bool yuv, Eina_Bool yuy2, Eina_Bool nv12, 964 Eina_Bool yuv, Eina_Bool yuy2, Eina_Bool nv12,
964 Eina_Bool rgb_a_pair) 965 Eina_Bool rgb_a_pair)
965{ 966{
966 double mx, my, mw, mh, mmx, mmy, mmw, mmh; 967 double mmx = 0, mmy = 0, mmw = 0, mmh = 0;
967 double ssx, ssy, ssw, ssh; 968 double ssx, ssy, ssw, ssh;
969 Evas_GL_Texture *mtex = NULL;
968 int nx, ny, nw, nh; 970 int nx, ny, nw, nh;
969 971
970 nx = dx; ny = dy; nw = dw; nh = dh; 972 nx = dx; ny = dy; nw = dw; nh = dh;
@@ -973,33 +975,29 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
973 if ((nw < 1) || (nh < 1)) return; 975 if ((nw < 1) || (nh < 1)) return;
974 if (!im->tex) return; 976 if (!im->tex) return;
975 977
978 if (mask && mask->tex)
979 {
980 double mx, my, mw, mh;
981
982 mtex = mask->tex;
983 mx = mask_x; my = mask_y; mw = mask->w; mh = mask->h;
984 RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
985 RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
986
987 mmx = (double)(mx - mask_x) + ((double)(mw * (nx - dx)) / (double)(dw));
988 mmy = (double)(my - mask_y) + ((double)(mh * (ny - dy)) / (double)(dh));
989 mmw = ((double)mw * (double)(nw)) / (double)(dw);
990 mmh = ((double)mh * (double)(nh)) / (double)(dh);
991 }
992
976 if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh)) 993 if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
977 { 994 {
978 /* Apply mask on image */ 995 if (yuv)
979 if (mask)
980 {
981 // FIXME/TODO: support for yuv, yuy2, nv12, rgb_a with masks
982 mx = mask_x; my = mask_y; mw = mask->w; mh = mask->h;
983 RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
984 RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
985
986 mmx = (double)(mx - mask_x) + ((double)(mw * (nx - dx)) / (double)(dw));
987 mmy = (double)(my - mask_y) + ((double)(mh * (ny - dy)) / (double)(dh));
988 mmw = ((double)mw * (double)(nw)) / (double)(dw);
989 mmh = ((double)mh * (double)(nh)) / (double)(dh);
990
991 evas_gl_common_context_masked_image_push(gc, im->tex, mask->tex,
992 sx, sy, sw, sh,
993 dx, dy, dw, dh,
994 mmx, mmy, mmw, mmh,
995 r, g, b, a,
996 smooth, im->tex_only);
997 }
998 else if (yuv)
999 evas_gl_common_context_yuv_push(gc, 996 evas_gl_common_context_yuv_push(gc,
1000 im->tex, 997 im->tex,
1001 sx, sy, sw, sh, 998 sx, sy, sw, sh,
1002 dx, dy, dw, dh, 999 dx, dy, dw, dh,
1000 mtex, mmx, mmy, mmw, mmh,
1003 r, g, b, a, 1001 r, g, b, a,
1004 smooth); 1002 smooth);
1005 else if (yuy2) 1003 else if (yuy2)
@@ -1007,6 +1005,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1007 im->tex, 1005 im->tex,
1008 sx, sy, sw, sh, 1006 sx, sy, sw, sh,
1009 dx, dy, dw, dh, 1007 dx, dy, dw, dh,
1008 mtex, mmx, mmy, mmw, mmh,
1010 r, g, b, a, 1009 r, g, b, a,
1011 smooth); 1010 smooth);
1012 else if (nv12) 1011 else if (nv12)
@@ -1014,6 +1013,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1014 im->tex, 1013 im->tex,
1015 sx, sy, sw, sh, 1014 sx, sy, sw, sh,
1016 dx, dy, dw, dh, 1015 dx, dy, dw, dh,
1016 mtex, mmx, mmy, mmw, mmh,
1017 r, g, b, a, 1017 r, g, b, a,
1018 smooth); 1018 smooth);
1019 else if (rgb_a_pair) 1019 else if (rgb_a_pair)
@@ -1021,6 +1021,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1021 im->tex, 1021 im->tex,
1022 sx, sy, sw, sh, 1022 sx, sy, sw, sh,
1023 dx, dy, dw, dh, 1023 dx, dy, dw, dh,
1024 mtex, mmx, mmy, mmw, mmh,
1024 r, g, b, a, 1025 r, g, b, a,
1025 smooth); 1026 smooth);
1026 else 1027 else
@@ -1028,6 +1029,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1028 im->tex, 1029 im->tex,
1029 sx, sy, sw, sh, 1030 sx, sy, sw, sh,
1030 dx, dy, dw, dh, 1031 dx, dy, dw, dh,
1032 mtex, mmx, mmy, mmw, mmh,
1031 r, g, b, a, 1033 r, g, b, a,
1032 smooth, im->tex_only); 1034 smooth, im->tex_only);
1033 return; 1035 return;
@@ -1038,31 +1040,12 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1038 ssw = ((double)sw * (double)(nw)) / (double)(dw); 1040 ssw = ((double)sw * (double)(nw)) / (double)(dw);
1039 ssh = ((double)sh * (double)(nh)) / (double)(dh); 1041 ssh = ((double)sh * (double)(nh)) / (double)(dh);
1040 1042
1041 /* Apply mask on image */ 1043 if (yuv)
1042 if (mask)
1043 {
1044 // FIXME/TODO: support for yuv, yuy2, nv12, rgb_a with masks
1045 mx = mask_x; my = mask_y; mw = mask->w; mh = mask->h;
1046 RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
1047 RECTS_CLIP_TO_RECT(mx, my, mw, mh, dx, dy, dw, dh);
1048
1049 mmx = (double)(mx - mask_x) + ((double)(mw * (nx - dx)) / (double)(dw));
1050 mmy = (double)(my - mask_y) + ((double)(mh * (ny - dy)) / (double)(dh));
1051 mmw = ((double)mw * (double)(nw)) / (double)(dw);
1052 mmh = ((double)mh * (double)(nh)) / (double)(dh);
1053
1054 evas_gl_common_context_masked_image_push(gc, im->tex, mask->tex,
1055 ssx, ssy, ssw, ssh,
1056 nx, ny, nw, nh,
1057 mmx, mmy, mmw, mmh,
1058 r, g, b, a,
1059 smooth, im->tex_only);
1060 }
1061 else if (yuv)
1062 evas_gl_common_context_yuv_push(gc, 1044 evas_gl_common_context_yuv_push(gc,
1063 im->tex, 1045 im->tex,
1064 ssx, ssy, ssw, ssh, 1046 ssx, ssy, ssw, ssh,
1065 nx, ny, nw, nh, 1047 nx, ny, nw, nh,
1048 mtex, mmx, mmy, mmw, mmh,
1066 r, g, b, a, 1049 r, g, b, a,
1067 smooth); 1050 smooth);
1068 else if (yuy2) 1051 else if (yuy2)
@@ -1070,6 +1053,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1070 im->tex, 1053 im->tex,
1071 ssx, ssy, ssw, ssh, 1054 ssx, ssy, ssw, ssh,
1072 nx, ny, nw, nh, 1055 nx, ny, nw, nh,
1056 mtex, mmx, mmy, mmw, mmh,
1073 r, g, b, a, 1057 r, g, b, a,
1074 smooth); 1058 smooth);
1075 else if (nv12) 1059 else if (nv12)
@@ -1077,6 +1061,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1077 im->tex, 1061 im->tex,
1078 ssx, ssy, ssw, ssh, 1062 ssx, ssy, ssw, ssh,
1079 nx, ny, nw, nh, 1063 nx, ny, nw, nh,
1064 mtex, mmx, mmy, mmw, mmh,
1080 r, g, b, a, 1065 r, g, b, a,
1081 smooth); 1066 smooth);
1082 else if (rgb_a_pair) 1067 else if (rgb_a_pair)
@@ -1084,6 +1069,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1084 im->tex, 1069 im->tex,
1085 ssx, ssy, ssw, ssh, 1070 ssx, ssy, ssw, ssh,
1086 nx, ny, nw, nh, 1071 nx, ny, nw, nh,
1072 mtex, mmx, mmy, mmw, mmh,
1087 r, g, b, a, 1073 r, g, b, a,
1088 smooth); 1074 smooth);
1089 else 1075 else
@@ -1091,6 +1077,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1091 im->tex, 1077 im->tex,
1092 ssx, ssy, ssw, ssh, 1078 ssx, ssy, ssw, ssh,
1093 nx, ny, nw, nh, 1079 nx, ny, nw, nh,
1080 mtex, mmx, mmy, mmw, mmh,
1094 r, g, b, a, 1081 r, g, b, a,
1095 smooth, im->tex_only); 1082 smooth, im->tex_only);
1096} 1083}
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
index 04614ac134..29f2e8a182 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
@@ -47,5 +47,7 @@ typedef enum {
47 SHADER_YUY2, 47 SHADER_YUY2,
48 SHADER_IMG_MASK, 48 SHADER_IMG_MASK,
49 SHADER_IMG_MASK_NOMUL, 49 SHADER_IMG_MASK_NOMUL,
50 SHADER_IMG_MASK_BGRA,
51 SHADER_IMG_MASK_BGRA_NOMUL,
50 SHADER_LAST 52 SHADER_LAST
51} Evas_GL_Shader; 53} Evas_GL_Shader;
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
index 9916ef0f0f..690328a2c7 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
@@ -2247,8 +2247,7 @@ static const char const img_mask_frag_glsl[] =
2247 "varying vec2 coord_a;\n" 2247 "varying vec2 coord_a;\n"
2248 "void main()\n" 2248 "void main()\n"
2249 "{\n" 2249 "{\n"
2250 " gl_FragColor.rgb = col.rgb * texture2D(tex, coord_c.xy).rgb * texture2D(texa, coord_a).g;\n" 2250 " gl_FragColor = texture2D(texa, coord_a.xy).a * texture2D(tex, coord_c.xy).bgra * col;\n"
2251 " gl_FragColor.a = col.a * texture2D(tex, coord_c.xy).a * texture2D(texa, coord_a).g;\n"
2252 "}\n"; 2251 "}\n";
2253Evas_GL_Program_Source shader_img_mask_frag_src = 2252Evas_GL_Program_Source shader_img_mask_frag_src =
2254{ 2253{
@@ -2297,8 +2296,7 @@ static const char const img_mask_nomul_frag_glsl[] =
2297 "varying vec2 coord_a;\n" 2296 "varying vec2 coord_a;\n"
2298 "void main()\n" 2297 "void main()\n"
2299 "{\n" 2298 "{\n"
2300 " gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * texture2D(texa, coord_a).g;\n" 2299 " gl_FragColor = texture2D(tex, coord_c.xy) * texture2D(texa, coord_a).a;\n"
2301 " gl_FragColor.a = texture2D(tex, coord_c.xy).a * texture2D(texa, coord_a).g;\n"
2302 "}\n"; 2300 "}\n";
2303Evas_GL_Program_Source shader_img_mask_nomul_frag_src = 2301Evas_GL_Program_Source shader_img_mask_nomul_frag_src =
2304{ 2302{
@@ -2329,6 +2327,102 @@ Evas_GL_Program_Source shader_img_mask_nomul_vert_src =
2329 NULL, 0 2327 NULL, 0
2330}; 2328};
2331 2329
2330/* Source: modules/evas/engines/gl_common/shader/img_mask_bgra_frag.shd */
2331static const char const img_mask_bgra_frag_glsl[] =
2332 "#ifdef GL_ES\n"
2333 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
2334 "precision highp float;\n"
2335 "#else\n"
2336 "precision mediump float;\n"
2337 "#endif\n"
2338 "#endif\n"
2339 "uniform sampler2D tex;\n"
2340 "uniform sampler2D texa;\n"
2341 "varying vec4 col;\n"
2342 "varying vec2 coord_c;\n"
2343 "varying vec2 coord_a;\n"
2344 "void main()\n"
2345 "{\n"
2346 " gl_FragColor = texture2D(texa, coord_a.xy).a * texture2D(tex, coord_c.xy) * col;\n"
2347 "}\n";
2348Evas_GL_Program_Source shader_img_mask_bgra_frag_src =
2349{
2350 img_mask_bgra_frag_glsl,
2351 NULL, 0
2352};
2353
2354/* Source: modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd */
2355static const char const img_mask_bgra_vert_glsl[] =
2356 "#ifdef GL_ES\n"
2357 "precision highp float;\n"
2358 "#endif\n"
2359 "attribute vec4 vertex;\n"
2360 "attribute vec4 color;\n"
2361 "attribute vec2 tex_coord;\n"
2362 "attribute vec2 tex_coorda;\n"
2363 "uniform mat4 mvp;\n"
2364 "varying vec4 col;\n"
2365 "varying vec2 coord_c;\n"
2366 "varying vec2 coord_a;\n"
2367 "void main()\n"
2368 "{\n"
2369 " gl_Position = mvp * vertex;\n"
2370 " col = color;\n"
2371 " coord_c = tex_coord;\n"
2372 " coord_a = tex_coorda;\n"
2373 "}\n";
2374Evas_GL_Program_Source shader_img_mask_bgra_vert_src =
2375{
2376 img_mask_bgra_vert_glsl,
2377 NULL, 0
2378};
2379
2380/* Source: modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd */
2381static const char const img_mask_bgra_nomul_frag_glsl[] =
2382 "#ifdef GL_ES\n"
2383 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
2384 "precision highp float;\n"
2385 "#else\n"
2386 "precision mediump float;\n"
2387 "#endif\n"
2388 "#endif\n"
2389 "uniform sampler2D tex;\n"
2390 "uniform sampler2D texa;\n"
2391 "varying vec2 coord_c;\n"
2392 "varying vec2 coord_a;\n"
2393 "void main()\n"
2394 "{\n"
2395 " gl_FragColor = texture2D(texa, coord_a.xy).a * texture2D(tex, coord_c.xy);\n"
2396 "}\n";
2397Evas_GL_Program_Source shader_img_mask_bgra_nomul_frag_src =
2398{
2399 img_mask_bgra_nomul_frag_glsl,
2400 NULL, 0
2401};
2402
2403/* Source: modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd */
2404static const char const img_mask_bgra_nomul_vert_glsl[] =
2405 "#ifdef GL_ES\n"
2406 "precision highp float;\n"
2407 "#endif\n"
2408 "attribute vec4 vertex;\n"
2409 "attribute vec2 tex_coord;\n"
2410 "attribute vec2 tex_coorda;\n"
2411 "uniform mat4 mvp;\n"
2412 "varying vec2 coord_c;\n"
2413 "varying vec2 coord_a;\n"
2414 "void main()\n"
2415 "{\n"
2416 " gl_Position = mvp * vertex;\n"
2417 " coord_c = tex_coord;\n"
2418 " coord_a = tex_coorda;\n"
2419 "}\n";
2420Evas_GL_Program_Source shader_img_mask_bgra_nomul_vert_src =
2421{
2422 img_mask_bgra_nomul_vert_glsl,
2423 NULL, 0
2424};
2425
2332static const struct { 2426static const struct {
2333 Evas_GL_Shader id; 2427 Evas_GL_Shader id;
2334 Evas_GL_Program_Source *vert; 2428 Evas_GL_Program_Source *vert;
@@ -2380,5 +2474,7 @@ static const struct {
2380 { SHADER_YUY2, &(shader_yuy2_vert_src), &(shader_yuy2_frag_src), "yuy2" }, 2474 { SHADER_YUY2, &(shader_yuy2_vert_src), &(shader_yuy2_frag_src), "yuy2" },
2381 { SHADER_IMG_MASK, &(shader_img_mask_vert_src), &(shader_img_mask_frag_src), "img_mask" }, 2475 { SHADER_IMG_MASK, &(shader_img_mask_vert_src), &(shader_img_mask_frag_src), "img_mask" },
2382 { SHADER_IMG_MASK_NOMUL, &(shader_img_mask_nomul_vert_src), &(shader_img_mask_nomul_frag_src), "img_mask_nomul" }, 2476 { SHADER_IMG_MASK_NOMUL, &(shader_img_mask_nomul_vert_src), &(shader_img_mask_nomul_frag_src), "img_mask_nomul" },
2477 { SHADER_IMG_MASK_BGRA, &(shader_img_mask_bgra_vert_src), &(shader_img_mask_bgra_frag_src), "img_mask_bgra" },
2478 { SHADER_IMG_MASK_BGRA_NOMUL, &(shader_img_mask_bgra_nomul_vert_src), &(shader_img_mask_bgra_nomul_frag_src), "img_mask_bgra_nomul" },
2383}; 2479};
2384 2480
diff --git a/src/modules/evas/engines/gl_common/shader/img_mask_bgra_frag.shd b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_frag.shd
new file mode 100644
index 0000000000..8583474f58
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_frag.shd
@@ -0,0 +1,17 @@
1#ifdef GL_ES
2#ifdef GL_FRAGMENT_PRECISION_HIGH
3precision highp float;
4#else
5precision mediump float;
6#endif
7#endif
8uniform sampler2D tex;
9uniform sampler2D texa;
10varying vec4 col;
11varying vec2 coord_c;
12varying vec2 coord_a;
13void main()
14{
15 gl_FragColor = texture2D(texa, coord_a.xy).a * texture2D(tex, coord_c.xy) * col;
16}
17
diff --git a/src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd
new file mode 100644
index 0000000000..4556cde3d1
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_frag.shd
@@ -0,0 +1,16 @@
1#ifdef GL_ES
2#ifdef GL_FRAGMENT_PRECISION_HIGH
3precision highp float;
4#else
5precision mediump float;
6#endif
7#endif
8uniform sampler2D tex;
9uniform sampler2D texa;
10varying vec2 coord_c;
11varying vec2 coord_a;
12void main()
13{
14 gl_FragColor = texture2D(texa, coord_a.xy).a * texture2D(tex, coord_c.xy);
15}
16
diff --git a/src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd
new file mode 100644
index 0000000000..a1debf63f2
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_nomul_vert.shd
@@ -0,0 +1,16 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4attribute vec4 vertex;
5attribute vec2 tex_coord;
6attribute vec2 tex_coorda;
7uniform mat4 mvp;
8varying vec2 coord_c;
9varying vec2 coord_a;
10void main()
11{
12 gl_Position = mvp * vertex;
13 coord_c = tex_coord;
14 coord_a = tex_coorda;
15}
16
diff --git a/src/modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd
new file mode 100644
index 0000000000..3cd1740771
--- /dev/null
+++ b/src/modules/evas/engines/gl_common/shader/img_mask_bgra_vert.shd
@@ -0,0 +1,19 @@
1#ifdef GL_ES
2precision highp float;
3#endif
4attribute vec4 vertex;
5attribute vec4 color;
6attribute vec2 tex_coord;
7attribute vec2 tex_coorda;
8uniform mat4 mvp;
9varying vec4 col;
10varying vec2 coord_c;
11varying vec2 coord_a;
12void main()
13{
14 gl_Position = mvp * vertex;
15 col = color;
16 coord_c = tex_coord;
17 coord_a = tex_coorda;
18}
19
diff --git a/src/modules/evas/engines/gl_common/shader/img_mask_frag.shd b/src/modules/evas/engines/gl_common/shader/img_mask_frag.shd
index 2d1612a38e..fadbd281d0 100644
--- a/src/modules/evas/engines/gl_common/shader/img_mask_frag.shd
+++ b/src/modules/evas/engines/gl_common/shader/img_mask_frag.shd
@@ -12,7 +12,6 @@ varying vec2 coord_c;
12varying vec2 coord_a; 12varying vec2 coord_a;
13void main() 13void main()
14{ 14{
15 gl_FragColor.rgb = col.rgb * texture2D(tex, coord_c.xy).rgb * texture2D(texa, coord_a).g; 15 gl_FragColor = texture2D(texa, coord_a.xy).a * texture2D(tex, coord_c.xy).bgra * col;
16 gl_FragColor.a = col.a * texture2D(tex, coord_c.xy).a * texture2D(texa, coord_a).g;
17} 16}
18 17
diff --git a/src/modules/evas/engines/gl_common/shader/img_mask_nomul_frag.shd b/src/modules/evas/engines/gl_common/shader/img_mask_nomul_frag.shd
index e5336f4246..b93d6fb6d5 100644
--- a/src/modules/evas/engines/gl_common/shader/img_mask_nomul_frag.shd
+++ b/src/modules/evas/engines/gl_common/shader/img_mask_nomul_frag.shd
@@ -11,7 +11,6 @@ varying vec2 coord_c;
11varying vec2 coord_a; 11varying vec2 coord_a;
12void main() 12void main()
13{ 13{
14 gl_FragColor.rgb = texture2D(tex, coord_c.xy).rgb * texture2D(texa, coord_a).g; 14 gl_FragColor = texture2D(tex, coord_c.xy) * texture2D(texa, coord_a).a;
15 gl_FragColor.a = texture2D(tex, coord_c.xy).a * texture2D(texa, coord_a).g;
16} 15}
17 16