亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftcsbits.c

?? 智能設備中PDF閱讀器的源碼!用于windows mobile2003或者WM5以上
?? C
字號:
/***************************************************************************/
/*                                                                         */
/*  ftcsbits.c                                                             */
/*                                                                         */
/*    FreeType sbits manager (body).                                       */
/*                                                                         */
/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by                   */
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
/*                                                                         */
/*  This file is part of the FreeType project, and may only be used,       */
/*  modified, and distributed under the terms of the FreeType project      */
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/***************************************************************************/


#include <ft2build.h>
#include FT_CACHE_H
#include "ftcsbits.h"
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
#include FT_ERRORS_H

#include "ftccback.h"
#include "ftcerror.h"


  /*************************************************************************/
  /*************************************************************************/
  /*****                                                               *****/
  /*****                     SBIT CACHE NODES                          *****/
  /*****                                                               *****/
  /*************************************************************************/
  /*************************************************************************/


  static FT_Error
  ftc_sbit_copy_bitmap( FTC_SBit    sbit,
                        FT_Bitmap*  bitmap,
                        FT_Memory   memory )
  {
    FT_Error  error;
    FT_Int    pitch = bitmap->pitch;
    FT_ULong  size;


    if ( pitch < 0 )
      pitch = -pitch;

    size = (FT_ULong)( pitch * bitmap->rows );

    if ( !FT_ALLOC( sbit->buffer, size ) )
      FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );

    return error;
  }


  FT_LOCAL_DEF( void )
  ftc_snode_free( FTC_Node   ftcsnode,
                  FTC_Cache  cache )
  {
    FTC_SNode  snode  = (FTC_SNode)ftcsnode;
    FTC_SBit   sbit   = snode->sbits;
    FT_UInt    count  = snode->count;
    FT_Memory  memory = cache->memory;


    for ( ; count > 0; sbit++, count-- )
      FT_FREE( sbit->buffer );

    FTC_GNode_Done( FTC_GNODE( snode ), cache );

    FT_FREE( snode );
  }


  FT_LOCAL_DEF( void )
  FTC_SNode_Free( FTC_SNode  snode,
                  FTC_Cache  cache )
  {
    ftc_snode_free( FTC_NODE( snode ), cache );
  }


  /*
   *  This function tries to load a small bitmap within a given FTC_SNode.
   *  Note that it returns a non-zero error code _only_ in the case of
   *  out-of-memory condition.  For all other errors (e.g., corresponding
   *  to a bad font file), this function will mark the sbit as `unavailable'
   *  and return a value of 0.
   *
   *  You should also read the comment within the @ftc_snode_compare
   *  function below to see how out-of-memory is handled during a lookup.
   */
  static FT_Error
  ftc_snode_load( FTC_SNode    snode,
                  FTC_Manager  manager,
                  FT_UInt      gindex,
                  FT_ULong    *asize )
  {
    FT_Error          error;
    FTC_GNode         gnode  = FTC_GNODE( snode );
    FTC_Family        family = gnode->family;
    FT_Memory         memory = manager->memory;
    FT_Face           face;
    FTC_SBit          sbit;
    FTC_SFamilyClass  clazz;


    if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )
    {
      FT_ERROR(( "ftc_snode_load: invalid glyph index" ));
      return FTC_Err_Invalid_Argument;
    }

    sbit  = snode->sbits + ( gindex - gnode->gindex );
    clazz = (FTC_SFamilyClass)family->clazz;

    sbit->buffer = 0;

    error = clazz->family_load_glyph( family, gindex, manager, &face );
    if ( error )
      goto BadGlyph;

    {
      FT_Int        temp;
      FT_GlyphSlot  slot   = face->glyph;
      FT_Bitmap*    bitmap = &slot->bitmap;
      FT_Int        xadvance, yadvance;


      if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
      {
        FT_ERROR(( "%s: glyph loaded didn't return a bitmap!\n",
                   "ftc_snode_load" ));
        goto BadGlyph;
      }

      /* Check that our values fit into 8-bit containers!       */
      /* If this is not the case, our bitmap is too large       */
      /* and we will leave it as `missing' with sbit.buffer = 0 */

#define CHECK_CHAR( d )  ( temp = (FT_Char)d, temp == d )
#define CHECK_BYTE( d )  ( temp = (FT_Byte)d, temp == d )

      /* horizontal advance in pixels */
      xadvance = ( slot->advance.x + 32 ) >> 6;
      yadvance = ( slot->advance.y + 32 ) >> 6;

      if ( !CHECK_BYTE( bitmap->rows  )     ||
           !CHECK_BYTE( bitmap->width )     ||
           !CHECK_CHAR( bitmap->pitch )     ||
           !CHECK_CHAR( slot->bitmap_left ) ||
           !CHECK_CHAR( slot->bitmap_top  ) ||
           !CHECK_CHAR( xadvance )          ||
           !CHECK_CHAR( yadvance )          )
        goto BadGlyph;

      sbit->width     = (FT_Byte)bitmap->width;
      sbit->height    = (FT_Byte)bitmap->rows;
      sbit->pitch     = (FT_Char)bitmap->pitch;
      sbit->left      = (FT_Char)slot->bitmap_left;
      sbit->top       = (FT_Char)slot->bitmap_top;
      sbit->xadvance  = (FT_Char)xadvance;
      sbit->yadvance  = (FT_Char)yadvance;
      sbit->format    = (FT_Byte)bitmap->pixel_mode;
      sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);

      /* copy the bitmap into a new buffer -- ignore error */
      error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );

      /* now, compute size */
      if ( asize )
        *asize = FT_ABS( sbit->pitch ) * sbit->height;

    } /* glyph loading successful */

    /* ignore the errors that might have occurred --   */
    /* we mark unloaded glyphs with `sbit.buffer == 0' */
    /* and `width == 255', `height == 0'               */
    /*                                                 */
    if ( error && error != FTC_Err_Out_Of_Memory )
    {
    BadGlyph:
      sbit->width  = 255;
      sbit->height = 0;
      sbit->buffer = NULL;
      error        = 0;
      if ( asize )
        *asize = 0;
    }

    return error;
  }


  FT_LOCAL_DEF( FT_Error )
  FTC_SNode_New( FTC_SNode  *psnode,
                 FTC_GQuery  gquery,
                 FTC_Cache   cache )
  {
    FT_Memory   memory = cache->memory;
    FT_Error    error;
    FTC_SNode   snode  = NULL;
    FT_UInt     gindex = gquery->gindex;
    FTC_Family  family = gquery->family;

    FTC_SFamilyClass  clazz = FTC_CACHE__SFAMILY_CLASS( cache );
    FT_UInt           total;


    total = clazz->family_get_count( family, cache->manager );
    if ( total == 0 || gindex >= total )
    {
      error = FT_Err_Invalid_Argument;
      goto Exit;
    }

    if ( !FT_NEW( snode ) )
    {
      FT_UInt  count, start;


      start = gindex - ( gindex % FTC_SBIT_ITEMS_PER_NODE );
      count = total - start;
      if ( count > FTC_SBIT_ITEMS_PER_NODE )
        count = FTC_SBIT_ITEMS_PER_NODE;

      FTC_GNode_Init( FTC_GNODE( snode ), start, family );

      snode->count = count;

      error = ftc_snode_load( snode,
                              cache->manager,
                              gindex,
                              NULL );
      if ( error )
      {
        FTC_SNode_Free( snode, cache );
        snode = NULL;
      }
    }

  Exit:
    *psnode = snode;
    return error;
  }


  FT_LOCAL_DEF( FT_Error )
  ftc_snode_new( FTC_Node   *ftcpsnode,
                 FT_Pointer  ftcgquery,
                 FTC_Cache   cache )
  {
    FTC_SNode  *psnode = (FTC_SNode*)ftcpsnode;
    FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;


    return FTC_SNode_New( psnode, gquery, cache );
  }


  FT_LOCAL_DEF( FT_ULong )
  ftc_snode_weight( FTC_Node   ftcsnode,
                    FTC_Cache  cache )
  {
    FTC_SNode  snode = (FTC_SNode)ftcsnode;
    FT_UInt    count = snode->count;
    FTC_SBit   sbit  = snode->sbits;
    FT_Int     pitch;
    FT_ULong   size;

    FT_UNUSED( cache );


    FT_ASSERT( snode->count <= FTC_SBIT_ITEMS_PER_NODE );

    /* the node itself */
    size = sizeof ( *snode );

    for ( ; count > 0; count--, sbit++ )
    {
      if ( sbit->buffer )
      {
        pitch = sbit->pitch;
        if ( pitch < 0 )
          pitch = -pitch;

        /* add the size of a given glyph image */
        size += pitch * sbit->height;
      }
    }

    return size;
  }


