ReactOS  0.4.14-dev-854-gb9426a3
ftgrays.c File Reference
#include <ft2build.h>
#include "ftgrays.h"
#include "ftsmerrs.h"
#include "ftspic.h"
Include dependency graph for ftgrays.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TCell_
 
struct  TPixmap_
 
struct  gray_TWorker_
 
struct  gray_TRaster_
 

Macros

#define FT_COMPONENT   trace_smooth
 
#define Smooth_Err_Invalid_Mode   Smooth_Err_Cannot_Render_Glyph
 
#define Smooth_Err_Memory_Overflow   Smooth_Err_Out_Of_Memory
 
#define ErrRaster_Memory_Overflow   Smooth_Err_Out_Of_Memory
 
#define FT_MEM_SET(d, s, c)   ft_memset( d, s, c )
 
#define FT_MEM_ZERO(dest, count)   FT_MEM_SET( dest, 0, count )
 
#define FT_ZERO(p)   FT_MEM_ZERO( p, sizeof ( *(p) ) )
 
#define RAS_ARG   gray_PWorker worker
 
#define RAS_ARG_   gray_PWorker worker,
 
#define RAS_VAR   worker
 
#define RAS_VAR_   worker,
 
#define PIXEL_BITS   8
 
#define ONE_PIXEL   ( 1 << PIXEL_BITS )
 
#define TRUNC(x)   ( (TCoord)( (x) >> PIXEL_BITS ) )
 
#define SUBPIXELS(x)   ( (TPos)(x) * ONE_PIXEL )
 
#define FLOOR(x)   ( (x) & -ONE_PIXEL )
 
#define CEILING(x)   ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
 
#define ROUND(x)   ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
 
#define UPSCALE(x)   ( (x) * ( ONE_PIXEL >> 6 ) )
 
#define DOWNSCALE(x)   ( (x) >> ( PIXEL_BITS - 6 ) )
 
#define FT_DIV_MOD(type, dividend, divisor, quotient, remainder)
 
#define FT_UDIVPREP(c, b)
 
#define FT_UDIV(a, b)
 
#define FT_MAX_GRAY_POOL   ( 2048 / sizeof ( TCell ) )
 
#define ras   (*worker)
 

Typedefs

typedef long TPos
 
typedef int TCoord
 
typedef int TArea
 
typedef struct TCell_PCell
 
typedef struct TCell_ TCell
 
typedef struct TPixmap_ TPixmap
 
typedef struct gray_TWorker_ gray_TWorker
 
typedef struct gray_TWorker_gray_PWorker
 
typedef struct gray_TRaster_ gray_TRaster
 
typedef struct gray_TRaster_gray_PRaster
 

Functions

static void gray_record_cell (RAS_ARG)
 
static void gray_set_cell (RAS_ARG_ TCoord ex, TCoord ey)
 
static void gray_render_scanline (RAS_ARG_ TCoord ey, TPos x1, TCoord y1, TPos x2, TCoord y2)
 
static void gray_render_line (RAS_ARG_ TPos to_x, TPos to_y)
 
static void gray_split_conic (FT_Vector *base)
 
static void gray_render_conic (RAS_ARG_ const FT_Vector *control, const FT_Vector *to)
 
static void gray_split_cubic (FT_Vector *base)
 
static void gray_render_cubic (RAS_ARG_ const FT_Vector *control1, const FT_Vector *control2, const FT_Vector *to)
 
static int gray_move_to (const FT_Vector *to, gray_PWorker worker)
 
static int gray_line_to (const FT_Vector *to, gray_PWorker worker)
 
static int gray_conic_to (const FT_Vector *control, const FT_Vector *to, gray_PWorker worker)
 
static int gray_cubic_to (const FT_Vector *control1, const FT_Vector *control2, const FT_Vector *to, gray_PWorker worker)
 
static void gray_hline (RAS_ARG_ TCoord x, TCoord y, TArea coverage, TCoord acount)
 
static void gray_sweep (RAS_ARG)
 
 FT_DEFINE_OUTLINE_FUNCS (func_interface,(FT_Outline_MoveTo_Func) gray_move_to,(FT_Outline_LineTo_Func) gray_line_to,(FT_Outline_ConicTo_Func) gray_conic_to,(FT_Outline_CubicTo_Func) gray_cubic_to, 0, 0) static int gray_convert_glyph_inner(RAS_ARG)
 
static int gray_convert_glyph (RAS_ARG)
 
static int gray_raster_render (FT_Raster raster, const FT_Raster_Params *params)
 
static int gray_raster_new (FT_Memory memory, FT_Raster *araster)
 
static void gray_raster_done (FT_Raster raster)
 
static void gray_raster_reset (FT_Raster raster, unsigned char *pool_base, unsigned long pool_size)
 
static int gray_raster_set_mode (FT_Raster raster, unsigned long mode, void *args)
 

Macro Definition Documentation

◆ CEILING

#define CEILING (   x)    ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )

Definition at line 341 of file ftgrays.c.

◆ DOWNSCALE

#define DOWNSCALE (   x)    ( (x) >> ( PIXEL_BITS - 6 ) )

Definition at line 346 of file ftgrays.c.

◆ ErrRaster_Memory_Overflow

#define ErrRaster_Memory_Overflow   Smooth_Err_Out_Of_Memory

Definition at line 286 of file ftgrays.c.

◆ FLOOR

#define FLOOR (   x)    ( (x) & -ONE_PIXEL )

Definition at line 340 of file ftgrays.c.

◆ FT_COMPONENT

#define FT_COMPONENT   trace_smooth

Definition at line 91 of file ftgrays.c.

◆ FT_DIV_MOD

#define FT_DIV_MOD (   type,
  dividend,
  divisor,
  quotient,
  remainder 
)
Value:
(quotient) = (type)( (dividend) / (divisor) ); \
(remainder) = (type)( (dividend) % (divisor) ); \
if ( (remainder) < 0 ) \
{ \
(quotient)--; \
(remainder) += (type)(divisor); \
} \
FT_END_STMNT
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
double __cdecl remainder(double, double)
#define FT_BEGIN_STMNT
Definition: ftconfig.h:352
GLuint divisor
Definition: glext.h:6313

Definition at line 357 of file ftgrays.c.

◆ FT_MAX_GRAY_POOL

#define FT_MAX_GRAY_POOL   ( 2048 / sizeof ( TCell ) )

Definition at line 434 of file ftgrays.c.

◆ FT_MEM_SET

