annotate osdep/timer-win2.c @ 33534:22c3241467b3

Remove function Normalize(). This function changed ARGB data as if it had been RGB24 data (not quite correctly) converted to ARGB with all colors transparent. Instead now, set the alpha channel for RGB24 data and leave ARGB data untouched. For X11, the alpha channel is disregarded, so both approaches are equal, but the new one is more intelligible as we get correct ARGB PNG data. For legacy reasons, all kind of fuchsia/magenta must be treated as transparent, because some skins are using at least both full opaque and full transparent fuchsia/magenta for transparency.
author ib
date Thu, 16 Jun 2011 11:19:15 +0000
parents 1453fc56d49c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28744
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
1 /*
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
2 * precise timer routines for Windows
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
3 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
4 * This file is part of MPlayer.
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
5 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
7 * it under the terms of the GNU General Public License as published by
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
9 * (at your option) any later version.
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
10 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
14 * GNU General Public License for more details.
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
15 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
16 * You should have received a copy of the GNU General Public License along
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
5cfef41a1771 Add standard license headers to files.
diego
parents: 28234
diff changeset
19 */
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
20
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
21 #include <windows.h>
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
22 #include <mmsystem.h>
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
23 #include "timer.h"
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
24
31464
1453fc56d49c Change timer_name type from char* to char[]; patch taken from Uoti's tree.
diego
parents: 29263
diff changeset
25 const char timer_name[] = "Windows native";
12954
f9755d9c479a Native darwin timer update.
wight
parents: 11480
diff changeset
26
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
27 // Returns current time in microseconds
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
28 unsigned int GetTimer(void)
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
29 {
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
30 return timeGetTime() * 1000;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
31 }
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
32
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
33 // Returns current time in milliseconds
28234
8d6c3abed492 timer-win2.c: Fix "voi" (void) typo breaking Windows compilation
uau
parents: 28232
diff changeset
34 unsigned int GetTimerMS(void)
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
35 {
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
36 return timeGetTime() ;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
37 }
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
38
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
39 int usec_sleep(int usec_delay){
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28744
diff changeset
40 // Sleep(0) won't sleep for one clocktick as the unix usleep
11480
1d5205bab61a Sleep(0) != usleep(0), bugreport by Paul-Kenji Cahier
faust3
parents: 9983
diff changeset
41 // instead it will only make the thread ready
1d5205bab61a Sleep(0) != usleep(0), bugreport by Paul-Kenji Cahier
faust3
parents: 9983
diff changeset
42 // it may take some time until it actually starts to run again
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28744
diff changeset
43 if(usec_delay<1000)usec_delay=1000;
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
44 Sleep( usec_delay/1000);
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
45 return 0;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
46 }
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
47
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
48 static DWORD RelativeTime = 0;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
49
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
50 float GetRelativeTime(void)
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
51 {
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
52 DWORD t, r;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
53 t = GetTimer();
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
54 r = t - RelativeTime;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
55 RelativeTime = t;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
56 return (float) r *0.000001F;
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
57 }
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
58
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
59 void InitTimer(void)
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 12954
diff changeset
60 {
9983
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
61 GetRelativeTime();
14c92818ab75 alternative timer and glob emulation code for mingw32 port
faust3
parents:
diff changeset
62 }