FS#1602 - blitters use _screen

Attached to Project: OpenTTD
Opened by Zdeněk Sojka (SmatZ) - Friday, 28 December 2007, 23:35 GMT
Last edited by Remko Bijker (Rubidium) - Sunday, 30 December 2007, 20:26 GMT
Type Bug
Category Core
Status Closed
Assigned To frosch (frosch)
Operating System All
Severity Low
Priority Normal
Reported Version 0.6.0-beta1
Due in Version 0.6.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Resulting in for example buggy giant screenshots in 8bpp mode and segfaults in 32bpp mode (Blitter::DrawRect uses _screen.pitch, that is different from encoder buffer pitch).
This task depends upon

Closed by  frosch (frosch)
Friday, 11 January 2008, 17:13 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r11813
Comment by frosch (frosch) - Tuesday, 08 January 2008, 16:24 GMT
The attached patch fixes this. But I am not really happy with it, perhaps someone has a better idea.

1) The bug applies to some more functions, not only DrawRect. So removing the usage of _screen.pitch does not seem to be a adequate solution. 32bpp-anim contains another related bug, that is also fixed.

2) The patch introduces a global variable _giant_screenshot, that is used in the 32bpp-anim blitter to turn off usage of the anim_buffer during giant screenshots. A alternative way would be the test, that gets removed in line 21 of the patch. But I dislike that one even more.

3) _screen.pitch is modified during the giant screenshot. Perhaps it would be nicer to also modify _screen.dst_ptr/.width/.height. That way _screen would remain more consistent, but the fields are only used, when drawing GUI elements, charts and the smallmap. And it would also disable the alternative way in 2).