⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftraster.c

📁 qt-x11-opensource-src-4.1.4.tar.gz源码
💻 C
📖 第 1 页 / 共 5 页
字号:
    Short  y_max;   /* band's maximum */  } TBand;#define AlignProfileSize \  ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) )#ifdef FT_STATIC_RASTER#define RAS_ARGS       /* void */#define RAS_ARG        /* void */#define RAS_VARS       /* void */#define RAS_VAR        /* void */#define FT_UNUSED_RASTER  do ; while ( 0 )#else /* FT_STATIC_RASTER */#define RAS_ARGS       TRaster_Instance*  raster,#define RAS_ARG        TRaster_Instance*  raster#define RAS_VARS       raster,#define RAS_VAR        raster#define FT_UNUSED_RASTER  FT_UNUSED( raster )#endif /* FT_STATIC_RASTER */  typedef struct TRaster_Instance_  TRaster_Instance;  /* prototypes used for sweep function dispatch */  typedef void  Function_Sweep_Init( RAS_ARGS Short*  min,                                Short*  max );  typedef void  Function_Sweep_Span( RAS_ARGS Short       y,                                FT_F26Dot6  x1,                                FT_F26Dot6  x2,                                PProfile    left,                                PProfile    right );  typedef void  Function_Sweep_Step( RAS_ARG );  /* NOTE: These operations are only valid on 2's complement processors */#define FLOOR( x )    ( (x) & -ras.precision )#define CEILING( x )  ( ( (x) + ras.precision - 1 ) & -ras.precision )#define TRUNC( x )    ( (signed long)(x) >> ras.precision_bits )#define FRAC( x )     ( (x) & ( ras.precision - 1 ) )#define SCALED( x )   ( ( (x) << ras.scale_shift ) - ras.precision_half )  /* Note that I have moved the location of some fields in the */  /* structure to ensure that the most used variables are used */  /* at the top.  Thus, their offset can be coded with less    */  /* opcodes, and it results in a smaller executable.          */  struct  TRaster_Instance_  {    Int       precision_bits;       /* precision related variables         */    Int       precision;    Int       precision_half;    Long      precision_mask;    Int       precision_shift;    Int       precision_step;    Int       precision_jitter;    Int       scale_shift;          /* == precision_shift   for bitmaps    */                                    /* == precision_shift+1 for pixmaps    */    PLong     buff;                 /* The profiles buffer                 */    PLong     sizeBuff;             /* Render pool size                    */    PLong     maxBuff;              /* Profiles buffer size                */    PLong     top;                  /* Current cursor in buffer            */    FT_Error  error;    Int       numTurns;             /* number of Y-turns in outline        */    TPoint*   arc;                  /* current Bezier arc pointer          */    UShort    bWidth;               /* target bitmap width                 */    PByte     bTarget;              /* target bitmap buffer                */    PByte     gTarget;              /* target pixmap buffer                */    Long      lastX, lastY, minY, maxY;    UShort    num_Profs;            /* current number of profiles          */    Bool      fresh;                /* signals a fresh new profile which   */                                    /* 'start' field must be completed     */    Bool      joint;                /* signals that the last arc ended     */                                    /* exactly on a scanline.  Allows      */                                    /* removal of doublets                 */    PProfile  cProfile;             /* current profile                     */    PProfile  fProfile;             /* head of linked list of profiles     */    PProfile  gProfile;             /* contour's first profile in case     */                                    /* of impact                           */    TStates   state;                /* rendering state                     */    FT_Bitmap   target;             /* description of target bit/pixmap    */    FT_Outline  outline;    Long      traceOfs;             /* current offset in target bitmap     */    Long      traceG;               /* current offset in target pixmap     */    Short     traceIncr;            /* sweep's increment in target bitmap  */    Short     gray_min_x;           /* current min x during gray rendering */    Short     gray_max_x;           /* current max x during gray rendering */    /* dispatch variables */    Function_Sweep_Init*  Proc_Sweep_Init;    Function_Sweep_Span*  Proc_Sweep_Span;    Function_Sweep_Span*  Proc_Sweep_Drop;    Function_Sweep_Step*  Proc_Sweep_Step;    Byte      dropOutControl;       /* current drop_out control method     */    Bool      second_pass;          /* indicates wether a horizontal pass  */                                    /* should be performed to control      */                                    /* drop-out accurately when calling    */                                    /* Render_Glyph.  Note that there is   */                                    /* no horizontal pass during gray      */                                    /* rendering.                          */    TPoint    arcs[3 * MaxBezier + 1]; /* The Bezier stack                 */    TBand     band_stack[16];       /* band stack used for sub-banding     */    Int       band_top;             /* band stack top                      */    Int       count_table[256];     /* Look-up table used to quickly count */                                    /* set bits in a gray 2x2 cell         */    void*     memory;#ifdef FT_RASTER_OPTION_ANTI_ALIASING    Byte      grays[5];             /* Palette of gray levels used for     */                                    /* render.                             */    Byte      gray_lines[RASTER_GRAY_LINES];                                /* Intermediate table used to render the   */                                /* graylevels pixmaps.                     */                                /* gray_lines is a buffer holding two      */                                /* monochrome scanlines                    */    Short     gray_width;       /* width in bytes of one monochrome        */                                /* intermediate scanline of gray_lines.    */                                /* Each gray pixel takes 2 bits long there */                       /* The gray_lines must hold 2 lines, thus with size */                       /* in bytes of at least `gray_width*2'.             */#endif /* FT_RASTER_ANTI_ALIASING */#if 0    PByte       flags;              /* current flags table                 */    PUShort     outs;               /* current outlines table              */    FT_Vector*  coords;    UShort      nPoints;            /* number of points in current glyph   */    Short       nContours;          /* number of contours in current glyph */#endif  };#ifdef FT_STATIC_RASTER  static TRaster_Instance  cur_ras;#define ras  cur_ras#else#define ras  (*raster)#endif /* FT_STATIC_RASTER */  /*************************************************************************/  /*************************************************************************/  /**                                                                     **/  /**  PROFILES COMPUTATION                                               **/  /**                                                                     **/  /*************************************************************************/  /*************************************************************************/  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Set_High_Precision                                                 */  /*                                                                       */  /* <Description>                                                         */  /*    Sets precision variables according to param flag.                  */  /*                                                                       */  /* <Input>                                                               */  /*    High :: Set to True for high precision (typically for ppem < 18),  */  /*            false otherwise.                                           */  /*                                                                       */  static void  Set_High_Precision( RAS_ARGS Int  High )  {    if ( High )    {      ras.precision_bits   = 10;      ras.precision_step   = 128;      ras.precision_jitter = 24;    }    else    {      ras.precision_bits   = 6;      ras.precision_step   = 32;      ras.precision_jitter = 2;    }    FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" ));    ras.precision       = 1 << ras.precision_bits;    ras.precision_half  = ras.precision / 2;    ras.precision_shift = ras.precision_bits - Pixel_Bits;    ras.precision_mask  = -ras.precision;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    New_Profile                                                        */  /*                                                                       */  /* <Description>                                                         */  /*    Creates a new profile in the render pool.                          */  /*                                                                       */  /* <Input>                                                               */  /*    aState :: The state/orientation of the new profile.                */  /*                                                                       */  /* <Return>                                                              */  /*   SUCCESS on success.  FAILURE in case of overflow or of incoherent   */  /*   profile.                                                            */  /*                                                                       */  static Bool  New_Profile( RAS_ARGS TStates  aState )  {    if ( !ras.fProfile )    {      ras.cProfile  = (PProfile)ras.top;      ras.fProfile  = ras.cProfile;      ras.top      += AlignProfileSize;    }    if ( ras.top >= ras.maxBuff )    {      ras.error = Raster_Err_Overflow;      return FAILURE;    }    switch ( aState )    {    case Ascending_State:      ras.cProfile->flow = Flow_Up;      FT_TRACE6(( "New ascending profile = %lx\n", (long)ras.cProfile ));      break;    case Descending_State:      ras.cProfile->flow = Flow_Down;      FT_TRACE6(( "New descending profile = %lx\n", (long)ras.cProfile ));      break;    default:      FT_ERROR(( "New_Profile: invalid profile direction!\n" ));      ras.error = Raster_Err_Invalid;      return FAILURE;    }    ras.cProfile->start  = 0;    ras.cProfile->height = 0;    ras.cProfile->offset = ras.top;    ras.cProfile->link   = (PProfile)0;    ras.cProfile->next   = (PProfile)0;    if ( !ras.gProfile )      ras.gProfile = ras.cProfile;    ras.state = aState;    ras.fresh = TRUE;    ras.joint = FALSE;    return SUCCESS;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    End_Profile                                                        */  /*                                                                       */  /* <Description>                                                         */  /*    Finalizes the current profile.                                     */  /*                                                                       */  /* <Return>                                                              */  /*    SUCCESS on success.  FAILURE in case of overflow or incoherency.   */  /*                                                                       */  static Bool  End_Profile( RAS_ARG )  {    Long      h;    PProfile  oldProfile;    h = (Long)( ras.top - ras.cProfile->offset );    if ( h < 0 )    {      FT_ERROR(( "End_Profile: negative height encountered!\n" ));      ras.error = Raster_Err_Neg_Height;      return FAILURE;    }    if ( h > 0 )    {      FT_TRACE6(( "Ending profile %lx, start = %ld, height = %ld\n",                  (long)ras.cProfile, ras.cProfile->start, h ));      oldProfile           = ras.cProfile;      ras.cProfile->height = h;      ras.cProfile         = (PProfile)ras.top;      ras.top             += AlignProfileSize;      ras.cProfile->height = 0;      ras.cProfile->offset = ras.top;      oldProfile->next     = ras.cProfile;      ras.num_Profs++;    }    if ( ras.top >= ras.maxBuff )    {      FT_TRACE1(( "overflow in End_Profile\n" ));      ras.error = Raster_Err_Overflow;      return FAILURE;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -