wlr_output: Make wlr_output_effective_resolution take state

This commit is contained in:
Alexander Orzechowski 2023-12-05 20:36:52 -05:00
parent c3b5e710f4
commit 34ec9319d0
11 changed files with 21 additions and 15 deletions

View file

@ -86,7 +86,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
int width, height;
wlr_output_effective_resolution(output->wlr_output, &width, &height);
wlr_output_effective_resolution(output->wlr_output, NULL, &width, &height);
struct wlr_output_state state;
wlr_output_state_init(&state);

View file

@ -92,7 +92,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
}
int width, height;
wlr_output_effective_resolution(output->wlr_output, &width, &height);
wlr_output_effective_resolution(output->wlr_output, NULL, &width, &height);
struct wlr_render_pass *pass = wlr_output_begin_render_pass(output->wlr_output, &output_state, NULL);
wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){

View file

@ -55,7 +55,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
clock_gettime(CLOCK_MONOTONIC, &now);
int32_t width, height;
wlr_output_effective_resolution(wlr_output, &width, &height);
wlr_output_effective_resolution(wlr_output, NULL, &width, &height);
struct wlr_output_state output_state;
wlr_output_state_init(&output_state);

View file

@ -85,7 +85,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
clock_gettime(CLOCK_MONOTONIC, &now);
int32_t width, height;
wlr_output_effective_resolution(wlr_output, &width, &height);
wlr_output_effective_resolution(wlr_output, NULL, &width, &height);
struct wlr_output_state output_state;
wlr_output_state_init(&output_state);

View file

@ -72,7 +72,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
struct wlr_output *wlr_output = sample_output->output;
int32_t width, height;
wlr_output_effective_resolution(wlr_output, &width, &height);
wlr_output_effective_resolution(wlr_output, NULL, &width, &height);
struct wlr_output_state output_state;
wlr_output_state_init(&output_state);

View file

@ -344,7 +344,7 @@ void wlr_output_transformed_resolution(struct wlr_output *output,
* Computes the transformed and scaled output resolution.
*/
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height);
const struct wlr_output_state *state, int *width, int *height);
/**
* Test whether this output state would be accepted by the backend. If this
* function returns true, wlr_output_commit_state() will only fail due to a

View file

@ -457,10 +457,16 @@ void wlr_output_transformed_resolution(struct wlr_output *output,
}
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height) {
wlr_output_transformed_resolution(output, NULL, width, height);
*width /= output->scale;
*height /= output->scale;
const struct wlr_output_state *state, int *width, int *height) {
wlr_output_transformed_resolution(output, state, width, height);
float scale = output->scale;
if (state && state->committed & WLR_OUTPUT_STATE_SCALE) {
scale = state->scale;
}
*width /= scale;
*height /= scale;
}
struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output) {

View file

@ -445,7 +445,7 @@ static void update_node_update_outputs(struct wlr_scene_node *node,
.x = scene_output->x,
.y = scene_output->y,
};
wlr_output_effective_resolution(scene_output->output,
wlr_output_effective_resolution(scene_output->output, NULL,
&output_box.width, &output_box.height);
pixman_region32_t intersection;
@ -2337,7 +2337,7 @@ static void scene_output_for_each_scene_buffer(const struct wlr_box *output_box,
void wlr_scene_output_for_each_buffer(struct wlr_scene_output *scene_output,
wlr_scene_buffer_iterator_func_t iterator, void *user_data) {
struct wlr_box box = { .x = scene_output->x, .y = scene_output->y };
wlr_output_effective_resolution(scene_output->output,
wlr_output_effective_resolution(scene_output->output, NULL,
&box.width, &box.height);
scene_output_for_each_scene_buffer(&box, &scene_output->scene->tree.node, 0, 0,
iterator, user_data);

View file

@ -71,7 +71,7 @@ static void output_layout_output_get_box(
struct wlr_box *box) {
box->x = l_output->x;
box->y = l_output->y;
wlr_output_effective_resolution(l_output->output,
wlr_output_effective_resolution(l_output->output, NULL,
&box->width, &box->height);
}

View file

@ -584,7 +584,7 @@ static void capture_output(struct wl_client *wl_client,
buffer_box.height = output->height;
} else {
int ow, oh;
wlr_output_effective_resolution(output, &ow, &oh);
wlr_output_effective_resolution(output, NULL, &ow, &oh);
buffer_box = *box;

View file

@ -46,7 +46,7 @@ static void output_update(struct wlr_xdg_output_v1 *xdg_output) {
}
int width, height;
wlr_output_effective_resolution(layout_output->output, &width, &height);
wlr_output_effective_resolution(layout_output->output, NULL, &width, &height);
if (xdg_output->width != width || xdg_output->height != height) {
xdg_output->width = width;
xdg_output->height = height;