blob: 7794b57703e289e45e59b558674b999a48c700a8 [file] [log] [blame]
Chris Wilsonb98bade2013-08-20 21:39:27 +01001/*
2 * Copyright © 2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#ifndef OVERLAY_H
26#define OVERLAY_H
27
Chris Wilson34e47802013-08-18 21:10:26 +010028#ifdef HAVE_CONFIG_H
29#include"config.h"
30#endif
31
Chris Wilsonf9a50de2013-08-17 11:12:07 +010032#include <cairo.h>
33
34enum position {
35 POS_UNSET = -1,
36
37 POS_LEFT = 0,
38 POS_CENTRE = 1,
39 POS_RIGHT = 2,
40
41 POS_TOP = 0 << 4,
42 POS_MIDDLE = 1 << 4,
43 POS_BOTTOM = 2 << 4,
44
45 POS_TOP_LEFT = POS_TOP | POS_LEFT,
46 POS_TOP_CENTRE = POS_TOP | POS_CENTRE,
47 POS_TOP_RIGHT = POS_TOP | POS_RIGHT,
48
49 POS_MIDDLE_LEFT = POS_MIDDLE | POS_LEFT,
50 POS_MIDDLE_CENTRE = POS_MIDDLE | POS_CENTRE,
51 POS_MIDDLE_RIGHT = POS_MIDDLE | POS_RIGHT,
52
53 POS_BOTTOM_LEFT = POS_BOTTOM | POS_LEFT,
54 POS_BOTTOM_CENTRE = POS_BOTTOM | POS_CENTRE,
55 POS_BOTTOM_RIGHT = POS_BOTTOM | POS_RIGHT,
56};
57
58struct overlay {
59 cairo_surface_t *surface;
60 void (*show)(struct overlay *);
61 void (*position)(struct overlay *, enum position);
62 void (*hide)(struct overlay *);
63};
64
65extern const cairo_user_data_key_t overlay_key;
66
Chris Wilson34e47802013-08-18 21:10:26 +010067#ifdef HAVE_OVERLAY_XVLIB
Chris Wilson74032f42013-08-18 18:40:03 +010068cairo_surface_t *x11_overlay_create(enum position pos, int *width, int *height);
Chris Wilsonf9a50de2013-08-17 11:12:07 +010069void x11_overlay_stop(void);
Chris Wilson34e47802013-08-18 21:10:26 +010070#else
71static inline cairo_surface_t *x11_overlay_create(enum position pos, int *width, int *height) { return NULL; }
72static inline void x11_overlay_stop(void) { }
73#endif
74
75#ifdef HAVE_OVERLAY_XLIB
76cairo_surface_t *x11_window_create(enum position pos, int *width, int *height);
77#else
78static inline cairo_surface_t *x11_window_create(enum position pos, int *width, int *height) { return NULL; }
79#endif
Chris Wilsonb98bade2013-08-20 21:39:27 +010080
81#endif /* OVERLAY_H */