diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 47112384a..77b92040c 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1694,6 +1694,9 @@ fn prepKittyVirtualPlacement( return; }; + // If our placement is zero sized then we don't do anything. + if (rp.dest_width == 0 or rp.dest_height == 0) return; + const viewport: terminal.point.Point = t.screen.pages.pointFromPin( .viewport, rp.top_left, diff --git a/src/terminal/kitty/graphics_unicode.zig b/src/terminal/kitty/graphics_unicode.zig index 31e8fce55..2fc34b67e 100644 --- a/src/terminal/kitty/graphics_unicode.zig +++ b/src/terminal/kitty/graphics_unicode.zig @@ -293,6 +293,13 @@ pub const Placement = struct { width = img_scale_source.width * p_scale.x_scale; } + // If our modified source width/height is less than zero then + // we render nothing because it means we're rendering outside + // of the visible image. + if (img_scale_source.width <= 0 or img_scale_source.height <= 0) { + return .{ .top_left = self.pin }; + } + break :dest .{ .x_offset = x_offset * p_scale.x_scale, .y_offset = y_offset * p_scale.y_scale,