Changeset 121 for trunk/src/gfx


Ignore:
Timestamp:
06/15/13 17:47:57 (12 years ago)
Author:
epyon
Message:
  • Nova builds with -Weverything/-Wall/-pedantic/etc on: on MSVC 2012 on GCC 4.6.3 on clang 3.2
  • ... without a single fucking warning.
Location:
trunk/src/gfx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gfx/image.cc

    r90 r121  
    1212        : m_size( size ), m_depth( depth ), m_data( nullptr )
    1313{
    14         m_data = new uint8[ m_size.x * m_size.y * m_depth ];
     14        m_data = new uint8[ static_cast<uint16>( m_size.x * m_size.y ) * m_depth ];
    1515}
    1616
     
    2525        : m_size( size ), m_depth( depth ), m_data( nullptr )
    2626{
    27         std::size_t bsize = m_size.x * m_size.y * m_depth;
    28         m_data = new uint8[ m_size.x * m_size.y * m_depth ];
     27        sint32 bsize = m_size.x * m_size.y * static_cast<sint32>( m_depth );
     28        m_data = new uint8[ bsize ];
    2929
    3030        if ( reversed )
    3131        {
    32                 std::size_t bline = m_size.x * m_depth;
     32                sint32 bline = m_size.x * static_cast<sint32>( m_depth );
    3333                for( int i = 0; i < m_size.y; ++i )
    3434                {
     
    4545void image::fill( uint8 value )
    4646{
    47         std::fill( m_data, m_data + m_size.x * m_size.y * m_depth, value );
     47        std::fill( m_data, m_data + m_size.x * m_size.y * (int)m_depth, value );
    4848}
    4949
    50 void image::set_region( region r, const uint8 * data, size_t stride )
     50void image::set_region( region r, const uint8 * data, int stride )
    5151{
    52         if ( stride == 0 ) stride = r.size.x * m_depth;
     52        if ( stride == 0 ) stride = r.size.x * static_cast<sint32>( m_depth );
    5353       
    54         std::size_t bpos  = (r.pos.y*m_size.x + r.pos.x ) * m_depth;
    55         std::size_t bline = m_size.x*m_depth;
     54        sint32 bpos  = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth );
     55        sint32 bline = m_size.x*static_cast<sint32>( m_depth );
    5656
    5757        for( int i = 0; i < r.size.y; ++i )
  • trunk/src/gfx/texture_atlas.cc

    r89 r121  
    3737                        {
    3838                                best_height = y + size.y;
    39                                 best_index = i;
     39                                best_index = static_cast<int>( i );
    4040                                best_width = node.z;
    4141                                r.pos.x = node.x;
     
    5252        m_nodes.insert( m_nodes.begin() + best_index, glm::ivec3( r.pos.x, r.pos.y + size.y, size.x ) );
    5353
    54         for( size_t i = best_index+1; i < m_nodes.size(); ++i )
     54        for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i )
    5555        {
    5656                glm::ivec3 node = m_nodes[ i ];
     
    6565                        if (m_nodes[ i ].z <= 0)
    6666                        {
    67                                 m_nodes.erase( m_nodes.begin() + i );
     67                                m_nodes.erase( m_nodes.begin() + static_cast<int>(i) );
    6868                                --i;
    6969                        }
     
    7979        }
    8080        merge();
    81         m_used += size.x * size.y;
     81        m_used += static_cast<uint16>(size.x * size.y);
    8282        return r;
    8383}
     
    119119                {
    120120                        m_nodes[ i ].z += m_nodes[ i+1 ].z;
    121             m_nodes.erase( m_nodes.begin()+i+1 );
     121            m_nodes.erase( m_nodes.begin()+static_cast<int>(i+1) );
    122122                        --i;
    123123                }
  • trunk/src/gfx/texture_font.cc

    r114 r121  
    1717}
    1818
    19 float texture_glyph::get_kerning( const uint16 charcode )
     19float texture_glyph::get_kerning( const uint16 other )
    2020{
    21         auto i = kerning.find( charcode );
     21        auto i = kerning.find( other );
    2222        return i != kerning.end() ? i->second : 0.0f;
    2323}
     
    118118        }
    119119
    120         for ( char c : codes )
     120        for ( char ch : codes )
    121121        {
     122                uint16 c = static_cast<uint16>( ch );
    122123                FT_UInt glyph_index = FT_Get_Char_Index( face, c );
    123124                FT_Error error = FT_Load_Glyph( face, glyph_index, flags );
     
    136137                int ft_glyph_top    = slot->bitmap_top;
    137138                int ft_glyph_left   = slot->bitmap_left;
    138                 int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : depth);
     139                int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : (int)depth);
    139140
    140141                glm::ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 );
Note: See TracChangeset for help on using the changeset viewer.