ReactOS  0.4.11-dev-721-g95bc44e
fttrigon.h File Reference

Go to the source code of this file.

Macros

#define FT_ANGLE_PI   ( 180L << 16 )
 
#define FT_ANGLE_2PI   ( FT_ANGLE_PI * 2 )
 
#define FT_ANGLE_PI2   ( FT_ANGLE_PI / 2 )
 
#define FT_ANGLE_PI4   ( FT_ANGLE_PI / 4 )
 

Functions

 FT_Sin (FT_Angle angle)
 
 FT_Cos (FT_Angle angle)
 
 FT_Tan (FT_Angle angle)
 
 FT_Atan2 (FT_Fixed x, FT_Fixed y)
 
 FT_Angle_Diff (FT_Angle angle1, FT_Angle angle2)
 
 FT_Vector_Unit (FT_Vector *vec, FT_Angle angle)
 
 FT_Vector_Rotate (FT_Vector *vec, FT_Angle angle)
 
 FT_Vector_Length (FT_Vector *vec)
 
 FT_Vector_Polarize (FT_Vector *vec, FT_Fixed *length, FT_Angle *angle)
 
 FT_Vector_From_Polar (FT_Vector *vec, FT_Fixed length, FT_Angle angle)
 

Variables

FT_BEGIN_HEADER typedef FT_Fixed FT_Angle
 

Macro Definition Documentation

#define FT_ANGLE_2PI   ( FT_ANGLE_PI * 2 )
#define FT_ANGLE_PI4   ( FT_ANGLE_PI / 4 )

Definition at line 100 of file fttrigon.h.

Referenced by ft_trig_pseudo_rotate().

Function Documentation

FT_Angle_Diff ( FT_Angle  angle1,
FT_Angle  angle2 
)

Definition at line 510 of file fttrigon.c.

Referenced by ft_angle_mean(), ft_conic_is_small_enough(), ft_cubic_is_small_enough(), ft_stroker_arcto(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), FT_Stroker_EndSubPath(), ft_stroker_inside(), ft_stroker_outside(), and ft_stroker_process_corner().

512  {
513  FT_Angle delta = angle2 - angle1;
514 
515 
516  while ( delta <= -FT_ANGLE_PI )
517  delta += FT_ANGLE_2PI;
518 
519  while ( delta > FT_ANGLE_PI )
520  delta -= FT_ANGLE_2PI;
521 
522  return delta;
523  }
#define FT_ANGLE_PI
Definition: fttrigon.h:64
FT_BEGIN_HEADER typedef FT_Fixed FT_Angle
Definition: fttrigon.h:52
#define FT_ANGLE_2PI
Definition: fttrigon.h:76
FT_Atan2 ( FT_Fixed  x,
FT_Fixed  y 
)

Definition at line 340 of file fttrigon.c.

Referenced by ft_conic_is_small_enough(), ft_cubic_is_small_enough(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), FT_Stroker_LineTo(), and test_atan2().

