Le 06/04/2012 12:35, Piotr Caban a écrit :
- /* Simulate a 60Hz display */
- time = GetTickCount();
- frame_progress = time& 15; /* time % (1000 / 60) */
- if (!frame_progress)
- {
*Scanline = 0;
return DDERR_VERTICALBLANKINPROGRESS;
- }
- /* convert frame_progress to estimated scan line */
- lines = mode.height / 15;
- *Scanline = (frame_progress - 1) * lines + time % lines; return DD_OK; }
Is time % lines here is to generate a random values (sort of noise) ?
On 04/06/12 13:33, Christian Costa wrote:
Le 06/04/2012 12:35, Piotr Caban a écrit :
- /* Simulate a 60Hz display */
- time = GetTickCount();
- frame_progress = time& 15; /* time % (1000 / 60) */
- if (!frame_progress)
- {
- *Scanline = 0;
- return DDERR_VERTICALBLANKINPROGRESS;
- }
- /* convert frame_progress to estimated scan line */
- lines = mode.height / 15;
- *Scanline = (frame_progress - 1) * lines + time % lines;
return DD_OK; }
Is time % lines here is to generate a random values (sort of noise) ?
Yes. It's mainly there to make the function return more then 16 different values. But it's not guarantying that all of the lines may be ever returned.
Le 06/04/2012 13:45, Piotr Caban a écrit :
On 04/06/12 13:33, Christian Costa wrote:
Le 06/04/2012 12:35, Piotr Caban a écrit :
- /* Simulate a 60Hz display */
- time = GetTickCount();
- frame_progress = time& 15; /* time % (1000 / 60) */
- if (!frame_progress)
- {
- *Scanline = 0;
- return DDERR_VERTICALBLANKINPROGRESS;
- }
- /* convert frame_progress to estimated scan line */
- lines = mode.height / 15;
- *Scanline = (frame_progress - 1) * lines + time % lines;
return DD_OK; }
Is time % lines here is to generate a random values (sort of noise) ?
Yes. It's mainly there to make the function return more then 16 different values. But it's not guarantying that all of the lines may be ever returned.
Ok. Thanks. It might worth adding a comment for that tough.