this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix stale reference bug when converting images

authored by

Rob9315 and committed by
Tim Culverhouse
622d245b 75035b16

+7 -5
+7 -5
src/Vaxis.zig
··· 1013 1013 self: *Vaxis, 1014 1014 alloc: std.mem.Allocator, 1015 1015 tty: *IoWriter, 1016 - img: *zigimg.Image, 1016 + img: *const zigimg.Image, 1017 1017 format: Image.TransmitFormat, 1018 1018 ) !Image { 1019 1019 if (!self.caps.kitty_graphics) return error.NoGraphicsCapability; ··· 1021 1021 var arena = std.heap.ArenaAllocator.init(alloc); 1022 1022 defer arena.deinit(); 1023 1023 1024 + var img_modifiable = img.*; 1025 + 1024 1026 const buf = switch (format) { 1025 1027 .png => png: { 1026 1028 const png_buf = try arena.allocator().alloc(u8, img.imageByteSize()); ··· 1028 1030 break :png png; 1029 1031 }, 1030 1032 .rgb => rgb: { 1031 - try img.convert(arena.allocator(), .rgb24); 1032 - break :rgb img.rawBytes(); 1033 + try img_modifiable.convertNoFree(arena.allocator(), .rgb24); 1034 + break :rgb img_modifiable.rawBytes(); 1033 1035 }, 1034 1036 .rgba => rgba: { 1035 - try img.convert(arena.allocator(), .rgba32); 1036 - break :rgba img.rawBytes(); 1037 + try img_modifiable.convertNoFree(arena.allocator(), .rgba32); 1038 + break :rgba img_modifiable.rawBytes(); 1037 1039 }, 1038 1040 }; 1039 1041