#define FT_MEM_SET (   d,
  s,
  c 
)    ft_memset( d, s, c )

Definition at line 293 of file ftgrays.c.

◆ FT_MEM_ZERO

#define FT_MEM_ZERO (   dest,
  count 
)    FT_MEM_SET( dest, 0, count )

Definition at line 297 of file ftgrays.c.

◆ FT_UDIV

#define FT_UDIV (   a,
  b 
)
Value:
( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \
( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
#define PIXEL_BITS
Definition: ftgrays.c:330
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define FT_CHAR_BIT
Definition: ftconfig.h:70
#define long
Definition: qsort.c:33
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Definition at line 393 of file ftgrays.c.

◆ FT_UDIVPREP

#define FT_UDIVPREP (   c,
  b 
)
Value:
long b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \
: 0
#define FT_ULONG_MAX
Definition: ftstdlib.h:68
#define PIXEL_BITS
Definition: ftgrays.c:330
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLubyte * c
Definition: glext.h:8905
#define long
Definition: qsort.c:33

Definition at line 390 of file ftgrays.c.

◆ FT_ZERO

#define FT_ZERO (   p)    FT_MEM_ZERO( p, sizeof ( *(p) ) )

Definition at line 301 of file ftgrays.c.

◆ ONE_PIXEL

#define ONE_PIXEL   ( 1 << PIXEL_BITS )

Definition at line 337 of file ftgrays.c.

◆ PIXEL_BITS

#define PIXEL_BITS   8

Definition at line 330 of file ftgrays.c.

◆ ras

#define ras   (*worker)

Definition at line 479 of file ftgrays.c.

◆ RAS_ARG

#define RAS_ARG   gray_PWorker worker

Definition at line 313 of file ftgrays.c.

◆ RAS_ARG_

#define RAS_ARG_   gray_PWorker worker,

Definition at line 314 of file ftgrays.c.

◆ RAS_VAR

#define RAS_VAR   worker

Definition at line 316 of file ftgrays.c.

◆ RAS_VAR_

#define RAS_VAR_   worker,

Definition at line 317 of file ftgrays.c.

◆ ROUND

#define ROUND (   x)    ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )

Definition at line 342 of file ftgrays.c.

◆ Smooth_Err_Invalid_Mode

#define Smooth_Err_Invalid_Mode   Smooth_Err_Cannot_Render_Glyph

Definition at line 284 of file ftgrays.c.

◆ Smooth_Err_Memory_Overflow

#define Smooth_Err_Memory_Overflow   Smooth_Err_Out_Of_Memory

Definition at line 285 of file ftgrays.c.

◆ SUBPIXELS

#define SUBPIXELS (   x)    ( (TPos)(x) * ONE_PIXEL )

Definition at line 339 of file ftgrays.c.

◆ TRUNC

#define TRUNC (   x)    ( (TCoord)( (x) >> PIXEL_BITS ) )

Definition at line 338 of file ftgrays.c.

◆ UPSCALE

#define UPSCALE (   x)    ( (x) * ( ONE_PIXEL >> 6 ) )

Definition at line 345 of file ftgrays.c.

Typedef Documentation

◆ gray_PRaster

◆ gray_PWorker

◆ gray_TRaster

◆ gray_TWorker

◆ PCell

typedef struct TCell_* PCell

Definition at line 412 of file ftgrays.c.

◆ TArea

typedef int TArea

Definition at line 409 of file ftgrays.c.

◆ TCell

typedef struct TCell_ TCell

◆ TCoord

typedef int TCoord

Definition at line 408 of file ftgrays.c.

◆ TPixmap

◆ TPos

typedef long TPos

Definition at line 407 of file ftgrays.c.

Function Documentation

◆ FT_DEFINE_OUTLINE_FUNCS()

FT_DEFINE_OUTLINE_FUNCS ( func_interface  ,
(FT_Outline_MoveTo_Func gray_move_to,
(FT_Outline_LineTo_Func gray_line_to,
(FT_Outline_ConicTo_Func gray_conic_to,
(FT_Outline_CubicTo_Func gray_cubic_to,
,
 
)

Definition at line 1691 of file ftgrays.c.

1706  {
1707 
1708  volatile int error = 0;
1709 
1710 #ifdef FT_CONFIG_OPTION_PIC
1711  FT_Outline_Funcs func_interface;
1712  Init_Class_func_interface(&func_interface);
1713 #endif
1714 
1715  if ( ft_setjmp( ras.jump_buffer ) == 0 )
1716  {
1717  error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
1718  if ( !ras.invalid )
1720 
1721  FT_TRACE7(( "band [%d..%d]: %d cell%s\n",
1722  ras.min_ey,
1723  ras.max_ey,
1724  ras.num_cells,
1725  ras.num_cells == 1 ? "" : "s" ));
1726  }
1727  else
1728  {
1729  error = FT_THROW( Memory_Overflow );
1730 
1731  FT_TRACE7(( "band [%d..%d]: to be bisected\n",
1732  ras.min_ey, ras.max_ey ));
1733  }
1734 
1735  return error;
1736  }
#define error(str)
Definition: mkdosfs.c:1605
#define FT_THROW(e)
Definition: ftdebug.h:213
#define ft_setjmp(b)
Definition: ftstdlib.h:163
#define FT_TRACE7(varformat)
Definition: ftdebug.h:164
FT_BEGIN_HEADER FT_Outline_Decompose(FT_Outline *outline, const FT_Outline_Funcs *func_interface, void *user)
Definition: ftoutln.c:51
static void gray_record_cell(RAS_ARG)
Definition: ftgrays.c:524
#define ras
Definition: ftgrays.c:479
#define RAS_VAR
Definition: ftgrays.c:316

◆ gray_conic_to()

static int gray_conic_to ( const FT_Vector control,
const FT_Vector to,
gray_PWorker  worker 
)
static

Definition at line 1213 of file ftgrays.c.

1216  {
1217  gray_render_conic( RAS_VAR_ control, to );
1218  return 0;
1219  }
#define RAS_VAR_
Definition: ftgrays.c:317
static void gray_render_conic(RAS_ARG_ const FT_Vector *control, const FT_Vector *to)
Definition: ftgrays.c:998

◆ gray_convert_glyph()

static int gray_convert_glyph ( RAS_ARG  )
static

Definition at line 1740 of file ftgrays.c.

1741  {
1742  const TCoord yMin = ras.min_ey;
1743  const TCoord yMax = ras.max_ey;
1744  const TCoord xMin = ras.min_ex;
1745  const TCoord xMax = ras.max_ex;
1746 
1747 #ifdef __REACTOS__
1748  TCell *buffer;
1749 #else
1751 #endif
1752  size_t height = (size_t)( yMax - yMin );
1753  size_t n = FT_MAX_GRAY_POOL / 8;
1754  TCoord y;
1755  TCoord bands[32]; /* enough to accommodate bisections */
1756  TCoord* band;
1757 
1758 #ifdef __REACTOS__
1760  if (!buffer)
1761  {
1762  return 1;
1763  }
1764 #endif
1765 
1766  /* set up vertical bands */
1767  if ( height > n )
1768  {
1769  /* two divisions rounded up */
1770  n = ( height + n - 1 ) / n;
1771  height = ( height + n - 1 ) / n;
1772  }
1773 
1774  /* memory management */
1775  n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell );
1776 
1777  ras.cells = buffer + n;
1778  ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n );
1779  ras.ycells = (PCell*)buffer;
1780 
1781  for ( y = yMin; y < yMax; )
1782  {
1783  ras.min_ey = y;
1784  y += height;
1785  ras.max_ey = FT_MIN( y, yMax );
1786 
1787  band = bands;
1788  band[1] = xMin;
1789  band[0] = xMax;
1790 
1791  do
1792  {
1793  TCoord width = band[0] - band[1];
1794  int error;
1795 
1796 
1797  FT_MEM_ZERO( ras.ycells, height * sizeof ( PCell ) );
1798 
1799  ras.num_cells = 0;
1800  ras.invalid = 1;
1801  ras.min_ex = band[1];
1802  ras.max_ex = band[0];
1803 
1804  error = gray_convert_glyph_inner( RAS_VAR );
1805 
1806  if ( !error )
1807  {
1808  gray_sweep( RAS_VAR );
1809  band--;
1810  continue;
1811  }
1812  else if ( error != ErrRaster_Memory_Overflow )
1813  {
1814 #ifdef __REACTOS__
1815  free(buffer);
1816 #endif
1817  return 1;
1818  }
1819 
1820  /* render pool overflow; we will reduce the render band by half */
1821  width >>= 1;
1822 
1823  /* this should never happen even with tiny rendering pool */
1824  if ( width == 0 )
1825  {
1826  FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
1827 #ifdef __REACTOS__
1828  free(buffer);
1829 #endif
1830  return 1;
1831  }
1832 
1833  band++;
1834  band[1] = band[0];
1835  band[0] += width;
1836  } while ( band >= bands );
1837  }
1838 
1839 #ifdef __REACTOS__
1840  free(buffer);
1841 #endif
1842 
1843  return 0;
1844  }
GLint GLint GLsizei width
Definition: gl.h:1546
ft_ptrdiff_t FT_PtrDist
Definition: fttypes.h:337
static void gray_sweep(RAS_ARG)
Definition: ftgrays.c:1298
#define error(str)
Definition: mkdosfs.c:1605
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define free
Definition: debug_ros.c:5
GLdouble n
Definition: glext.h:7729
#define FT_MIN(a, b)
Definition: ftobjs.h:71
GLuint buffer
Definition: glext.h:5915
struct TCell_ * PCell
Definition: ftgrays.c:412
int TCoord
Definition: ftgrays.c:408
#define FT_MAX_GRAY_POOL
Definition: ftgrays.c:434
__kernel_size_t size_t
Definition: linux.h:237
#define ErrRaster_Memory_Overflow
Definition: ftgrays.c:286
#define FT_MAX(a, b)
Definition: ftobjs.h:72
#define FT_TRACE7(varformat)
Definition: ftdebug.h:164
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define FT_RENDER_POOL_SIZE
Definition: ftoption.h:366
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define malloc
Definition: debug_ros.c:4
#define ras
Definition: ftgrays.c:479
#define RAS_VAR
Definition: ftgrays.c:316
#define FT_MEM_ZERO(dest, count)
Definition: ftgrays.c:297

Referenced by gray_raster_render().

◆ gray_cubic_to()

static int gray_cubic_to ( const FT_Vector control1,
const FT_Vector control2,
const FT_Vector to,
gray_PWorker  worker 
)
static

Definition at line 1223 of file ftgrays.c.

1227  {
1228  gray_render_cubic( RAS_VAR_ control1, control2, to );
1229  return 0;
1230  }
#define RAS_VAR_
Definition: ftgrays.c:317
static void gray_render_cubic(RAS_ARG_ const FT_Vector *control1, const FT_Vector *control2, const FT_Vector *to)
Definition: ftgrays.c:1091

◆ gray_hline()

static void gray_hline ( RAS_ARG_ TCoord  x,
TCoord  y,
TArea  coverage,
TCoord  acount 
)
static

Definition at line 1234 of file ftgrays.c.

1238  {
1239  /* scale the coverage from 0..(ONE_PIXEL*ONE_PIXEL*2) to 0..256 */
1240  coverage >>= PIXEL_BITS * 2 + 1 - 8;
1241  if ( coverage < 0 )
1242  coverage = -coverage - 1;
1243 
1244  /* compute the line's coverage depending on the outline fill rule */
1245  if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL )
1246  {
1247  coverage &= 511;
1248 
1249  if ( coverage >= 256 )
1250  coverage = 511 - coverage;
1251  }
1252  else
1253  {
1254  /* normal non-zero winding rule */
1255  if ( coverage >= 256 )
1256  coverage = 255;
1257  }
1258 
1259  if ( ras.render_span ) /* for FT_RASTER_FLAG_DIRECT only */
1260  {
1261  FT_Span span;
1262 
1263 
1264  span.x = (short)x;
1265  span.len = (unsigned short)acount;
1266  span.coverage = (unsigned char)coverage;
1267 
1268  ras.render_span( y, 1, &span, ras.render_span_data );
1269  }
1270  else
1271  {
1272  unsigned char* q = ras.target.origin - ras.target.pitch * y + x;
1273  unsigned char c = (unsigned char)coverage;
1274 
1275 
1276  /* For small-spans it is faster to do it by ourselves than
1277  * calling `memset'. This is mainly due to the cost of the
1278  * function call.
1279  */
1280  switch ( acount )
1281  {
1282  case 7: *q++ = c;
1283  case 6: *q++ = c;
1284  case 5: *q++ = c;
1285  case 4: *q++ = c;
1286  case 3: *q++ = c;
1287  case 2: *q++ = c;
1288  case 1: *q = c;
1289  case 0: break;
1290  default:
1291  FT_MEM_SET( q, c, acount );
1292  }
1293  }
1294  }
#define PIXEL_BITS
Definition: ftgrays.c:330
#define FT_MEM_SET(d, s, c)
Definition: ftgrays.c:293
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define FT_OUTLINE_EVEN_ODD_FILL
Definition: ftimage.h:429
unsigned char
Definition: typeof.h:29
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define c
Definition: ke_i.h:80
GLenum GLenum GLvoid GLvoid GLvoid * span
Definition: glext.h:5664
#define ras
Definition: ftgrays.c:479

Referenced by gray_sweep().

◆ gray_line_to()

static int gray_line_to ( const FT_Vector to,
gray_PWorker  worker 
)
static

Definition at line 1204 of file ftgrays.c.

1206  {
1207  gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) );
1208  return 0;
1209  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
#define RAS_VAR_
Definition: ftgrays.c:317
#define UPSCALE(x)
Definition: ftgrays.c:345
static void gray_render_line(RAS_ARG_ TPos to_x, TPos to_y)
Definition: ftgrays.c:704

◆ gray_move_to()

static int gray_move_to ( const FT_Vector to,
gray_PWorker  worker 
)
static

Definition at line 1185 of file ftgrays.c.

1187  {
1188  TPos x, y;
1189 
1190 
1191  /* start to a new position */
1192  x = UPSCALE( to->x );
1193  y = UPSCALE( to->y );
1194 
1195  gray_set_cell( RAS_VAR_ TRUNC( x ), TRUNC( y ) );
1196 
1197  ras.x = x;
1198  ras.y = y;
1199  return 0;
1200  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
long TPos
Definition: ftgrays.c:407
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define RAS_VAR_
Definition: ftgrays.c:317
#define UPSCALE(x)
Definition: ftgrays.c:345
static void gray_set_cell(RAS_ARG_ TCoord ex, TCoord ey)
Definition: ftgrays.c:569
#define TRUNC(x)
Definition: ftgrays.c:338
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define ras
Definition: ftgrays.c:479

◆ gray_raster_done()

static void gray_raster_done ( FT_Raster  raster)
static

Definition at line 2011 of file ftgrays.c.

2012  {
2014 
2015 
2016  FT_FREE( raster );
2017  }
static char memory[1024 *256]
Definition: process.c:116
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66

◆ gray_raster_new()

static int gray_raster_new ( FT_Memory  memory,
FT_Raster araster 
)
static

Definition at line 1992 of file ftgrays.c.

1994  {
1995  FT_Error error;
1996  gray_PRaster raster = NULL;
1997 
1998 
1999  *araster = 0;
2000  if ( !FT_ALLOC( raster, sizeof ( gray_TRaster ) ) )
2001  {
2002  raster->memory = memory;
2003  *araster = (FT_Raster)raster;
2004  }
2005 
2006  return error;
2007  }
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
struct FT_RasterRec_ * FT_Raster
Definition: ftimage.h:800
static char memory[1024 *256]
Definition: process.c:116
smooth NULL
Definition: ftsmooth.c:416
void * memory
Definition: ftgrays.c:487

◆ gray_raster_render()

static int gray_raster_render ( FT_Raster  raster,
const FT_Raster_Params params 
)
static

Definition at line 1848 of file ftgrays.c.

1850  {
1851  const FT_Outline* outline = (const FT_Outline*)params->source;
1852  const FT_Bitmap* target_map = params->target;
1853  FT_BBox cbox, clip;
1854 
1855 #ifndef FT_STATIC_RASTER
1856  gray_TWorker worker[1];
1857 #endif
1858 
1859 
1860  if ( !raster )
1861  return FT_THROW( Invalid_Argument );
1862 
1863  /* this version does not support monochrome rendering */
1864  if ( !( params->flags & FT_RASTER_FLAG_AA ) )
1865  return FT_THROW( Invalid_Mode );
1866 
1867  if ( !outline )
1868  return FT_THROW( Invalid_Outline );
1869 
1870  /* return immediately if the outline is empty */
1871  if ( outline->n_points == 0 || outline->n_contours <= 0 )
1872  return 0;
1873 
1874  if ( !outline->contours || !outline->points )
1875  return FT_THROW( Invalid_Outline );
1876 
1877  if ( outline->n_points !=
1878  outline->contours[outline->n_contours - 1] + 1 )
1879  return FT_THROW( Invalid_Outline );
1880 
1881  ras.outline = *outline;
1882 
1883  if ( params->flags & FT_RASTER_FLAG_DIRECT )
1884  {
1885  if ( !params->gray_spans )
1886  return 0;
1887 
1888  ras.render_span = (FT_Raster_Span_Func)params->gray_spans;
1889  ras.render_span_data = params->user;
1890  }
1891  else
1892  {
1893  /* if direct mode is not set, we must have a target bitmap */
1894  if ( !target_map )
1895  return FT_THROW( Invalid_Argument );
1896 
1897  /* nothing to do */
1898  if ( !target_map->width || !target_map->rows )
1899  return 0;
1900 
1901  if ( !target_map->buffer )
1902  return FT_THROW( Invalid_Argument );
1903 
1904  if ( target_map->pitch < 0 )
1905  ras.target.origin = target_map->buffer;
1906  else
1907  ras.target.origin = target_map->buffer
1908  + ( target_map->rows - 1 ) * (unsigned int)target_map->pitch;
1909 
1910  ras.target.pitch = target_map->pitch;
1911 
1912  ras.render_span = (FT_Raster_Span_Func)NULL;
1913  ras.render_span_data = NULL;
1914  }
1915 
1916  FT_Outline_Get_CBox( outline, &cbox );
1917 
1918  /* reject too large outline coordinates */
1919  if ( cbox.xMin < -0x1000000L || cbox.xMax > 0x1000000L ||
1920  cbox.yMin < -0x1000000L || cbox.yMax > 0x1000000L )
1921  return FT_THROW( Invalid_Outline );
1922 
1923  /* truncate the bounding box to integer pixels */
1924  cbox.xMin = cbox.xMin >> 6;
1925  cbox.yMin = cbox.yMin >> 6;
1926  cbox.xMax = ( cbox.xMax + 63 ) >> 6;
1927  cbox.yMax = ( cbox.yMax + 63 ) >> 6;
1928 
1929  /* compute clipping box */
1930  if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
1931  {
1932  /* compute clip box from target pixmap */
1933  clip.xMin = 0;
1934  clip.yMin = 0;
1935  clip.xMax = (FT_Pos)target_map->width;
1936  clip.yMax = (FT_Pos)target_map->rows;
1937  }
1938  else if ( params->flags & FT_RASTER_FLAG_CLIP )
1939  clip = params->clip_box;
1940  else
1941  {
1942  clip.xMin = -32768L;
1943  clip.yMin = -32768L;
1944  clip.xMax = 32767L;
1945  clip.yMax = 32767L;
1946  }
1947 
1948  /* clip to target bitmap, exit if nothing to do */
1949  ras.min_ex = FT_MAX( cbox.xMin, clip.xMin );
1950  ras.min_ey = FT_MAX( cbox.yMin, clip.yMin );
1951  ras.max_ex = FT_MIN( cbox.xMax, clip.xMax );
1952  ras.max_ey = FT_MIN( cbox.yMax, clip.yMax );
1953 
1954  if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
1955  return 0;
1956 
1957  return gray_convert_glyph( RAS_VAR );
1958  }
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
static int gray_convert_glyph(RAS_ARG)
Definition: ftgrays.c:1740
#define FT_MIN(a, b)
Definition: ftobjs.h:71
#define FT_RASTER_FLAG_AA
Definition: ftimage.h:941
#define FT_RASTER_FLAG_CLIP
Definition: ftimage.h:943
GLenum const GLfloat * params
Definition: glext.h:5645
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:478
smooth NULL
Definition: ftsmooth.c:416
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos xMin
Definition: ftimage.h:117
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define FT_MAX(a, b)
Definition: ftobjs.h:72
FT_Pos xMax
Definition: ftimage.h:118
static const WCHAR L[]
Definition: oid.c:1250
#define FT_RASTER_FLAG_DIRECT
Definition: ftimage.h:942
Definition: mesh.c:5329
FT_Pos yMin
Definition: ftimage.h:117
#define FT_Raster_Span_Func
Definition: ftimage.h:869
#define ras
Definition: ftgrays.c:479
#define RAS_VAR
Definition: ftgrays.c:316

◆ gray_raster_reset()

static void gray_raster_reset ( FT_Raster  raster,
unsigned char pool_base,
unsigned long  pool_size 
)
static

Definition at line 2023 of file ftgrays.c.

2026  {
2027  FT_UNUSED( raster );
2028  FT_UNUSED( pool_base );
2029  FT_UNUSED( pool_size );
2030  }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ gray_raster_set_mode()

static int gray_raster_set_mode ( FT_Raster  raster,
unsigned long  mode,
void args 
)
static

Definition at line 2034 of file ftgrays.c.

2037  {
2038  FT_UNUSED( raster );
2039  FT_UNUSED( mode );
2040  FT_UNUSED( args );
2041 
2042 
2043  return 0; /* nothing to do */
2044  }
Definition: match.c:390
GLenum mode
Definition: glext.h:6217
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ gray_record_cell()

static void gray_record_cell ( RAS_ARG  )
static

Definition at line 524 of file ftgrays.c.

525  {
526  PCell *pcell, cell;
527  TCoord x = ras.ex;
528 
529 
530  pcell = &ras.ycells[ras.ey - ras.min_ey];
531  for (;;)
532  {
533  cell = *pcell;
534  if ( !cell || cell->x > x )
535  break;
536 
537  if ( cell->x == x )
538  goto Found;
539 
540  pcell = &cell->next;
541  }
542 
543  if ( ras.num_cells >= ras.max_cells )
544  ft_longjmp( ras.jump_buffer, 1 );
545 
546  /* insert new cell */
547  cell = ras.cells + ras.num_cells++;
548  cell->x = x;
549  cell->area = ras.area;
550  cell->cover = ras.cover;
551 
552  cell->next = *pcell;
553  *pcell = cell;
554 
555  return;
556 
557  Found:
558  /* update old cell */
559  cell->area += ras.area;
560  cell->cover += ras.cover;
561  }
TArea area
Definition: ftgrays.c:418
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define ft_longjmp
Definition: ftstdlib.h:162
int TCoord
Definition: ftgrays.c:408
return Found
Definition: dirsup.c:1270
PCell next
Definition: ftgrays.c:419
TCoord cover
Definition: ftgrays.c:417
TCoord x
Definition: ftgrays.c:416
#define ras
Definition: ftgrays.c:479

Referenced by FT_DEFINE_OUTLINE_FUNCS(), and gray_set_cell().

◆ gray_render_conic()

static void gray_render_conic ( RAS_ARG_ const FT_Vector control,
const FT_Vector to 
)
static

Definition at line 998 of file ftgrays.c.

1000  {
1001  FT_Vector bez_stack[16 * 2 + 1]; /* enough to accommodate bisections */
1002  FT_Vector* arc = bez_stack;
1003  TPos dx, dy;
1004  int draw, split;
1005 
1006 
1007  arc[0].x = UPSCALE( to->x );
1008  arc[0].y = UPSCALE( to->y );
1009  arc[1].x = UPSCALE( control->x );
1010  arc[1].y = UPSCALE( control->y );
1011  arc[2].x = ras.x;
1012  arc[2].y = ras.y;
1013 
1014  /* short-cut the arc that crosses the current band */
1015  if ( ( TRUNC( arc[0].y ) >= ras.max_ey &&
1016  TRUNC( arc[1].y ) >= ras.max_ey &&
1017  TRUNC( arc[2].y ) >= ras.max_ey ) ||
1018  ( TRUNC( arc[0].y ) < ras.min_ey &&
1019  TRUNC( arc[1].y ) < ras.min_ey &&
1020  TRUNC( arc[2].y ) < ras.min_ey ) )
1021  {
1022  ras.x = arc[0].x;
1023  ras.y = arc[0].y;
1024  return;
1025  }
1026 
1027  dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x );
1028  dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y );
1029  if ( dx < dy )
1030  dx = dy;
1031 
1032  /* We can calculate the number of necessary bisections because */
1033  /* each bisection predictably reduces deviation exactly 4-fold. */
1034  /* Even 32-bit deviation would vanish after 16 bisections. */
1035  draw = 1;
1036  while ( dx > ONE_PIXEL / 4 )
1037  {
1038  dx >>= 2;
1039  draw <<= 1;
1040  }
1041 
1042  /* We use decrement counter to count the total number of segments */
1043  /* to draw starting from 2^level. Before each draw we split as */
1044  /* many times as there are trailing zeros in the counter. */
1045  do
1046  {
1047  split = 1;
1048  while ( ( draw & split ) == 0 )
1049  {
1050  gray_split_conic( arc );
1051  arc += 2;
1052  split <<= 1;
1053  }
1054 
1055  gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
1056  arc -= 2;
1057 
1058  } while ( --draw );
1059  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
GLint dy
Definition: linetemp.h:97
#define FT_ABS(a)
Definition: ftobjs.h:74
#define ONE_PIXEL
Definition: ftgrays.c:337
long TPos
Definition: ftgrays.c:407
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define RAS_VAR_
Definition: ftgrays.c:317
#define UPSCALE(x)
Definition: ftgrays.c:345
static LPSTR * split(LPSTR s, LPINT args)
Definition: cmdcons.c:163
static void gray_render_line(RAS_ARG_ TPos to_x, TPos to_y)
Definition: ftgrays.c:704
#define TRUNC(x)
Definition: ftgrays.c:338
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
#define ras
Definition: ftgrays.c:479
static void gray_split_conic(FT_Vector *base)
Definition: ftgrays.c:978

Referenced by gray_conic_to().

◆ gray_render_cubic()

static void gray_render_cubic ( RAS_ARG_ const FT_Vector control1,
const FT_Vector control2,
const FT_Vector to 
)
static

Definition at line 1091 of file ftgrays.c.

1094  {
1095  FT_Vector bez_stack[16 * 3 + 1]; /* enough to accommodate bisections */
1096  FT_Vector* arc = bez_stack;
1097  TPos dx, dy, dx_, dy_;
1098  TPos dx1, dy1, dx2, dy2;
1099  TPos L, s, s_limit;
1100 
1101 
1102  arc[0].x = UPSCALE( to->x );
1103  arc[0].y = UPSCALE( to->y );
1104  arc[1].x = UPSCALE( control2->x );
1105  arc[1].y = UPSCALE( control2->y );
1106  arc[2].x = UPSCALE( control1->x );
1107  arc[2].y = UPSCALE( control1->y );
1108  arc[3].x = ras.x;
1109  arc[3].y = ras.y;
1110 
1111  /* short-cut the arc that crosses the current band */
1112  if ( ( TRUNC( arc[0].y ) >= ras.max_ey &&
1113  TRUNC( arc[1].y ) >= ras.max_ey &&
1114  TRUNC( arc[2].y ) >= ras.max_ey &&
1115  TRUNC( arc[3].y ) >= ras.max_ey ) ||
1116  ( TRUNC( arc[0].y ) < ras.min_ey &&
1117  TRUNC( arc[1].y ) < ras.min_ey &&
1118  TRUNC( arc[2].y ) < ras.min_ey &&
1119  TRUNC( arc[3].y ) < ras.min_ey ) )
1120  {
1121  ras.x = arc[0].x;
1122  ras.y = arc[0].y;
1123  return;
1124  }
1125 
1126  for (;;)
1127  {
1128  /* Decide whether to split or draw. See `Rapid Termination */
1129  /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */
1130  /* F. Hain, at */
1131  /* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pdf */
1132 
1133  /* dx and dy are x and y components of the P0-P3 chord vector. */
1134  dx = dx_ = arc[3].x - arc[0].x;
1135  dy = dy_ = arc[3].y - arc[0].y;
1136 
1137  L = FT_HYPOT( dx_, dy_ );
1138 
1139  /* Avoid possible arithmetic overflow below by splitting. */
1140  if ( L > 32767 )
1141  goto Split;
1142 
1143  /* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */
1144  s_limit = L * (TPos)( ONE_PIXEL / 6 );
1145 
1146  /* s is L * the perpendicular distance from P1 to the line P0-P3. */
1147  dx1 = arc[1].x - arc[0].x;
1148  dy1 = arc[1].y - arc[0].y;
1149  s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) );
1150 
1151  if ( s > s_limit )
1152  goto Split;
1153 
1154  /* s is L * the perpendicular distance from P2 to the line P0-P3. */
1155  dx2 = arc[2].x - arc[0].x;
1156  dy2 = arc[2].y - arc[0].y;
1157  s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) );
1158 
1159  if ( s > s_limit )
1160  goto Split;
1161 
1162  /* Split super curvy segments where the off points are so far
1163  from the chord that the angles P0-P1-P3 or P0-P2-P3 become
1164  acute as detected by appropriate dot products. */
1165  if ( dx1 * ( dx1 - dx ) + dy1 * ( dy1 - dy ) > 0 ||
1166  dx2 * ( dx2 - dx ) + dy2 * ( dy2 - dy ) > 0 )
1167  goto Split;
1168 
1169  gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
1170 
1171  if ( arc == bez_stack )
1172  return;
1173 
1174  arc -= 3;
1175  continue;
1176 
1177  Split:
1178  gray_split_cubic( arc );
1179  arc += 3;
1180  }
1181  }
FT_Pos y
Definition: ftimage.h:77
FT_Pos x
Definition: ftimage.h:76
GLint dy
Definition: linetemp.h:97
#define FT_ABS(a)
Definition: ftobjs.h:74
#define ONE_PIXEL
Definition: ftgrays.c:337
long TPos
Definition: ftgrays.c:407
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define RAS_VAR_
Definition: ftgrays.c:317
#define UPSCALE(x)
Definition: ftgrays.c:345
#define FT_HYPOT(x, y)
Definition: ftobjs.h:81
static void gray_split_cubic(FT_Vector *base)
Definition: ftgrays.c:1063
static void gray_render_line(RAS_ARG_ TPos to_x, TPos to_y)
Definition: ftgrays.c:704
static const WCHAR L[]
Definition: oid.c:1250
GLdouble s
Definition: gl.h:2039
#define TRUNC(x)
Definition: ftgrays.c:338
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
#define MUL_LONG(a, b)
Definition: ftcalc.h:424
#define SUB_LONG(a, b)
Definition: ftcalc.h:422
#define ras
Definition: ftgrays.c:479

