[PATCH xserver 17/19] glamor: Clarify how the repeat values being passed around work.

Eric Anholt eric at anholt.net
Wed Jan 27 17:56:46 PST 2016


Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_render.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index a2a7f4a..ed425f5 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -76,11 +76,11 @@ glamor_create_composite_fs(struct shader_key *key)
         "{\n"
         "	vec2 rel_tex; \n"
         "	rel_tex = texture * wh.xy; \n"
-        "	if (repeat == RepeatNone)\n"
+        "	if (repeat == RepeatFix + RepeatNone)\n"
         "		return rel_tex; \n"
-        "	else if (repeat == RepeatNormal) \n"
+        "	else if (repeat == RepeatFix + RepeatNormal) \n"
         "		rel_tex = floor(rel_tex) + (fract(rel_tex) / wh.xy); \n"
-        "	else if (repeat == RepeatPad) { \n"
+        "	else if (repeat == RepeatFix + RepeatPad) { \n"
         "		if (rel_tex.x >= 1.0) \n"
         "			rel_tex.x = 1.0 - wh.z * wh.x / 2.; \n"
         "		else if (rel_tex.x < 0.0) \n"
@@ -90,7 +90,7 @@ glamor_create_composite_fs(struct shader_key *key)
         "		else if (rel_tex.y < 0.0) \n"
         "			rel_tex.y = 0.0; \n"
         "		rel_tex = rel_tex / wh.xy; \n"
-        "	} else if (repeat == RepeatReflect) {\n"
+        "	} else if (repeat == RepeatFix + RepeatReflect) {\n"
         "		if ((1.0 - mod(abs(floor(rel_tex.x)), 2.0)) < 0.001)\n"
         "			rel_tex.x = 2.0 - (1.0 - fract(rel_tex.x)) / wh.x;\n"
         "		else \n"
@@ -107,8 +107,8 @@ glamor_create_composite_fs(struct shader_key *key)
     const char *rel_sampler =
         " vec4 rel_sampler(sampler2D tex_image, vec2 tex, vec4 wh, int repeat, int set_alpha)\n"
         "{\n"
-        "	tex = rel_tex_coord(tex, wh, repeat - RepeatFix);\n"
-        "	if (repeat == RepeatFix) {\n"
+        "	tex = rel_tex_coord(tex, wh, repeat);\n"
+        "	if (repeat == RepeatFix + RepeatNone) {\n"
         "		if (!(tex.x >= 0.0 && tex.x < 1.0 \n"
         "		    && tex.y >= 0.0 && tex.y < 1.0))\n"
         "			return vec4(0.0, 0.0, 0.0, set_alpha);\n"
-- 
2.6.4



More information about the xorg-devel mailing list