wlr_output: Make wlr_output_transformed_resolution take a state

This commit is contained in:
Alexander Orzechowski 2024-08-21 11:11:49 -04:00
parent f59706ecc0
commit c3b5e710f4
5 changed files with 21 additions and 15 deletions

View file

@ -89,8 +89,9 @@ static void output_cursor_get_box(struct wlr_output_cursor *cursor,
void wlr_output_add_software_cursors_to_render_pass(struct wlr_output *output,
struct wlr_render_pass *render_pass, const pixman_region32_t *damage) {
// TODO: pass output state from caller
int width, height;
wlr_output_transformed_resolution(output, &width, &height);
wlr_output_transformed_resolution(output, NULL, &width, &height);
struct wlr_output_cursor *cursor;
wl_list_for_each(cursor, &output->cursors, link) {
@ -158,7 +159,7 @@ static void output_cursor_reset(struct wlr_output_cursor *cursor) {
static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
struct wlr_box output_box;
output_box.x = output_box.y = 0;
wlr_output_transformed_resolution(cursor->output, &output_box.width,
wlr_output_transformed_resolution(cursor->output, NULL, &output_box.width,
&output_box.height);
struct wlr_box cursor_box;

View file

@ -441,19 +441,24 @@ void wlr_output_destroy(struct wlr_output *output) {
}
void wlr_output_transformed_resolution(struct wlr_output *output,
int *width, int *height) {
if (output->transform % 2 == 0) {
*width = output->width;
*height = output->height;
} else {
*width = output->height;
*height = output->width;
const struct wlr_output_state *state, int *width, int *height) {
output_pending_resolution(output, state, width, height);
enum wl_output_transform transform = output->transform;
if (state && state->committed & WLR_OUTPUT_STATE_TRANSFORM) {
transform = state->transform;
}
if (transform % 2 != 0) {
int tmp = *width;
*width = *height;
*height = tmp;
}
}
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height) {
wlr_output_transformed_resolution(output, width, height);
wlr_output_transformed_resolution(output, NULL, width, height);
*width /= output->scale;
*height /= output->scale;
}
@ -476,7 +481,7 @@ struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output) {
void output_pending_resolution(struct wlr_output *output,
const struct wlr_output_state *state, int *width, int *height) {
if (state->committed & WLR_OUTPUT_STATE_MODE) {
if (state && state->committed & WLR_OUTPUT_STATE_MODE) {
switch (state->mode_type) {
case WLR_OUTPUT_STATE_MODE_FIXED:
*width = state->mode->width;