Referenced by gray_cubic_to().

◆ gray_render_line()

static void gray_render_line ( RAS_ARG_ TPos  to_x,
TPos  to_y 
)
static

Definition at line 704 of file ftgrays.c.

706  {
707  TCoord ey1, ey2, fy1, fy2, first, delta, mod;
708  TPos p, dx, dy, x, x2;
709  int incr;
710 
711 
712  ey1 = TRUNC( ras.y );
713  ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */
714 
715  /* perform vertical clipping */
716  if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) ||
717  ( ey1 < ras.min_ey && ey2 < ras.min_ey ) )
718  goto End;
719 
720  fy1 = (TCoord)( ras.y - SUBPIXELS( ey1 ) );
721  fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) );
722 
723  /* everything is on a single scanline */
724  if ( ey1 == ey2 )
725  {
726  gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, to_x, fy2 );
727  goto End;
728  }
729 
730  dx = to_x - ras.x;
731  dy = to_y - ras.y;
732 
733  /* vertical line - avoid calling gray_render_scanline */
734  if ( dx == 0 )
735  {
736  TCoord ex = TRUNC( ras.x );
737  TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );
738  TArea area;
739 
740 
741  if ( dy > 0)
742  {
743  first = ONE_PIXEL;
744  incr = 1;
745  }
746  else
747  {
748  first = 0;
749  incr = -1;
750  }
751 
752  delta = first - fy1;
753  ras.area += (TArea)two_fx * delta;
754  ras.cover += delta;
755  ey1 += incr;
756 
757  gray_set_cell( RAS_VAR_ ex, ey1 );
758 
759  delta = first + first - ONE_PIXEL;
760  area = (TArea)two_fx * delta;
761  while ( ey1 != ey2 )
762  {
763  ras.area += area;
764  ras.cover += delta;
765  ey1 += incr;
766 
767  gray_set_cell( RAS_VAR_ ex, ey1 );
768  }
769 
770  delta = fy2 - ONE_PIXEL + first;
771  ras.area += (TArea)two_fx * delta;
772  ras.cover += delta;
773 
774  goto End;
775  }
776 
777  /* ok, we have to render several scanlines */
778  if ( dy > 0)
779  {
780  p = ( ONE_PIXEL - fy1 ) * dx;
781  first = ONE_PIXEL;
782  incr = 1;
783  }
784  else
785  {
786  p = fy1 * dx;
787  first = 0;
788  incr = -1;
789  dy = -dy;
790  }
791 
792  FT_DIV_MOD( TCoord, p, dy, delta, mod );
793 
794  x = ras.x + delta;
795  gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, first );
796 
797  ey1 += incr;
798  gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
799 
800  if ( ey1 != ey2 )
801  {
802  TCoord lift, rem;
803 
804 
805  p = ONE_PIXEL * dx;
806  FT_DIV_MOD( TCoord, p, dy, lift, rem );
807 
808  do
809  {
810  delta = lift;
811  mod += rem;
812  if ( mod >= (TCoord)dy )
813  {
814  mod -= (TCoord)dy;
815  delta++;
816  }
817 
818  x2 = x + delta;
820  x, ONE_PIXEL - first,
821  x2, first );
822  x = x2;
823 
824  ey1 += incr;
825  gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
826  } while ( ey1 != ey2 );
827  }
828 
830  x, ONE_PIXEL - first,
831  to_x, fy2 );
832 
833  End:
834  ras.x = to_x;
835  ras.y = to_y;
836  }
Definition: comerr.c:44
GLint dy
Definition: linetemp.h:97
const GLint * first
Definition: glext.h:5794
#define ONE_PIXEL
Definition: ftgrays.c:337
static void gray_render_scanline(RAS_ARG_ TCoord ey, TPos x1, TCoord y1, TPos x2, TCoord y2)
Definition: ftgrays.c:606
long TPos
Definition: ftgrays.c:407
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define RAS_VAR_
Definition: ftgrays.c:317
int TCoord
Definition: ftgrays.c:408
#define FT_DIV_MOD(type, dividend, divisor, quotient, remainder)
Definition: ftgrays.c:357
static void gray_set_cell(RAS_ARG_ TCoord ex, TCoord ey)
Definition: ftgrays.c:569
#define SUBPIXELS(x)
Definition: ftgrays.c:339
int TArea
Definition: ftgrays.c:409
#define TRUNC(x)
Definition: ftgrays.c:338
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50
GLint dx
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
GLfloat GLfloat p
Definition: glext.h:8902
#define ras
Definition: ftgrays.c:479
static int mod
Definition: i386-dis.c:1273

