SubPolygon.h File Reference

A class for handling sub-polygons. Each sub-polygon is a continuos, closed set of edges. More...


Classes

class  PolygonEdge
 A polygon edge. More...
class  PolygonScanEdge
 A more optimized representation of a polygon edge. More...
class  VertexData
 A class for holding processing data regarding the vertex. More...
class  SubPolygon
 A class for handling sub-polygons. Each sub-polygon is a continuos, closed set of edges. More...

Defines

#define USE_ASM_OPTIMIZATIONS
#define CLIP_SUM_SHIFT   8
#define CLIP_UNION_SHIFT   4
#define SLOPE_FIX_SHIFT   8
#define SLOPE_FIX_STEP   (1 << SLOPE_FIX_SHIFT)
#define SLOPE_FIX_MASK   (SLOPE_FIX_STEP - 1)
#define SLOPE_FIX_SCANLINES   (1 << (SLOPE_FIX_SHIFT - SUBPIXEL_SHIFT))
#define SLOPE_FIX_SCANLINE_MASK   (SLOPE_FIX_SCANLINES - 1)

Enumerations

enum  POLYGON_CLIP_FLAGS {
  POLYGON_CLIP_NONE = 0x00, POLYGON_CLIP_LEFT = 0x01, POLYGON_CLIP_RIGHT = 0x02, POLYGON_CLIP_TOP = 0x04,
  POLYGON_CLIP_BOTTOM = 0x08
}

Functions

int rationalToIntRoundDown (RATIONAL a)
 Converts rational to int using direct asm.
int rationalToFixed (RATIONAL a)
 The rational to fixed conversion is implemented with asm for performance reasons.
void setRoundDownMode ()
 Sets the FPU round down mode to correct value for the asm conversion routines.


Detailed Description

A class for handling sub-polygons. Each sub-polygon is a continuos, closed set of edges.

Scanline edge-flag algorithm for antialiasing
Copyright (c) 2005-2007 Kiia Kallio

http://mlab.uiah.fi/~kkallio/antialiasing/

This code is distributed under the three-clause BSD license. Read the LICENSE file or visit the URL above for details.

Id
Date
Revision

Define Documentation

#define CLIP_SUM_SHIFT   8
 

#define CLIP_UNION_SHIFT   4
 

#define SLOPE_FIX_MASK   (SLOPE_FIX_STEP - 1)
 

#define SLOPE_FIX_SCANLINE_MASK   (SLOPE_FIX_SCANLINES - 1)
 

#define SLOPE_FIX_SCANLINES   (1 << (SLOPE_FIX_SHIFT - SUBPIXEL_SHIFT))
 

#define SLOPE_FIX_SHIFT   8
 

Fixed point math inevitably introduces rounding error to the DDA. The error is fixed every now and then by a separate fix value. The defines below set these.

#define SLOPE_FIX_STEP   (1 << SLOPE_FIX_SHIFT)
 

#define USE_ASM_OPTIMIZATIONS
 


Enumeration Type Documentation

enum POLYGON_CLIP_FLAGS
 

Enumerator:
POLYGON_CLIP_NONE 
POLYGON_CLIP_LEFT 
POLYGON_CLIP_RIGHT 
POLYGON_CLIP_TOP 
POLYGON_CLIP_BOTTOM 


Function Documentation

int rationalToFixed RATIONAL  a  )  [inline]
 

The rational to fixed conversion is implemented with asm for performance reasons.

int rationalToIntRoundDown RATIONAL  a  )  [inline]
 

Converts rational to int using direct asm.

Typical conversions using _ftol are slow on Pentium 4, as _ftol sets the control state of the fpu unit. Also, we need a special rounding operation that rounds down, not towards zero. Therefore we use asm here. This requires that the rounding mode is set to round down by calling _controlfp(_MCW_RC,_RC_DOWN). The state of the control mode is thread specific, so other applications won't mix with this.

void setRoundDownMode  )  [inline]
 

Sets the FPU round down mode to correct value for the asm conversion routines.


Generated on Fri Aug 3 00:44:32 2007 for Scanline edge-flag algorithm for antialiasing by  doxygen 1.4.6-NO