a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/*
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Copyright © 2014 Keith Packard
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync *
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Permission to use, copy, modify, distribute, and sell this software and its
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * documentation for any purpose is hereby granted without fee, provided that
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * the above copyright notice appear in all copies and that both that copyright
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * notice and this permission notice appear in supporting documentation, and
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * that the name of the copyright holders not be used in advertising or
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * publicity pertaining to distribution of the software without specific,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * written prior permission. The copyright holders make no representations
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * about the suitability of this software for any purpose. It is provided "as
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * is" without express or implied warranty.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync *
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * OF THIS SOFTWARE.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#ifndef _GLAMOR_TRANSFORM_H_
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define _GLAMOR_TRANSFORM_H_
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncvoid
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncglamor_set_destination_drawable(DrawablePtr drawable,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int box_x,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int box_y,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Bool do_drawable_translate,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Bool center_offset,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint matrix_uniform_location,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int *p_off_x,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int *p_off_y);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncvoid
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncglamor_set_color(PixmapPtr pixmap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync CARD32 pixel,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint uniform);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncBool
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncglamor_set_texture(PixmapPtr pixmap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync PixmapPtr texture,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int off_x,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int off_y,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint offset_uniform,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint size_uniform);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncBool
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncglamor_set_solid(PixmapPtr pixmap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GCPtr gc,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Bool use_alu,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint uniform);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncBool
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncglamor_set_tiled(PixmapPtr pixmap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GCPtr gc,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint offset_uniform,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint size_uniform);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncBool
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncglamor_set_stippled(PixmapPtr pixmap,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GCPtr gc,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint fg_uniform,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint offset_uniform,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync GLint size_uniform);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/*
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Vertex shader bits that transform X coordinates to pixmap
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * coordinates using the matrix computed above
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define GLAMOR_DECLARE_MATRIX "uniform vec4 v_matrix;\n"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define GLAMOR_X_POS(x) #x " *v_matrix.x + v_matrix.y"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define GLAMOR_Y_POS(y) #y " *v_matrix.z + v_matrix.w"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#if 0
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define GLAMOR_POS(dst,src) \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync " " #dst ".x = " #src ".x * v_matrix.x + v_matrix.y;\n" \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync " " #dst ".y = " #src ".y * v_matrix.z + v_matrix.w;\n" \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync " " #dst ".z = 0.0;\n" \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync " " #dst ".w = 1.0;\n"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#endif
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#define GLAMOR_POS(dst,src) \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync " " #dst ".xy = " #src ".xy * v_matrix.xz + v_matrix.yw;\n" \
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync " " #dst ".zw = vec2(0.0,1.0);\n"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync#endif /* _GLAMOR_TRANSFORM_H_ */