Referenced by gray_line_to(), gray_render_conic(), and gray_render_cubic().

◆ gray_render_scanline()

static void gray_render_scanline ( RAS_ARG_ TCoord  ey,
TPos  x1,
TCoord  y1,
TPos  x2,
TCoord  y2 
)
static

Definition at line 606 of file ftgrays.c.

611  {
612  TCoord ex1, ex2, fx1, fx2, first, dy, delta, mod;
613  TPos p, dx;
614  int incr;
615 
616 
617  ex1 = TRUNC( x1 );
618  ex2 = TRUNC( x2 );
619 
620  /* trivial case. Happens often */
621  if ( y1 == y2 )
622  {
623  gray_set_cell( RAS_VAR_ ex2, ey );
624  return;
625  }
626 
627  fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) );
628  fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) );
629 
630  /* everything is located in a single cell. That is easy! */
631  /* */
632  if ( ex1 == ex2 )
633  goto End;
634 
635  /* ok, we'll have to render a run of adjacent cells on the same */
636  /* scanline... */
637  /* */
638  dx = x2 - x1;
639  dy = y2 - y1;
640 
641  if ( dx > 0 )
642  {
643  p = ( ONE_PIXEL - fx1 ) * dy;
644  first = ONE_PIXEL;
645  incr = 1;
646  }
647  else
648  {
649  p = fx1 * dy;
650  first = 0;
651  incr = -1;
652  dx = -dx;
653  }
654 
655  FT_DIV_MOD( TCoord, p, dx, delta, mod );
656 
657  ras.area += (TArea)( ( fx1 + first ) * delta );
658  ras.cover += delta;
659  y1 += delta;
660  ex1 += incr;
661  gray_set_cell( RAS_VAR_ ex1, ey );
662 
663  if ( ex1 != ex2 )
664  {
665  TCoord lift, rem;
666 
667 
668  p = ONE_PIXEL * dy;
669  FT_DIV_MOD( TCoord, p, dx, lift, rem );
670 
671  do
672  {
673  delta = lift;
674  mod += rem;
675  if ( mod >= (TCoord)dx )
676  {
677  mod -= (TCoord)dx;
678  delta++;
679  }
680 
681  ras.area += (TArea)( ONE_PIXEL * delta );
682  ras.cover += delta;
683  y1 += delta;
684  ex1 += incr;
685  gray_set_cell( RAS_VAR_ ex1, ey );
686  } while ( ex1 != ex2 );
687  }
688 
689  fx1 = ONE_PIXEL - first;
690 
691  End:
692  dy = y2 - y1;
693 
694  ras.area += (TArea)( ( fx1 + fx2 ) * dy );
695  ras.cover += dy;
696  }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint dy
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
const GLint * first
Definition: glext.h:5794
#define ONE_PIXEL
Definition: ftgrays.c:337
long TPos
Definition: ftgrays.c:407
#define RAS_VAR_
Definition: ftgrays.c:317
int TCoord
Definition: ftgrays.c:408
#define FT_DIV_MOD(type, dividend, divisor, quotient, remainder)
Definition: ftgrays.c:357
static void gray_set_cell(RAS_ARG_ TCoord ex, TCoord ey)
Definition: ftgrays.c:569
#define SUBPIXELS(x)
Definition: ftgrays.c:339
int TArea
Definition: ftgrays.c:409
#define TRUNC(x)
Definition: ftgrays.c:338
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
GLint dx
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
GLfloat GLfloat p
Definition: glext.h:8902
#define ras
Definition: ftgrays.c:479
static int mod
Definition: i386-dis.c:1273

