util/transform: move over wl_output_transform helpers

These aren't really tied to wlr_output.
This commit is contained in:
Simon Ser 2023-05-03 12:32:44 +02:00
parent a3d22dbe97
commit 9e702e9cfe
13 changed files with 38 additions and 18 deletions

View file

@ -19,6 +19,7 @@
#include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_matrix.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/transform.h>
#include <xf86drm.h> #include <xf86drm.h>
#include <xf86drmMode.h> #include <xf86drmMode.h>
#include "backend/drm/drm.h" #include "backend/drm/drm.h"

View file

@ -16,6 +16,7 @@
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/transform.h>
/** /**
* A minimal fullscreen-shell server. It only supports rendering. * A minimal fullscreen-shell server. It only supports rendering.

View file

@ -729,19 +729,4 @@ bool wlr_output_configure_primary_swapchain(struct wlr_output *output,
struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output, struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output,
struct wlr_output_state *state, int *buffer_age, struct wlr_render_timer *timer); struct wlr_output_state *state, int *buffer_age, struct wlr_render_timer *timer);
/**
* Returns the transform that, when composed with `tr`, gives
* `WL_OUTPUT_TRANSFORM_NORMAL`.
*/
enum wl_output_transform wlr_output_transform_invert(
enum wl_output_transform tr);
/**
* Returns a transform that, when applied, has the same effect as applying
* sequentially `tr_a` and `tr_b`.
*/
enum wl_output_transform wlr_output_transform_compose(
enum wl_output_transform tr_a, enum wl_output_transform tr_b);
#endif #endif

View file

@ -0,0 +1,28 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_UTIL_TRANSFORM_H
#define WLR_UTIL_TRANSFORM_H
#include <wayland-server-protocol.h>
/**
* Returns the transform that, when composed with `tr`, gives
* `WL_OUTPUT_TRANSFORM_NORMAL`.
*/
enum wl_output_transform wlr_output_transform_invert(
enum wl_output_transform tr);
/**
* Returns a transform that, when applied, has the same effect as applying
* sequentially `tr_a` and `tr_b`.
*/
enum wl_output_transform wlr_output_transform_compose(
enum wl_output_transform tr_a, enum wl_output_transform tr_b);
#endif

View file

@ -4,6 +4,7 @@
#include <pixman.h> #include <pixman.h>
#include <time.h> #include <time.h>
#include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_matrix.h>
#include <wlr/util/transform.h>
#include "render/gles2.h" #include "render/gles2.h"
#include "types/wlr_matrix.h" #include "types/wlr_matrix.h"

View file

@ -8,7 +8,6 @@ wlr_files += files(
'output/render.c', 'output/render.c',
'output/state.c', 'output/state.c',
'output/swapchain.c', 'output/swapchain.c',
'output/transform.c',
'scene/drag_icon.c', 'scene/drag_icon.c',
'scene/subsurface_tree.c', 'scene/subsurface_tree.c',
'scene/surface.c', 'scene/surface.c',

View file

@ -8,6 +8,7 @@
#include <wlr/types/wlr_matrix.h> #include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/region.h> #include <wlr/util/region.h>
#include <wlr/util/transform.h>
#include "render/allocator/allocator.h" #include "render/allocator/allocator.h"
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "types/wlr_output.h" #include "types/wlr_output.h"

View file

@ -4,6 +4,7 @@
#include <wlr/types/wlr_scene.h> #include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_fractional_scale_v1.h> #include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_presentation_time.h> #include <wlr/types/wlr_presentation_time.h>
#include <wlr/util/transform.h>
#include "types/wlr_scene.h" #include "types/wlr_scene.h"
static void handle_scene_buffer_outputs_update( static void handle_scene_buffer_outputs_update(

View file

@ -13,6 +13,7 @@
#include <wlr/types/wlr_scene.h> #include <wlr/types/wlr_scene.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/region.h> #include <wlr/util/region.h>
#include <wlr/util/transform.h>
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "types/wlr_output.h" #include "types/wlr_output.h"
#include "types/wlr_scene.h" #include "types/wlr_scene.h"

View file

@ -10,6 +10,7 @@
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/region.h> #include <wlr/util/region.h>
#include <wlr/util/transform.h>
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "types/wlr_region.h" #include "types/wlr_region.h"
#include "types/wlr_subcompositor.h" #include "types/wlr_subcompositor.h"

View file

@ -9,6 +9,7 @@
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/transform.h>
#include "wlr-screencopy-unstable-v1-protocol.h" #include "wlr-screencopy-unstable-v1-protocol.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "render/wlr_renderer.h" #include "render/wlr_renderer.h"

View file

@ -11,6 +11,6 @@ wlr_files += files(
'shm.c', 'shm.c',
'time.c', 'time.c',
'token.c', 'token.c',
'transform.c',
'utf8.c', 'utf8.c',
) )

View file

@ -1,4 +1,4 @@
#include <wlr/types/wlr_output.h> #include <wlr/util/transform.h>
enum wl_output_transform wlr_output_transform_invert( enum wl_output_transform wlr_output_transform_invert(
enum wl_output_transform tr) { enum wl_output_transform tr) {