Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(
)

add_project_arguments(
['-D_POSIX_C_SOURCE=200809L', '-Wno-unused-parameter'],
['-D_XOPEN_SOURCE=700', '-Wno-unused-parameter'],
language: 'c',
)

Expand Down Expand Up @@ -47,25 +47,25 @@ wp_viewporter = [
]

layer_shell = [
proto_c.process('wlr-layer-shell-unstable-v1.xml'),
proto_h.process('wlr-layer-shell-unstable-v1.xml'),
proto_c.process('protocols/wlr-layer-shell-unstable-v1.xml'),
proto_h.process('protocols/wlr-layer-shell-unstable-v1.xml'),
]

screencopy = [
proto_c.process('wlr-screencopy-unstable-v1.xml'),
proto_h.process('wlr-screencopy-unstable-v1.xml'),
proto_c.process('protocols/wlr-screencopy-unstable-v1.xml'),
proto_h.process('protocols/wlr-screencopy-unstable-v1.xml'),
]

executable(
meson.project_name(),
install: true,
sources: [
'array.c',
'buffer.c',
'capture.c',
'image.c',
'main.c',
'overlay.c',
'src/array.c',
'src/buffer.c',
'src/capture.c',
'src/image.c',
'src/main.c',
'src/overlay.c',
xdg_shell,
wp_viewporter,
layer_shell,
Expand All @@ -83,7 +83,7 @@ if unity.found()
'array',
executable(
'array.test',
sources: ['array.c', 'array.test.c'],
sources: ['src/array.c', 'src/array.test.c'],
dependencies: [unity_dep],
),
)
Expand All @@ -92,7 +92,7 @@ if unity.found()
'image',
executable(
'image.test',
sources: ['image.c', 'image.test.c'],
sources: ['src/image.c', 'src/image.test.c'],
dependencies: [math, pixman, unity_dep],
),
)
Expand Down
File renamed without changes.
16 changes: 9 additions & 7 deletions array.h → src/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ void *array_grow_if_needed(void *array, size_t element_size,
size_t new_capacity);

#define array_push(array, element) \
{ \
do { \
(array) = array_grow_if_needed((array), sizeof(*array), \
array_length(array) + 1); \
(array)[((struct array_header *)(array) - 1)->length++] = (element); \
};
} while (0)

#define array_free(array) \
if (array) { \
free((struct array_header *)(array) - 1); \
(array) = NULL; \
}
#define array_free(array) \
do { \
if (array) { \
free((struct array_header *)(array) - 1); \
(array) = NULL; \
} \
} while (0)

#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions image.c → src/image.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "image.h"
#include <math.h>
#include <pixman.h>
#include <stdint.h>

#define PI 3.14159265358979323846

pixman_image_t *
image_revert_wl_output_transform(pixman_image_t *src,
enum wl_output_transform wl_output_transform) {
Expand All @@ -25,7 +24,7 @@ image_revert_wl_output_transform(pixman_image_t *src,
pixman_f_transform_translate(&f_transform, NULL, -(double)src_width / 2,
-(double)src_height / 2);

double rotation_radians = PI * (wl_output_transform % 4) / 2.0;
double rotation_radians = M_PI * (wl_output_transform % 4) / 2.0;
pixman_f_transform_rotate(&f_transform, NULL, round(cos(rotation_radians)),
round(sin(rotation_radians)));

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.