Referenced by gray_render_line().

◆ gray_set_cell()

static void gray_set_cell ( RAS_ARG_ TCoord  ex,
TCoord  ey 
)
static

Definition at line 569 of file ftgrays.c.

571  {
572  /* Move the cell pointer to a new position. We set the `invalid' */
573  /* flag to indicate that the cell isn't part of those we're interested */
574  /* in during the render phase. This means that: */
575  /* */
576  /* . the new vertical position must be within min_ey..max_ey-1. */
577  /* . the new horizontal position must be strictly less than max_ex */
578  /* */
579  /* Note that if a cell is to the left of the clipping region, it is */
580  /* actually set to the (min_ex-1) horizontal position. */
581 
582  if ( ex < ras.min_ex )
583  ex = ras.min_ex - 1;
584 
585  /* record the current one if it is valid and substantial */
586  if ( !ras.invalid && ( ras.area || ras.cover ) )
588 
589  ras.area = 0;
590  ras.cover = 0;
591  ras.ex = ex;
592  ras.ey = ey;
593 
594  ras.invalid = ( ey >= ras.max_ey || ey < ras.min_ey ||
595  ex >= ras.max_ex );
596  }
Definition: comerr.c:44
static void gray_record_cell(RAS_ARG)
Definition: ftgrays.c:524
#define ras
Definition: ftgrays.c:479
#define RAS_VAR
Definition: ftgrays.c:316

Referenced by gray_move_to(), gray_render_line(), and gray_render_scanline().

◆ gray_split_conic()

static void gray_split_conic ( FT_Vector base)
static

Definition at line 978 of file ftgrays.c.

979  {
980  TPos a, b;
981 
982 
983  base[4].x = base[2].x;
984  b = base[1].x;
985  a = base[3].x = ( base[2].x + b ) / 2;
986  b = base[1].x = ( base[0].x + b ) / 2;
987  base[2].x = ( a + b ) / 2;
988 
989  base[4].y = base[2].y;
990  b = base[1].y;
991  a = base[3].y = ( base[2].y + b ) / 2;
992  b = base[1].y = ( base[0].y + b ) / 2;
993  base[2].y = ( a + b ) / 2;
994  }
long TPos
Definition: ftgrays.c:407
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by gray_render_conic().

◆ gray_split_cubic()

static void gray_split_cubic ( FT_Vector base)
static

Definition at line 1063 of file ftgrays.c.

1064  {
1065  TPos a, b, c, d;
1066 
1067 
1068  base[6].x = base[3].x;
1069  c = base[1].x;
1070  d = base[2].x;
1071  base[1].x = a = ( base[0].x + c ) / 2;
1072  base[5].x = b = ( base[3].x + d ) / 2;
1073  c = ( c + d ) / 2;
1074  base[2].x = a = ( a + c ) / 2;
1075  base[4].x = b = ( b + c ) / 2;
1076  base[3].x = ( a + b ) / 2;
1077 
1078  base[6].y = base[3].y;
1079  c = base[1].y;
1080  d = base[2].y;
1081  base[1].y = a = ( base[0].y + c ) / 2;
1082  base[5].y = b = ( base[3].y + d ) / 2;
1083  c = ( c + d ) / 2;
1084  base[2].y = a = ( a + c ) / 2;
1085  base[4].y = b = ( b + c ) / 2;
1086  base[3].y = ( a + b ) / 2;
1087  }
long TPos
Definition: ftgrays.c:407
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by gray_render_cubic().

