• Robert Sprowson's avatar
    Fix two bugs causing aborts on corner cases. · d801c60e
    Robert Sprowson authored
    1 pixel wide JPEGs:
    The diffuse dithering code considers all lines as 1-N-1 where N can be zero and the first and last pixel are dealt with specially because there's no data to scatter beyond the edge.
    With a 1 pixel wide JPEG the dithering code ended up with a -ve number in the X counter and wandered off the end of memory. Fix just moves a SUB up a few lines and turns it into a SUBS so that the 1 wide case becomes 0-N-1 with N=0.
    1 pixel high sprites:
    With output switched to a 1 pixel high sprite an abort would quickly follow because the read of mode variables had a backdoor check to workaround a bug in RISC OS 2.00 which returned a duff value for YWindLimit in MODE 22. As the definition of MODE 22 got changed to 768x288 in RISC OS 3.xx (and the YWindLimit bug fixed) this code now just falsely reported a 1 pixel high sprite as being 1024 high and the blitter splattered all over memory it shouldn't.
    Result:
    Loss of RISC OS 2.00 compatibility, but can now load JPEGs of Xx1 or 1xY and even 1x1.
    
    Version 1.25. Tagged as 'SprExtend-1_25'
    d801c60e
SWIs 40.7 KB