summaryrefslogtreecommitdiff
path: root/src/glamor_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/glamor_utils.h')
-rw-r--r--src/glamor_utils.h95
1 files changed, 53 insertions, 42 deletions
diff --git a/src/glamor_utils.h b/src/glamor_utils.h
index 8dad2df..4af6739 100644
--- a/src/glamor_utils.h
+++ b/src/glamor_utils.h
@@ -143,54 +143,65 @@
(vertices)[7] = (vertices)[5]; \
} while(0)
-#define glamor_set_tcoords(x1, y1, x2, y2, yInverted, vertices) \
- do { \
- (vertices)[0] = (x1); \
- (vertices)[2] = (x2); \
- (vertices)[4] = (vertices)[2]; \
- (vertices)[6] = (vertices)[0]; \
- if (yInverted) { \
- (vertices)[1] = (y1); \
- (vertices)[5] = (y2); \
- } \
- else { \
- (vertices)[1] = (y2); \
- (vertices)[5] = (y1); \
- } \
- (vertices)[3] = (vertices)[1]; \
- (vertices)[7] = (vertices)[5]; \
+#define glamor_set_tcoords(width, height, x1, y1, x2, y2, \
+ yInverted, vertices) \
+ do { \
+ (vertices)[0] = (x1); \
+ (vertices)[2] = (x2); \
+ (vertices)[4] = (vertices)[2]; \
+ (vertices)[6] = (vertices)[0]; \
+ if (yInverted) { \
+ (vertices)[1] = (y1); \
+ (vertices)[5] = (y2); \
+ } \
+ else { \
+ (vertices)[1] = height - (y2); \
+ (vertices)[5] = height - (y1); \
+ } \
+ (vertices)[3] = (vertices)[1]; \
+ (vertices)[7] = (vertices)[5]; \
} while(0)
#define glamor_set_normalize_vcoords(xscale, yscale, x1, y1, x2, y2, \
yInverted, vertices) \
- do { \
- (vertices)[0] = v_from_x_coord_x(xscale, x1); \
- (vertices)[2] = v_from_x_coord_x(xscale, x2); \
- (vertices)[4] = (vertices)[2]; \
- (vertices)[6] = (vertices)[0]; \
- if (yInverted) { \
- (vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \
- (vertices)[5] = v_from_x_coord_y_inverted(yscale, y2); \
- } \
- else { \
- (vertices)[1] = v_from_x_coord_y(yscale, y1); \
- (vertices)[5] = v_from_x_coord_y(yscale, y2); \
- } \
- (vertices)[3] = (vertices)[1]; \
- (vertices)[7] = (vertices)[5]; \
- } while(0)
+ do { \
+ (vertices)[0] = v_from_x_coord_x(xscale, x1); \
+ (vertices)[2] = v_from_x_coord_x(xscale, x2); \
+ (vertices)[4] = (vertices)[2]; \
+ (vertices)[6] = (vertices)[0]; \
+ if (yInverted) { \
+ (vertices)[1] = v_from_x_coord_y_inverted(yscale, y1); \
+ (vertices)[5] = v_from_x_coord_y_inverted(yscale, y2); \
+ } \
+ else { \
+ (vertices)[1] = v_from_x_coord_y(yscale, y1); \
+ (vertices)[5] = v_from_x_coord_y(yscale, y2); \
+ } \
+ (vertices)[3] = (vertices)[1]; \
+ (vertices)[7] = (vertices)[5]; \
+ } while(0)
+
+#define glamor_set_normalize_pt(xscale, yscale, x, y, \
+ yInverted, pt) \
+ do { \
+ (pt)[0] = t_from_x_coord_x(xscale, x); \
+ if (yInverted) { \
+ (pt)[1] = t_from_x_coord_y_inverted(yscale, y); \
+ } else { \
+ (pt)[1] = t_from_x_coord_y(yscale, y); \
+ } \
+ } while(0)
-#define glamor_set_normalize_pt(xscale, yscale, x, x_start, y, y_start, \
- yInverted, pt) \
- do { \
- (pt)[0] = t_from_x_coord_x(xscale, x - x_start); \
- if (yInverted) { \
- (pt)[1] = t_from_x_coord_y_inverted(yscale, y - y_start); \
- } else { \
- (pt)[1] = t_from_x_coord_y(yscale, y - y_start); \
- } \
- (pt)[2] = (pt)[3] = 0.0; \
+#define glamor_set_circle_centre(width, height, x, y, \
+ yInverted, c) \
+ do { \
+ (c)[0] = (float)x; \
+ if (yInverted) { \
+ (c)[1] = (float)y; \
+ } else { \
+ (c)[1] = (float)height - (float)y; \
+ } \
} while(0)
inline static void