[MPlayer-dev-eng] [PATCH] Direct3D Smooth (delayed) resize

Georgi Petrov gogothebee at gmail.com
Tue Dec 9 11:05:45 CET 2008


I've developed a smooth resize patch when in slave mode (WinID >= 0).
The rationale is that currently (before the patch) resize_d3d() is
fired on each resize event, which happens many time per second when
the window is progressively being resized. This leads to many
destroy/create surfaces and Direct3DDevice resets, which translates
into skipped frames, no picture at all and general jerkiness. You can
test it with MPUI/SMPlayer.

My patch (active ONLY in slave mode) schedules a call to resize_d3d()
on each resize event. In render_d3d_frame() a check is performed and
if a resize event is scheduled and at least some time has passed since
the last resize event (it's a milliseconds #define), the resize is
performed. Multiple quick resize events just reset the timer (delay
the real resize).

What happens is that when the window is being resized, no
Direct3DDeviceReset is called immediately, but let's say 100ms after
the last window dimensions change. This enables very smooth resize of
both MPUI and SMplayer and once the user stops moving the window
border for 100ms (adjustable), the Reset occures and the user sees
just a quick "flash" when the new rendering context takes place. This
is not noticeable at all.

I've also changed StretchRect's error message (Unable to copy....)
from MSG_ERR to MSG_V, because this is not really an error (we handle
it) and it used to happen very often when resizing fast before this
patch (yet, after the patch I still assume that it may happen when
those 100ms have just passed, we call Reset again, but the user
decides to resize exactly at this very moment).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: smooth_resize.txt
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081209/899fd15c/attachment.txt>


More information about the MPlayer-dev-eng mailing list