3
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors: Juha Kauppinen, Mika Hokkanen
|
|
13 |
*
|
|
14 |
* Description: Photo Browser
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
//------------------------------
|
|
19 |
#ifndef FIXED_MATH_H_
|
|
20 |
#define FIXED_MATH_H_
|
|
21 |
//------------------------------
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <e32math.h>
|
|
27 |
#include <GLES/gl.h>
|
|
28 |
|
|
29 |
// FUNCTIONS
|
|
30 |
|
|
31 |
inline GLfixed IntToFixed (GLint aValue)
|
|
32 |
{ return aValue << 16; }
|
|
33 |
|
|
34 |
|
|
35 |
inline GLfixed FloatToFixed (GLfloat aValue)
|
|
36 |
{ return (GLfixed) (aValue * 65536.0f); }
|
|
37 |
|
|
38 |
|
|
39 |
inline GLint FixedToInt (GLfixed aValue)
|
|
40 |
{ return aValue >> 16; }
|
|
41 |
|
|
42 |
|
|
43 |
inline GLfloat FixedToFloat (GLfixed aValue)
|
|
44 |
{ return (GLfloat) (aValue * (1 / 65536.0f)); }
|
|
45 |
|
|
46 |
|
|
47 |
inline GLfixed MultiplyFixed (GLfixed op1, GLfixed op2)
|
|
48 |
{
|
|
49 |
TInt64 r = (TInt64)op1 * (TInt64)op2;
|
|
50 |
return (GLfixed) (r >> 16);
|
|
51 |
}
|
|
52 |
|
|
53 |
|
|
54 |
//------------------------------
|
|
55 |
#endif
|