#if 0

  FT_LOCAL_DEF( FT_ULong )
  FTC_SNode_Weight( FTC_SNode  snode )
  {
    return ftc_snode_weight( FTC_NODE( snode ), NULL );
  }

#endif /* 0 */


  FT_LOCAL_DEF( FT_Bool )
  ftc_snode_compare( FTC_Node    ftcsnode,
                     FT_Pointer  ftcgquery,
                     FTC_Cache   cache )
  {
    FTC_SNode   snode  = (FTC_SNode)ftcsnode;
    FTC_GQuery  gquery = (FTC_GQuery)ftcgquery;
    FTC_GNode   gnode  = FTC_GNODE( snode );
    FT_UInt     gindex = gquery->gindex;
    FT_Bool     result;


    result = FT_BOOL( gnode->family == gquery->family                    &&
                      (FT_UInt)( gindex - gnode->gindex ) < snode->count );
    if ( result )
    {
      /* check if we need to load the glyph bitmap now */
      FTC_SBit  sbit = snode->sbits + ( gindex - gnode->gindex );


      /*
       *  The following code illustrates what to do when you want to
       *  perform operations that may fail within a lookup function.
       *
       *  Here, we want to load a small bitmap on-demand; we thus
       *  need to call the `ftc_snode_load' function which may return
       *  a non-zero error code only when we are out of memory (OOM).
       *
       *  The correct thing to do is to use @FTC_CACHE_TRYLOOP and
       *  @FTC_CACHE_TRYLOOP_END in order to implement a retry loop
       *  that is capable of flushing the cache incrementally when
       *  an OOM errors occur.
       *
       *  However, we need to `lock' the node before this operation to
       *  prevent it from being flushed within the loop.
       *
       *  When we exit the loop, we unlock the node, then check the `error'
       *  variable.  If it is non-zero, this means that the cache was
       *  completely flushed and that no usable memory was found to load
       *  the bitmap.
       *
       *  We then prefer to return a value of 0 (i.e., NO MATCH).  This
       *  ensures that the caller will try to allocate a new node.
       *  This operation consequently _fail_ and the lookup function
       *  returns the appropriate OOM error code.
       *
       *  Note that `buffer == NULL && width == 255' is a hack used to
       *  tag `unavailable' bitmaps in the array.  We should never try
       *  to load these.
       *
       */

      if ( sbit->buffer == NULL && sbit->width != 255 )
      {
        FT_ULong  size;
        FT_Error  error;


        ftcsnode->ref_count++;  /* lock node to prevent flushing */
                                /* in retry loop                 */

        FTC_CACHE_TRYLOOP( cache )
        {
          error = ftc_snode_load( snode, cache->manager, gindex, &size );
        }
        FTC_CACHE_TRYLOOP_END();

        ftcsnode->ref_count--;  /* unlock the node */

        if ( error )
          result = 0;
        else
          cache->manager->cur_weight += size;
      }
    }

    return result;
  }


  FT_LOCAL_DEF( FT_Bool )
  FTC_SNode_Compare( FTC_SNode   snode,
                     FTC_GQuery  gquery,
                     FTC_Cache   cache )
  {
    return ftc_snode_compare( FTC_NODE( snode ), gquery, cache );
  }


