~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/include/freetype/internal/ftcalc.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************/
 
2
/*                                                                         */
 
3
/*  ftcalc.h                                                               */
 
4
/*                                                                         */
 
5
/*    Arithmetic computations (specification).                             */
 
6
/*                                                                         */
 
7
/*  Copyright 1996-2001, 2002, 2003 by                                     */
 
8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 
9
/*                                                                         */
 
10
/*  This file is part of the FreeType project, and may only be used,       */
 
11
/*  modified, and distributed under the terms of the FreeType project      */
 
12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
 
13
/*  this file you indicate that you have read the license and              */
 
14
/*  understand and accept it fully.                                        */
 
15
/*                                                                         */
 
16
/***************************************************************************/
 
17
 
 
18
 
 
19
#ifndef __FTCALC_H__
 
20
#define __FTCALC_H__
 
21
 
 
22
 
 
23
#include <ft2build.h>
 
24
#include FT_FREETYPE_H
 
25
 
 
26
 
 
27
FT_BEGIN_HEADER
 
28
 
 
29
 
 
30
  FT_EXPORT( FT_Int32 )
 
31
  FT_SqrtFixed( FT_Int32  x );
 
32
 
 
33
 
 
34
#define SQRT_32( x )  FT_Sqrt32( x )
 
35
 
 
36
 
 
37
  /*************************************************************************/
 
38
  /*                                                                       */
 
39
  /* <Function>                                                            */
 
40
  /*    FT_Sqrt32                                                          */
 
41
  /*                                                                       */
 
42
  /* <Description>                                                         */
 
43
  /*    Computes the square root of an Int32 integer (which will be        */
 
44
  /*    handled as an unsigned long value).                                */
 
45
  /*                                                                       */
 
46
  /* <Input>                                                               */
 
47
  /*    x :: The value to compute the root for.                            */
 
48
  /*                                                                       */
 
49
  /* <Return>                                                              */
 
50
  /*    The result of `sqrt(x)'.                                           */
 
51
  /*                                                                       */
 
52
  FT_EXPORT( FT_Int32 )
 
53
  FT_Sqrt32( FT_Int32  x );
 
54
 
 
55
 
 
56
  /*************************************************************************/
 
57
  /*                                                                       */
 
58
  /* FT_MulDiv() and FT_MulFix() are declared in freetype.h.               */
 
59
  /*                                                                       */
 
60
  /*************************************************************************/
 
61
 
 
62
 
 
63
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
64
 
 
65
  /*************************************************************************/
 
66
  /*                                                                       */
 
67
  /* <Function>                                                            */
 
68
  /*    FT_MulDiv_No_Round                                                 */
 
69
  /*                                                                       */
 
70
  /* <Description>                                                         */
 
71
  /*    A very simple function used to perform the computation `(a*b)/c'   */
 
72
  /*    (without rounding) with maximal accuracy (it uses a 64-bit         */
 
73
  /*    intermediate integer whenever necessary).                          */
 
74
  /*                                                                       */
 
75
  /*    This function isn't necessarily as fast as some processor specific */
 
76
  /*    operations, but is at least completely portable.                   */
 
77
  /*                                                                       */
 
78
  /* <Input>                                                               */
 
79
  /*    a :: The first multiplier.                                         */
 
80
  /*    b :: The second multiplier.                                        */
 
81
  /*    c :: The divisor.                                                  */
 
82
  /*                                                                       */
 
83
  /* <Return>                                                              */
 
84
  /*    The result of `(a*b)/c'.  This function never traps when trying to */
 
85
  /*    divide by zero; it simply returns `MaxInt' or `MinInt' depending   */
 
86
  /*    on the signs of `a' and `b'.                                       */
 
87
  /*                                                                       */
 
88
  FT_BASE( FT_Long )
 
89
  FT_MulDiv_No_Round( FT_Long  a,
 
90
                      FT_Long  b,
 
91
                      FT_Long  c );
 
92
 
 
93
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
94
 
 
95
 
 
96
#define INT_TO_F26DOT6( x )    ( (FT_Long)(x) << 6  )
 
97
#define INT_TO_F2DOT14( x )    ( (FT_Long)(x) << 14 )
 
98
#define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )
 
99
#define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )
 
100
#define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )
 
101
 
 
102
#define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \
 
103
                                        : ( -( ( 32 - (x) ) & -64 ) ) )
 
104
 
 
105
 
 
106
FT_END_HEADER
 
107
 
 
108
#endif /* __FTCALC_H__ */
 
109
 
 
110
 
 
111
/* END */