From 06bcbe868fb2597a79266128b72bd5fe0b17d6f7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 22 May 2024 15:40:31 -0400 Subject: [PATCH] renderer: kitty image with y offset should stretch image Fixes #1784 This was just a misunderstanding of the "spec." When both a y offset into the image is specified and a height, the image should be stretched. I mistakingly thought that the image should be offset (even with this misunderstanding there was a data corruption bug). This resolves the issue and output matches Kitty. --- src/renderer/Metal.zig | 2 +- src/renderer/OpenGL.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 591293783..9c692f34d 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1660,7 +1660,7 @@ fn prepKittyGraphics( const source_height = if (p.source_height > 0) @min(image.height, p.source_height) else - image.height -| offset_y; + image.height -| source_y; // Calculate the width/height of our image. const dest_width = if (p.columns > 0) p.columns * self.grid_metrics.cell_width else source_width; diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index 71803d49a..17274c4a3 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -850,7 +850,7 @@ fn prepKittyGraphics( const source_height = if (p.source_height > 0) @min(image.height, p.source_height) else - image.height -| offset_y; + image.height -| source_y; // Calculate the width/height of our image. const dest_width = if (p.columns > 0) p.columns * self.grid_metrics.cell_width else source_width;