/* END */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类的小说在线视频另类成人小视频在线 | 精品国产一区二区三区久久影院| 精品理论电影在线观看| 一区二区在线观看视频在线观看| 日韩电影在线免费看| 白白色亚洲国产精品| 6080国产精品一区二区| 中文字幕久久午夜不卡| 久久99久久精品欧美| 色综合久久久久| 国产午夜亚洲精品羞羞网站| 午夜成人免费电影| 一本到不卡精品视频在线观看| 精品国产a毛片| 日韩av网站免费在线| 99久久国产综合色|国产精品| 欧美成人aa大片| 亚欧色一区w666天堂| 色综合久久久久| 欧美国产成人在线| 国产福利电影一区二区三区| 日韩一卡二卡三卡| 天天色天天爱天天射综合| 欧美性欧美巨大黑白大战| 日韩一区在线播放| 成人av综合在线| 欧美国产日韩a欧美在线观看| 久久精品免费观看| 6080yy午夜一二三区久久| 亚洲超碰精品一区二区| 欧美日韩中文另类| 亚洲一区二区三区四区不卡| 91黄视频在线观看| 一区二区在线免费| 欧美三级在线视频| 日韩电影在线一区| 精品国产伦一区二区三区观看体验| 日韩成人dvd| 精品国产伦一区二区三区观看方式 | 日韩一区二区视频| 日韩精品福利网| 欧美高清视频不卡网| 天天色 色综合| 日韩欧美自拍偷拍| 黑人精品欧美一区二区蜜桃| 久久久噜噜噜久噜久久综合| 国产精品亚洲第一| 中文字幕一区二区三区在线观看| 成人黄色一级视频| 亚洲精品一卡二卡| 欧美精品在线视频| 麻豆精品国产传媒mv男同| 欧美v国产在线一区二区三区| 韩国一区二区三区| 亚洲欧美中日韩| 欧美美女一区二区三区| 麻豆精品久久久| 国产精品午夜在线| 日本道精品一区二区三区| 日本女优在线视频一区二区| 精品国产乱码久久久久久久| 国产+成+人+亚洲欧洲自线| 中文字幕亚洲视频| 555夜色666亚洲国产免| 国产麻豆精品久久一二三| 自拍视频在线观看一区二区| 欧美日韩国产高清一区二区| 国产米奇在线777精品观看| 中文字幕中文字幕一区二区 | 国产suv精品一区二区6| 亚洲欧美激情一区二区| 欧美一区二区三区啪啪| 99久久久久久| 麻豆高清免费国产一区| 国产精品久久久久aaaa樱花 | 欧美性生活大片视频| 韩国在线一区二区| 悠悠色在线精品| 2020日本不卡一区二区视频| 一道本成人在线| 国产一区二区主播在线| 亚洲成人午夜电影| 18成人在线观看| 日韩精品一区二区三区swag| 91丨九色丨黑人外教| 久久精品久久99精品久久| 中文字幕亚洲不卡| 精品国产91九色蝌蚪| 欧美日韩国产综合久久| 97久久精品人人爽人人爽蜜臀 | 成人在线综合网站| 麻豆视频观看网址久久| 亚洲高清不卡在线观看| 国产精品不卡视频| 国产欧美在线观看一区| 日韩一区二区三区视频在线观看 | gogogo免费视频观看亚洲一| 精品一区二区av| 亚洲成人777| 一区二区视频在线| 中文久久乱码一区二区| 久久蜜桃一区二区| 日韩欧美一级在线播放| 欧美精品久久久久久久多人混战| 色系网站成人免费| gogogo免费视频观看亚洲一| 成人免费毛片片v| 国产一区二区免费看| 久久91精品久久久久久秒播| 婷婷夜色潮精品综合在线| 亚洲综合免费观看高清完整版 | 亚洲特级片在线| 国产精品午夜久久| 国产精品理论在线观看| 欧美激情一区二区三区蜜桃视频| 精品久久久久久久久久久久久久久久久| 91久久精品日日躁夜夜躁欧美| 99久久99久久免费精品蜜臀| 成人97人人超碰人人99| 成人av在线一区二区| 成人av电影在线网| 99精品国产一区二区三区不卡| 国产成人免费高清| 福利一区二区在线| 成人av集中营| 在线视频一区二区三| 欧美日韩一区成人| 欧美一区二区三区视频免费| 日韩免费观看2025年上映的电影| 欧美一区二区在线免费播放| 欧美大片在线观看| 久久久国产综合精品女国产盗摄| 久久久久久亚洲综合影院红桃| 久久精品视频在线看| 中文字幕亚洲综合久久菠萝蜜| 亚洲欧洲成人精品av97| 亚洲第一精品在线| 美女被吸乳得到大胸91| 国产91精品入口| 色哟哟欧美精品| 欧美一区二区三区男人的天堂| www国产精品av| 国产精品久久久久久久裸模| 一区二区在线观看视频| 日韩精品欧美成人高清一区二区| 麻豆久久一区二区| 99久久久无码国产精品| 欧美一区二区在线播放| 亚洲国产精品二十页| 亚洲一本大道在线| 国产一二精品视频| 91蜜桃在线免费视频| 欧美成人综合网站| 亚洲男人都懂的| 精品一区二区三区在线观看国产 | 亚洲精品中文字幕乱码三区| 日韩中文字幕区一区有砖一区 | 美国精品在线观看| 色综合色狠狠天天综合色| 精品奇米国产一区二区三区| 亚洲激情一二三区| 国产成人免费xxxxxxxx| 欧美日韩精品一二三区| 中文字幕一区二区不卡| 精品一区二区三区影院在线午夜 | 国产精品久久久久久久久搜平片| 一区二区三区中文字幕精品精品| 夜夜揉揉日日人人青青一国产精品| 视频在线观看国产精品| 国产精品18久久久久久久久| 极品尤物av久久免费看| 欧美精选午夜久久久乱码6080| 亚洲精品一区二区精华| 日韩美女啊v在线免费观看| 日韩二区三区四区| 岛国精品在线观看| 欧美卡1卡2卡| 国产日韩v精品一区二区| 久久国内精品自在自线400部| gogo大胆日本视频一区| 欧美一区二区三区婷婷月色| 亚洲国产经典视频| 日本欧美久久久久免费播放网| 91丨九色丨黑人外教| 99国产麻豆精品| 欧美成人一级视频| 伊人婷婷欧美激情| 高清久久久久久| 久久久国际精品| 日本欧美加勒比视频| 日本久久电影网| 亚洲精品视频在线| 国产精品1024| 69av一区二区三区| 日韩avvvv在线播放| 91久久精品午夜一区二区| 欧美高清在线视频| 免费欧美高清视频| 欧美大黄免费观看| 日本不卡视频在线|