Changeset 405 for trunk


Ignore:
Timestamp:
06/19/15 21:51:54 (10 years ago)
Author:
epyon
Message:
  • fixed not yet used hash_table_policy
  • texture_font no longer copies unordered_maps
  • texture_font cleaned up of clang errors
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/stl/container/hash_table_policy.hh

    r404 r405  
    257257                inline void entry_construct( entry_type* entry, hash_type hash_code, Args&&... params ) const
    258258                {
    259                         copy_construct_object( &( entry->value ), ::nv::forward<Args>( params ) );
     259                        construct_object( &( entry->value ), ::nv::forward<Args>( params )... );
     260                        entry->hash_code = hash_code;
     261                }
     262
     263                inline void entry_construct( entry_type* entry, hash_type hash_code, Key key ) const
     264                {
     265                        construct_object( &( entry->value ), value_type( ::nv::move( key ), mapped_type() ) );
    260266                        entry->hash_code = hash_code;
    261267                }
  • trunk/src/gfx/texture_font.cc

    r403 r405  
    3838        FT_Error error;
    3939        FT_Matrix matrix = {
    40                 (int)((1.0/hres) * 0x10000L),
    41                 (int)((0.0)      * 0x10000L),
    42                 (int)((0.0)      * 0x10000L),
    43                 (int)((1.0)      * 0x10000L)
     40                static_cast<int>((1.0/hres) * 0x10000L),
     41                static_cast<int>((0.0)      * 0x10000L),
     42                static_cast<int>((0.0)      * 0x10000L),
     43                static_cast<int>((1.0)      * 0x10000L)
    4444        };
    4545
     
    5050        m_lcd_weights[4] = 0x10;
    5151         
    52         error = FT_Init_FreeType( (FT_Library*)(&m_rlibrary) );
     52        error = FT_Init_FreeType( reinterpret_cast<FT_Library*>(&m_rlibrary) );
    5353        NV_CHECK_FREETYPE_ERROR( error, "error on FT_Init_FreeType, code - ", error );
    5454
    55         error = FT_New_Face( (FT_Library)(m_rlibrary), filename, 0, (FT_Face*)(&m_rface) );
     55        error = FT_New_Face( reinterpret_cast<FT_Library>(m_rlibrary), filename, 0, reinterpret_cast<FT_Face*>(&m_rface) );
    5656        NV_CHECK_FREETYPE_ERROR( error, "error on FT_New_Face, code - ", error );
    5757
    58         error = FT_Set_Char_Size( (FT_Face)(m_rface), (int)(size*64), 0, 72*64, 72 );
     58        error = FT_Set_Char_Size( reinterpret_cast<FT_Face>(m_rface), int(size*64), 0, 72*64, 72 );
    5959        NV_CHECK_FREETYPE_ERROR( error, "error on FT_Set_Char_Size, code - ", error );
    6060
    61     FT_Set_Transform( (FT_Face)(m_rface), &matrix, NULL );
     61    FT_Set_Transform( reinterpret_cast<FT_Face>(m_rface), &matrix, NULL );
    6262
    63     FT_Size_Metrics metrics = ((FT_Face)(m_rface))->size->metrics;
    64     m_ascender  = (float)(metrics.ascender >> 6) / 100.0f;
    65     m_descender = (float)(metrics.descender >> 6) / 100.0f;
    66     m_height    = (float)(metrics.height >> 6) / 100.0f;
     63    FT_Size_Metrics metrics = reinterpret_cast<FT_Face>(m_rface)->size->metrics;
     64    m_ascender  = static_cast<float>(metrics.ascender >> 6) / 100.0f;
     65    m_descender = static_cast<float>(metrics.descender >> 6) / 100.0f;
     66    m_height    = static_cast<float>(metrics.height >> 6) / 100.0f;
    6767    m_linegap   = m_height - m_ascender + m_descender;
    6868}
     
    100100bool texture_font::load_glyphs( string_view codes )
    101101{
    102         FT_Face face = (FT_Face)(m_rface);
     102        FT_Face face = reinterpret_cast<FT_Face>( m_rface );
    103103        size_t depth = m_atlas->get_depth();
    104         ivec2 asize  = m_atlas->get_size();
     104        vec2 asize   = vec2( m_atlas->get_size() );
    105105        FT_Int32 flags = 0;
    106106        flags |= FT_LOAD_RENDER;
     
    116116        if( m_atlas->get_depth() >= 3 )
    117117        {
    118                 FT_Library_SetLcdFilter( (FT_Library)(m_rlibrary), FT_LCD_FILTER_LIGHT );
     118                FT_Library_SetLcdFilter( reinterpret_cast<FT_Library>( m_rlibrary ), FT_LCD_FILTER_LIGHT );
    119119                flags |= FT_LOAD_TARGET_LCD;
    120120                if ( m_filtering )
    121121                {
    122                         FT_Library_SetLcdFilterWeights( (FT_Library)(m_rlibrary), m_lcd_weights );
     122                        FT_Library_SetLcdFilterWeights( reinterpret_cast<FT_Library>( m_rlibrary ), m_lcd_weights );
    123123                }
    124124        }
     
    137137                int ft_glyph_top    = slot->bitmap_top;
    138138                int ft_glyph_left   = slot->bitmap_left;
    139                 int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : (int)depth);
     139                int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : int( depth ) );
    140140
    141141                ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 );
     
    161161                }
    162162
    163                 m_glyphs[ c ] = texture_glyph();
    164                 texture_glyph* g = &(m_glyphs.find( c )->second);
     163                texture_glyph* g = &( m_glyphs[c] );
    165164
    166165                g->charcode = c;
    167166                g->size     = gsize;
    168167                g->offset   = ivec2( ft_glyph_left, ft_glyph_top );
    169                 g->tl       = vec2( r.pos.x/(float)asize.x, r.pos.y/(float)asize.y );
    170                 g->br       = vec2( ( r.pos.x + gsize.x )/(float)asize.x, (r.pos.y + gsize.y )/(float)asize.y );
     168                g->tl       = vec2( r.pos ) / asize;
     169                g->br       = vec2( r.pos + gsize ) / asize;
    171170
    172171                // Discard hinting to get advance
    173172                FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING);
    174173                slot = face->glyph;
    175                 g->advance = ivec2( slot->advance.x/64.0, slot->advance.y/64.0 );
     174                g->advance = ivec2( slot->advance.x/64.0f, slot->advance.y/64.0f );
    176175        }
    177176        generate_kerning();
     
    181180texture_font::~texture_font()
    182181{
    183         if ( m_rface )    FT_Done_Face( (FT_Face)(m_rface) );
    184         if ( m_rlibrary ) FT_Done_FreeType( (FT_Library)(m_rlibrary) );
     182        if ( m_rface )    FT_Done_Face( reinterpret_cast<FT_Face>( m_rface ) );
     183        if ( m_rlibrary ) FT_Done_FreeType( reinterpret_cast<FT_Library>( m_rlibrary ) );
    185184}
    186185
Note: See TracChangeset for help on using the changeset viewer.