From 64c9c7a4da2563e83c2394309163dd50ac16a30c Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 1 Feb 2023 20:42:39 +0000 Subject: [PATCH] Chess: Paint pieces using BilinearBlend instead of NearestNeighbor This makes the pieces look a lot nicer when the window isn't the exactly ideal size. Vector images might be worth pursuing later. --- Userland/Games/Chess/ChessWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index d16d318e09..9cab866254 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -84,7 +84,7 @@ void ChessWidget::paint_event(GUI::PaintEvent& event) if (!(m_dragging_piece && sq == m_moving_square)) { auto bmp = m_pieces.get(active_board.get_piece(sq)); if (bmp.has_value()) { - painter.draw_scaled_bitmap(tile_rect, *bmp.value(), bmp.value()->rect()); + painter.draw_scaled_bitmap(tile_rect, *bmp.value(), bmp.value()->rect(), 1.0f, Gfx::Painter::ScalingMode::BilinearBlend); } } @@ -169,7 +169,7 @@ void ChessWidget::paint_event(GUI::PaintEvent& event) auto bmp = m_pieces.get(active_board.get_piece(m_moving_square)); if (bmp.has_value()) { auto center = m_drag_point - Gfx::IntPoint(tile_width / 2, tile_height / 2); - painter.draw_scaled_bitmap({ center, { tile_width, tile_height } }, *bmp.value(), bmp.value()->rect()); + painter.draw_scaled_bitmap({ center, { tile_width, tile_height } }, *bmp.value(), bmp.value()->rect(), 1.0f, Gfx::Painter::ScalingMode::BilinearBlend); } } }