On 02/16/2013 04:26 AM, Paul Gilbert wrote:
> Ah. I wasn't aware of that. I may be able to resolve this and the 
> dirty rects at the same time. The original engine code stores modified 
> rects, but I never used them, because they were passed into 
> SDL_UpdateRects; it was easier to ignore that and do direct screen 
> updates.
>
> If I read the situation right, we essentially need another off-screen 
> 'surface buffer' to use rather than the lock/unlockScreen calls. I can 
> then use the existing calculated dirty rect list to copy the affected 
> rects to screen with correct pitch, and help speed up rendering at the 
> same time.
>

If you use an off screen buffer, when you don't need to worry about the 
pitch of the Surface returned by lockScreen, since you will use 
copyRectToScreen to copy the contents to the screen. Using lockScreen 
with an extra off screen buffer would not help, since lockScreen marks 
the whole screen as dirty. At any rate I think we might also want to 
think about extending the lockScreen/unlockScreen API to allow for dirty 
rect information, this could save such additional off-screen buffers and 
additional memory copy operations.

For now I would suggest you just fix the code to use the correct pitch 
value.