342  {
343  FT_Vector v;
344 
345 
346  if ( dx == 0 && dy == 0 )
347  return 0;
348 
349  v.x = dx;
350  v.y = dy;
351  ft_trig_prenorm( &v );
353 
354  return v.y;
355  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
static void ft_trig_pseudo_polarize(FT_Vector *vec)
Definition: fttrigon.c:219
static FT_Int ft_trig_prenorm(FT_Vector *vec)
Definition: fttrigon.c:134
const GLdouble * v
Definition: gl.h:2040
INT INT dy
Definition: msvc.h:65
INT dx
Definition: msvc.h:65
FT_Cos ( FT_Angle  angle)

Definition at line 298 of file fttrigon.c.

Referenced by ft_stroke_border_arcto(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), ft_stroker_inside(), ft_stroker_outside(), and test_cos().

299  {
300  FT_Vector v;
301 
302 
303  FT_Vector_Unit( &v, angle );
304 
305  return v.x;
306  }
FT_Pos x
Definition: ftimage.h:76
GLfloat angle
Definition: glext.h:10853
FT_Vector_Unit(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:361
const GLdouble * v
Definition: gl.h:2040
FT_Sin ( FT_Angle  angle)

Definition at line 312 of file fttrigon.c.

Referenced by ft_stroke_border_arcto(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), ft_stroker_outside(), and test_sin().

313  {
314  FT_Vector v;
315 
316 
317  FT_Vector_Unit( &v, angle );
318 
319  return v.y;
320  }
FT_Pos y
Definition: ftimage.h:77
GLfloat angle
Definition: glext.h:10853
FT_Vector_Unit(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:361
const GLdouble * v
Definition: gl.h:2040
FT_Tan ( FT_Angle  angle)

Definition at line 326 of file fttrigon.c.

Referenced by ft_stroker_inside(), and test_tan().

327  {
328  FT_Vector v;
329 
330 
331  FT_Vector_Unit( &v, angle );
332 
333  return FT_DivFix( v.y, v.x );
334  }
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
GLfloat angle
Definition: glext.h:10853
FT_Vector_Unit(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:361
const GLdouble * v
Definition: gl.h:2040
FT_Vector_From_Polar ( FT_Vector vec,
FT_Fixed  length,
FT_Angle  angle 
)

Definition at line 493 of file fttrigon.c.

Referenced by ft_stroke_border_arcto(), ft_stroker_cap(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), ft_stroker_inside(), FT_Stroker_LineTo(), ft_stroker_outside(), and ft_stroker_subpath_start().

496  {
497  if ( !vec )
498  return;
499 
500  vec->x = length;
501  vec->y = 0;
502 
503  FT_Vector_Rotate( vec, angle );
504  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
GLfloat angle
Definition: glext.h:10853
FT_Vector_Rotate(FT_Vector *vec, FT_Angle angle)
Definition: fttrigon.c:386
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
FT_Vector_Length ( FT_Vector vec)

Definition at line 426 of file fttrigon.c.

Referenced by FT_Hypot(), FT_Stroker_ConicTo(), FT_Stroker_CubicTo(), FT_Stroker_LineTo(), and test_length().

427  {
428  FT_Int shift;
429  FT_Vector v;
430 
431 
432  if ( !vec )
433  return 0;
434 
435  v = *vec;
436 
437  /* handle trivial cases */
438  if ( v.x == 0 )
439  {
440  return FT_ABS( v.y );
441  }
442  else if ( v.y == 0 )
443  {
444  return FT_ABS( v.x );
445  }
446 
447  /* general case */
448  shift = ft_trig_prenorm( &v );
450 
451  v.x = ft_trig_downscale( v.x );
452 
453  if ( shift > 0 )
454  return ( v.x + ( 1L << ( shift - 1 ) ) ) >> shift;
455 
456  return (FT_Fixed)( (FT_UInt32)v.x << -shift );
457  }
FT_Pos y
Definition: ftimage.h:77
#define shift
Definition: input.c:1668
FT_Pos x
Definition: ftimage.h:76
signed int FT_Int
Definition: fttypes.h:220
#define FT_ABS(a)
Definition: ftobjs.h:74
static void ft_trig_pseudo_polarize(FT_Vector *vec)
Definition: fttrigon.c:219
static FT_Fixed ft_trig_downscale(FT_Fixed val)
Definition: fttrigon.c:84
static FT_Int ft_trig_prenorm(FT_Vector *vec)
Definition: fttrigon.c:134
FT_Vector * vec
Definition: ftbbox.c:448
static const WCHAR L[]
Definition: oid.c:1087
signed long FT_Fixed
Definition: fttypes.h:288
const GLdouble * v
Definition: gl.h:2040
FT_Vector_Polarize ( FT_Vector vec,
FT_Fixed length,
FT_Angle angle 
)

Definition at line 463 of file fttrigon.c.

466  {
467  FT_Int shift;
468  FT_Vector v;
469 
470 
471  if ( !vec || !length || !angle )
472  return;
473 
474  v = *vec;
475 
476  if ( v.x == 0 && v.y == 0 )
477  return;
478 
479  shift = ft_trig_prenorm( &v );
481 
482  v.x = ft_trig_downscale( v.x );
483 
484  *length = shift >= 0 ? ( v.x >> shift )
485  : (FT_Fixed)( (FT_UInt32)v.x << -shift );
486  *angle = v.y;
487  }
FT_Pos y
Definition: ftimage.h:77
#define shift
Definition: input.c:1668
FT_Pos x
Definition: ftimage.h:76
signed int FT_Int
Definition: fttypes.h:220
static void ft_trig_pseudo_polarize(FT_Vector *vec)
Definition: fttrigon.c:219
static FT_Fixed ft_trig_downscale(FT_Fixed val)
Definition: fttrigon.c:84
GLfloat angle
Definition: glext.h:10853
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static FT_Int ft_trig_prenorm(FT_Vector *vec)
Definition: fttrigon.c:134
FT_Vector * vec
Definition: ftbbox.c:448
signed long FT_Fixed
Definition: fttypes.h:288
const GLdouble * v
Definition: gl.h:2040
FT_Vector_Rotate ( FT_Vector vec,
FT_Angle  angle 
)

Definition at line 386 of file fttrigon.c.

Referenced by FT_Vector_From_Polar(), and test_rotate().

388  {
389  FT_Int shift;
390  FT_Vector v;
391 
392 
393  if ( !vec || !angle )
394  return;
395 
396  v = *vec;
397 
398  if ( v.x == 0 && v.y == 0 )
399  return;
400 
401  shift = ft_trig_prenorm( &v );
403  v.x = ft_trig_downscale( v.x );
404  v.y = ft_trig_downscale( v.y );
405 
406  if ( shift > 0 )
407  {
408  FT_Int32 half = (FT_Int32)1L << ( shift - 1 );
409 
410 
411  vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
412  vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;
413  }
414  else
415  {
416  shift = -shift;
417  vec->x = (FT_Pos)( (FT_ULong)v.x << shift );
418  vec->y = (FT_Pos)( (FT_ULong)v.y << shift );
419  }
420  }
FT_Pos y
Definition: ftimage.h:77
#define shift
Definition: input.c:1668
unsigned long FT_ULong
Definition: fttypes.h:253
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
FT_Pos x
Definition: ftimage.h:76
signed int FT_Int
Definition: fttypes.h:220
static FT_Fixed ft_trig_downscale(FT_Fixed val)
Definition: fttrigon.c:84
GLfloat angle
Definition: glext.h:10853
static void ft_trig_pseudo_rotate(FT_Vector *vec, FT_Angle theta)
Definition: fttrigon.c:164
static FT_Int ft_trig_prenorm(FT_Vector *vec)
Definition: fttrigon.c:134
FT_Vector * vec
Definition: ftbbox.c:448
static const WCHAR L[]
Definition: oid.c:1087
const GLdouble * v
Definition: gl.h:2040
#define FT_SIGN_LONG(x)
Definition: fttrigon.c:377
FT_Vector_Unit ( FT_Vector vec,
FT_Angle  angle 
)

Definition at line 361 of file fttrigon.c.

Referenced by FT_Cos(), FT_Sin(), FT_Tan(), ftGdiGetGlyphOutline(), and test_unit().

363  {
364  if ( !vec )
365  return;
366 
367  vec->x = FT_TRIG_SCALE >> 8;
368  vec->y = 0;
370  vec->x = ( vec->x + 0x80L ) >> 8;
371  vec->y = ( vec->y + 0x80L ) >> 8;
372  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
#define FT_TRIG_SCALE
Definition: fttrigon.c:39
GLfloat angle
Definition: glext.h:10853
static void ft_trig_pseudo_rotate(FT_Vector *vec, FT_Angle theta)
Definition: fttrigon.c:164
static const WCHAR L[]
Definition: oid.c:1087

Variable Documentation