GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_proxy_shm.h
1//SPDX-License-Identifier: LGPL-2.0-or-later
2/*
3
4 Copyright (c) 2019-2020 Cyril Hrubis <metan@ucw.cz>
5
6 */
7
8#ifndef GP_PROXY_SHM_H
9#define GP_PROXY_SHM_H
10
11#include <backends/gp_proxy_proto.h>
12#include <core/gp_pixmap.h>
13
14typedef struct gp_proxy_shm {
15 int fd;
16 size_t size;
17 gp_pixmap pixmap;
18 struct gp_proxy_path path;
19} gp_proxy_shm;
20
21/*
22 * Creates an SHM pixmap.
23 *
24 * @path in the /dev/shm/ filesystem, 64 bytes at max.
25 */
26gp_proxy_shm *gp_proxy_shm_init(const char *path, gp_size w, gp_size h, gp_pixel_type type);
27
28/*
29 * Resizes SHM image, all clients have to avoid working with the buffer once
30 * this call is called and have to remap the shm before they attempt to use it again.
31 *
32 * @returns 0 if shm buffer haven't needed to be resized, only pixmap size has been changed
33 * 1 if buffer was resized
34 * -1 on failure
35 */
36int gp_proxy_shm_resize(gp_proxy_shm *self, gp_size w, gp_size h);
37
38void gp_proxy_shm_exit(gp_proxy_shm *self);
39
40#endif /* GP_PROXY_SHM_H */
unsigned int gp_size
Integer type for sizes i.e. w, h, ...
Definition gp_types.h:24
gp_pixel_type
List of all pixel types.
A pixel buffer.
A pixmap buffer.
Definition gp_pixmap.h:33