Screenshots distorted if width not multiple of 4
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Armagetron Advanced |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
See http://
OpenGL's GL_PACK_ALIGNMENT is set to 4. OpenGL will add 0-3 bytes at the end of each row to make a multiple of 4. The SDL surface uses the same logic, and reveals the number of bytes per row in its pitch field. The bug is that Armagetron assumes there are always 3*width bytes per row, which isn't true if width isn't a multiple of 4 (most commonly seen on 1366x768 displays). It should use the surface's pitch value instead.
In make_screenshot (rSysdep.cpp), this code is wrong:
* sr_screenWidth*
It should be:
+ image->
Likewise, in SDL_SavePNG (also rSysdep.cpp):
row_ptrs[i] = (png_byte *)image->pixels + (sr_screenHeight - i - 1)
It should be:
row_ptrs[i] = (png_byte *)image->pixels + (sr_screenHeight - i - 1)
The bug has always existed. Verified 0.2.8, 0.4, trunk.
Changed in armagetronad: | |
status: | Confirmed → Fix Committed |
Cant reproduce as i cant set my screen width to a value not multiple of 4.