third_party/cairo/src/cairo-gl-shaders.c
static void
_cairo_gl_shader_emit_wrap (cairo_gl_context_t *ctx,
			    cairo_output_stream_t *stream,
			    cairo_gl_operand_t *operand,
			    cairo_gl_tex_t name)
{
    const char *namestr = operand_names[name];
    cairo_extend_t extend = _cairo_gl_operand_get_extend (operand);

    _cairo_output_stream_printf (stream,
	"vec2 %s_wrap(vec2 coords)\n"
	"{\n",
	namestr);

    if (! ctx->has_npot_repeat &&
	(extend == CAIRO_EXTEND_REPEAT || extend == CAIRO_EXTEND_REFLECT))
    {
	if (extend == CAIRO_EXTEND_REPEAT) {
	    _cairo_output_stream_printf (stream,
		"    return fract(coords);\n");
	} else { /* CAIRO_EXTEND_REFLECT */
	    _cairo_output_stream_printf (stream,
		"    return mix(fract(coords), 1.0 - fract(coords), floor(mod(coords, 2.0)));\n");
	}
    }
    else
    {
	_cairo_output_stream_printf (stream, "    return coords;\n");
    }

    _cairo_output_stream_printf (stream, "}\n");
}
/*
 * Emits the wrap function used by an operand.
 *
 * In OpenGL ES 2.0, repeat wrap modes (GL_REPEAT and GL_MIRRORED REPEAT) are
 * only available for NPOT textures if the GL_OES_texture_npot is supported.
 * If GL_OES_texture_npot is not supported, we need to implement the wrapping
 * functionality in the shader.
 */
Emits the wrap function used by an operand.
In OpenGL ES 2.0, repeat wrap modes (GL_REPEAT and GL_MIRRORED REPEAT) are
only available for NPOT textures if the GL_OES_texture_npot is supported.
If GL_OES_texture_npot is not supported, we need to implement the wrapping
functionality in the shader.
Emits the wrap function used by an operand . In OpenGL ES 2 . 0 repeat wrap modes ( GL_REPEAT and GL_MIRRORED REPEAT ) are only available for NPOT textures if the GL_OES_texture_npot is supported . If GL_OES_texture_npot is not supported we need to implement the wrapping functionality in the shader .
static void
_cairo_gl_shader_emit_wrap (cairo_gl_context_t *ctx,
			    cairo_output_stream_t *stream,
			    cairo_gl_operand_t *operand,
			    cairo_gl_tex_t name)
{
    const char *namestr = operand_names[name];
    cairo_extend_t extend = _cairo_gl_operand_get_extend (operand);
    _cairo_output_stream_printf (stream,
	"vec2 %s_wrap(vec2 coords)\n"
	"{\n",
	namestr);
    if (! ctx->has_npot_repeat &&
	(extend == CAIRO_EXTEND_REPEAT || extend == CAIRO_EXTEND_REFLECT))
    {
	if (extend == CAIRO_EXTEND_REPEAT) {
	    _cairo_output_stream_printf (stream,
		"    return fract(coords);\n");
	} else { 
	    _cairo_output_stream_printf (stream,
		"    return mix(fract(coords), 1.0 - fract(coords), floor(mod(coords, 2.0)));\n");
	}
    }
    else
    {
	_cairo_output_stream_printf (stream, "    return coords;\n");
    }
    _cairo_output_stream_printf (stream, "}\n");
}
static void _cairo_gl_shader_emit_wrap ( cairo_gl_context_t * ctx , cairo_output_stream_t * stream , cairo_gl_operand_t * operand , cairo_gl_tex_t name ) { const char * namestr = operand_names [ name ] ; cairo_extend_t extend = _cairo_gl_operand_get_extend ( operand ) ; _cairo_output_stream_printf ( stream , " \n " " \n " , namestr ) ; if ( ! ctx -> has_npot_repeat && ( extend == CAIRO_EXTEND_REPEAT || extend == CAIRO_EXTEND_REFLECT ) ) { if ( extend == CAIRO_EXTEND_REPEAT ) { _cairo_output_stream_printf ( stream , " \n " ) ; } else { _cairo_output_stream_printf ( stream , " \n " ) ; } } else { _cairo_output_stream_printf ( stream , " \n " ) ; } _cairo_output_stream_printf ( stream , " \n " ) ; }
Emits the wrap function used by an operand.
Emits the wrap function used by an operand .
/* CAIRO_EXTEND_REFLECT */