◆ gray_sweep()

static void gray_sweep ( RAS_ARG  )
static

Definition at line 1298 of file ftgrays.c.

1299  {
1300  int y;
1301 
1302 
1303  for ( y = ras.min_ey; y < ras.max_ey; y++ )
1304  {
1305  PCell cell = ras.ycells[y - ras.min_ey];
1306  TCoord x = ras.min_ex;
1307  TArea cover = 0;
1308  TArea area;
1309 
1310 
1311  for ( ; cell != NULL; cell = cell->next )
1312  {
1313  if ( cover != 0 && cell->x > x )
1314  gray_hline( RAS_VAR_ x, y, cover, cell->x - x );
1315 
1316  cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
1317  area = cover - cell->area;
1318 
1319  if ( area != 0 && cell->x >= ras.min_ex )
1320  gray_hline( RAS_VAR_ cell->x, y, area, 1 );
1321 
1322  x = cell->x + 1;
1323  }
1324 
1325  if ( cover != 0 )
1326  gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x );
1327  }
1328  }
TArea area
Definition: ftgrays.c:418
#define ONE_PIXEL
Definition: ftgrays.c:337
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define RAS_VAR_
Definition: ftgrays.c:317
static void gray_hline(RAS_ARG_ TCoord x, TCoord y, TArea coverage, TCoord acount)
Definition: ftgrays.c:1234
int TCoord
Definition: ftgrays.c:408
smooth NULL
Definition: ftsmooth.c:416
PCell next
Definition: ftgrays.c:419
TCoord cover
Definition: ftgrays.c:417
int TArea
Definition: ftgrays.c:409
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50
TCoord x
Definition: ftgrays.c:416
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define ras
Definition: ftgrays.c:479

Referenced by gray_convert_glyph().