Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

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

FS#13718 - The image_save library (rocklua) can't correctly save an image with an odd resolution.

the image save script apparently does not like odd numbers for width

local bytesleft = linebytes - (bytesperpixel * w )

this should actually be pxleft since the image loop below returns pixels not bytes

tested on 1 bit 2 bit, 16 bit and 32 bit images in sim

Change-Id: Ic186c095c29d318dcfb7d76b83e07c75f1460584

authored by

William Wilgus and committed by
Solomon Peachy
530cad0c 86f35f1b

+4 -3
+4 -3
apps/plugins/lua/include_lua/image_save.lua
··· 188 188 for i=1, #fbuffer do fbuffer[i] = _NIL end -- reuse table 189 189 190 190 local imgdata = fbuffer 191 - -- pad rows to a multiple of 4 bytes 192 - local bytesleft = linebytes - (bytesperpixel * w) 191 + -- pad rows to get even number of pixels 192 + local pxleft = (linebytes - (bytesperpixel * w)) / bytesperpixel 193 + 193 194 local t_data = {} 194 195 local fs_bytes_E = s_bytesLE -- default save in Little Endian 195 196 ··· 198 199 end 199 200 200 201 -- Bitmap lines start at bottom unless biHeight is negative 201 - for point in _points(img, 1, h, w + bytesleft, 1, 1, 1, true) do 202 + for point in _points(img, 1, h, w + pxleft, 1, 1, 1, true) do 202 203 imgdata[#imgdata + 1] = fs_bytes_E(bpp, point or 0) 203 204 204 205 if #fbuffer >= 31 then -- buffered write, increase # for performance