jeanl
5th January 2006, 08:19
Guys
In the process of writing a simple function for DVDPreview (based on DVD2AVI) to simply erase the video with a black frame, I seem to have run into the limits of my feeble understanding of drawing modes in windows, especially as it relates to overlay surfaces (direct-draw) and the "invalidate rectangle" process.
More specifically I'm trying to understand better how video gets displayed, especially when the overlay buffer is used.
- Normal windows app refresh their displays as a response to the WM_PAINT message which is sent when part of the window needs to be refreshed (for example, because it was hidden and is now revealed). Right?
- Video display apps work differently because they need to refresh their display every time a new frame is displayed. In DVD2AVI this is done using IDirectDrawSurface_UpdateOverlay().
What I don't understand is this:
1) if I use FillRect() to black out the video (say, the left half of the video frame), subsequent calls to IDirectDrawSurface_UpdateOverlay() do not display anything in that left half, but the right half shows the normal video. Why is that?
2) Things only return to normal when I hide and reveal the entire window, or call InvalidateRect() on the entire rectangle. Why is that?
In short, I don't understand the interplay between FillRect(), UpdateOverlay() and the InvalidateRect() method.
A million thanks in advance to anybody who might be able to enlighten me on this tricky subject (tricky for me that is!)
Jeanl
In the process of writing a simple function for DVDPreview (based on DVD2AVI) to simply erase the video with a black frame, I seem to have run into the limits of my feeble understanding of drawing modes in windows, especially as it relates to overlay surfaces (direct-draw) and the "invalidate rectangle" process.
More specifically I'm trying to understand better how video gets displayed, especially when the overlay buffer is used.
- Normal windows app refresh their displays as a response to the WM_PAINT message which is sent when part of the window needs to be refreshed (for example, because it was hidden and is now revealed). Right?
- Video display apps work differently because they need to refresh their display every time a new frame is displayed. In DVD2AVI this is done using IDirectDrawSurface_UpdateOverlay().
What I don't understand is this:
1) if I use FillRect() to black out the video (say, the left half of the video frame), subsequent calls to IDirectDrawSurface_UpdateOverlay() do not display anything in that left half, but the right half shows the normal video. Why is that?
2) Things only return to normal when I hide and reveal the entire window, or call InvalidateRect() on the entire rectangle. Why is that?
In short, I don't understand the interplay between FillRect(), UpdateOverlay() and the InvalidateRect() method.
A million thanks in advance to anybody who might be able to enlighten me on this tricky subject (tricky for me that is!)
Jeanl