- Timestamp:
- 06/19/15 21:51:54 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/stl/container/hash_table_policy.hh
r404 r405 257 257 inline void entry_construct( entry_type* entry, hash_type hash_code, Args&&... params ) const 258 258 { 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() ) ); 260 266 entry->hash_code = hash_code; 261 267 } -
trunk/src/gfx/texture_font.cc
r403 r405 38 38 FT_Error error; 39 39 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) 44 44 }; 45 45 … … 50 50 m_lcd_weights[4] = 0x10; 51 51 52 error = FT_Init_FreeType( (FT_Library*)(&m_rlibrary) );52 error = FT_Init_FreeType( reinterpret_cast<FT_Library*>(&m_rlibrary) ); 53 53 NV_CHECK_FREETYPE_ERROR( error, "error on FT_Init_FreeType, code - ", error ); 54 54 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) ); 56 56 NV_CHECK_FREETYPE_ERROR( error, "error on FT_New_Face, code - ", error ); 57 57 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 ); 59 59 NV_CHECK_FREETYPE_ERROR( error, "error on FT_Set_Char_Size, code - ", error ); 60 60 61 FT_Set_Transform( (FT_Face)(m_rface), &matrix, NULL );61 FT_Set_Transform( reinterpret_cast<FT_Face>(m_rface), &matrix, NULL ); 62 62 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; 67 67 m_linegap = m_height - m_ascender + m_descender; 68 68 } … … 100 100 bool texture_font::load_glyphs( string_view codes ) 101 101 { 102 FT_Face face = (FT_Face)(m_rface);102 FT_Face face = reinterpret_cast<FT_Face>( m_rface ); 103 103 size_t depth = m_atlas->get_depth(); 104 ivec2 asize = m_atlas->get_size();104 vec2 asize = vec2( m_atlas->get_size() ); 105 105 FT_Int32 flags = 0; 106 106 flags |= FT_LOAD_RENDER; … … 116 116 if( m_atlas->get_depth() >= 3 ) 117 117 { 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 ); 119 119 flags |= FT_LOAD_TARGET_LCD; 120 120 if ( m_filtering ) 121 121 { 122 FT_Library_SetLcdFilterWeights( (FT_Library)(m_rlibrary), m_lcd_weights );122 FT_Library_SetLcdFilterWeights( reinterpret_cast<FT_Library>( m_rlibrary ), m_lcd_weights ); 123 123 } 124 124 } … … 137 137 int ft_glyph_top = slot->bitmap_top; 138 138 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 ) ); 140 140 141 141 ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 ); … … 161 161 } 162 162 163 m_glyphs[ c ] = texture_glyph(); 164 texture_glyph* g = &(m_glyphs.find( c )->second); 163 texture_glyph* g = &( m_glyphs[c] ); 165 164 166 165 g->charcode = c; 167 166 g->size = gsize; 168 167 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; 171 170 172 171 // Discard hinting to get advance 173 172 FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING); 174 173 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 ); 176 175 } 177 176 generate_kerning(); … … 181 180 texture_font::~texture_font() 182 181 { 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 ) ); 185 184 } 186 185
Note: See TracChangeset
for help on using the changeset viewer.