commit 2e951163c5a5f24fe9cf7ee348e56b09719a99a9
parent 23389ebd1f301403e4b2331855a224dff89e1ad1
Author: Alexander Orzechowski <alex@ozal.ski>
Date: Thu, 7 Mar 2024 18:03:40 -0500
Force bilinear scaling when scaling down
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
@@ -183,7 +183,15 @@ static void send_frame_done_iterator(struct wlr_scene_buffer *buffer,
}
}
-static enum wlr_scale_filter_mode get_scale_filter(struct sway_output *output) {
+static enum wlr_scale_filter_mode get_scale_filter(struct sway_output *output,
+ struct wlr_scene_buffer *buffer) {
+ // if we are scaling down, we should always choose linear
+ if (buffer->dst_width > 0 && buffer->dst_height > 0 && (
+ buffer->dst_width < buffer->buffer_width ||
+ buffer->dst_height < buffer->buffer_height)) {
+ return WLR_SCALE_FILTER_BILINEAR;
+ }
+
switch (output->scale_filter) {
case SCALE_FILTER_LINEAR:
return WLR_SCALE_FILTER_BILINEAR;
@@ -212,7 +220,7 @@ static void output_configure_scene(struct sway_output *output,
// hack: don't call the scene setter because that will damage all outputs
// We don't want to damage outputs that aren't our current output that
// we're configuring
- buffer->filter_mode = get_scale_filter(output);
+ buffer->filter_mode = get_scale_filter(output, buffer);
wlr_scene_buffer_set_opacity(buffer, opacity);
} else if (node->type == WLR_SCENE_NODE_TREE) {