Here are my changes:
- User_add_dirty_rect is now an asynchronous equivalent of
User_copy_to_screen. It adds the rectangle to the list of dirty rectangles
and signal the update thread that there is some work to do.
- update thread calls User_get_dirty_rect to iterate over the list of dirty
rectangles
- current "naïve" algoritm keeps only one rectangle which is a union of all
dirty rectangles, so it tends to redraw too much, but better algoritms may be
implemented
- removed now unused lastlockrect variable, and the code which updates it
I attached the patch for your reviews, comments, suggestions.
The only comment I have on the patch is that you are using the rectangle
from the 'User_DirectDrawSurface_unlock_update' code. The big problem here
is that for old DirectX versions (versions 1 to 3), the lock rectangle was
not repeated in the Unlock call (it was only present in the Lock code).
So, basically, you will always force a full redraw for these old DirectX
versions. So, the best would be to add the dirty rectangles in the Lock
calls (if we are not in READONLY mode).
A part from that, the patch looks nice.
Same comments as in my other mails about contributors :-)
Lionel
PS: all these dirty region handling should be factorized as I did the same
kind of hacks in the D3D code to speed up transfer between 2D and 3D
buffers.
--
Lionel Ulmer -
http://www.bbrox.org/