Implement ResetDC and PHYSICALOFFSET[X|Y] devcaps.
[wine] / dlls / quartz / amundoc.c
1 /*
2  * Copyright (C) Hidenori TAKESHIMA
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <math.h>
22 #include "windef.h"
23 #include "wine/obj_base.h"
24
25 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
27
28 #include "quartz_private.h"
29
30 /***********************************************************************
31  *              AmpFactorToDB (QUARTZ.@)
32  *
33  *      undocumented.
34  *  converting from Amp to dB?
35  *
36  */
37 LONG WINAPI QUARTZ_AmpFactorToDB( LONG amp )
38 {
39         LONG    dB;
40
41         TRACE( "(%ld)\n", amp );
42
43         if ( amp <= 0 || amp > 65536 )
44                 return 0;
45
46         dB = (LONG)(2000.0 * log10((double)amp / 65536.0) + 0.5);
47         if ( dB >= 0 ) dB = 0;
48         if ( dB < -10000 ) dB = -10000;
49
50         return dB;
51 }
52
53 /***********************************************************************
54  *              DBToAmpFactor (QUARTZ.@)
55  *
56  *      undocumented.
57  *  converting from dB to Amp?
58  */
59 LONG WINAPI QUARTZ_DBToAmpFactor( LONG dB )
60 {
61         LONG    amp;
62
63         TRACE( "(%ld)\n", dB );
64
65         if ( dB >= 0 )
66                 return 65535;
67         if ( dB < -10000 )
68                 return 0;
69
70         amp = (LONG)(pow(10.0,dB / 2000.0) * 65536.0 + 0.5);
71         if ( amp <= 0 ) amp = 1;
72         if ( amp >= 65536 ) amp = 65535;
73
74         return amp;
75 }
76