Changeset 649 for trunk

Show
Ignore:
Timestamp:
02/12/08 15:05:04 (9 months ago)
Author:
artem
Message:

pass parameter by reference
store reference to wstring in text_path

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/mapnik/font_engine_freetype.hpp

    r547 r649  
    308308        } 
    309309         
    310         void get_string_info(string_info *info) 
    311         { 
    312             unsigned width = 0; 
    313             unsigned height = 0; 
    314  
    315             std::wstring text = info->get_string(); 
    316  
    317             for (std::wstring::const_iterator i=text.begin();i!=text.end();++i) 
    318             { 
     310          void get_string_info(string_info & info) 
     311          { 
     312             unsigned width = 0; 
     313             unsigned height = 0; 
     314              
     315             std::wstring const& text = info.get_string(); 
     316             
     317             for (std::wstring::const_iterator i=text.begin();i!=text.end();++i) 
     318             { 
    319319                dimension_t char_dim = character_dimensions(*i); 
    320                
    321                 info->add_info(*i, char_dim.first, char_dim.second); 
    322                
     320                 
     321                info.add_info(*i, char_dim.first, char_dim.second); 
     322                 
    323323                width += char_dim.first; 
    324324                height = char_dim.second > height ? char_dim.second : height; 
    325325                 
    326             } 
    327             info->set_dimensions(width, height); 
    328         } 
    329          
     326             } 
     327             info.set_dimensions(width, height); 
     328          } 
     329           
    330330        void render(double x0, double y0) 
    331331        { 
  • trunk/include/mapnik/text_path.hpp

    r597 r649  
    5151      protected: 
    5252         typedef boost::ptr_vector<character_info> characters_t; 
    53          std::wstring string_; 
    5453         characters_t characters_; 
    55  
     54         std::wstring const& text_; 
    5655         double width_; 
    5756         double height_; 
    5857      public: 
    59          string_info(std::wstring string) 
    60             : string_(string), 
     58         string_info(std::wstring const& text) 
     59            : text_(text), 
    6160              width_(0), 
    6261              height_(0) {} 
     
    9594         std::wstring const&  get_string() const  
    9695         { 
    97             return string_; 
     96           return text_; 
    9897         } 
    9998   }; 
  • trunk/src/agg_renderer.cpp

    r637 r649  
    467467            ren.set_pixel_size(sym.get_text_size()); 
    468468            ren.set_fill(sym.get_fill()); 
     469             
    469470            string_info info(text); 
    470             ren.get_string_info(&info); 
     471            ren.get_string_info(info); 
    471472             
    472473            placement_finder<label_collision_detector4> finder(detector_); 
     
    682683            
    683684            string_info info(text); 
    684             ren.get_string_info(&info); 
     685            ren.get_string_info(info); 
    685686            unsigned num_geom = feature.num_geometries(); 
    686687            for (unsigned i=0;i<num_geom;++i)