From 1ea60c472c21db87f07cd81c4df440046a907cfd Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 26 Feb 2013 11:45:24 -0500 Subject: [PATCH] + pass pixel_position by const ref + use BOOST_FOREACH for brevety --- include/mapnik/font_engine_freetype.hpp | 10 +++++----- src/font_engine_freetype.cpp | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/mapnik/font_engine_freetype.hpp b/include/mapnik/font_engine_freetype.hpp index b8293c423..b68b76a56 100644 --- a/include/mapnik/font_engine_freetype.hpp +++ b/include/mapnik/font_engine_freetype.hpp @@ -312,9 +312,9 @@ public: { std::vector const& names = fset.get_face_names(); face_set_ptr face_set = boost::make_shared(); - for (std::vector::const_iterator name = names.begin(); name != names.end(); ++name) + BOOST_FOREACH( std::string const& name, names) { - face_ptr face = get_face(*name); + face_ptr face = get_face(name); if (face) { face_set->add(face); @@ -323,7 +323,7 @@ public: else { MAPNIK_LOG_DEBUG(font_engine_freetype) - << "Failed to find face '" << *name + << "Failed to find face '" << name << "' in font set '" << fset.get_name() << "'\n"; } #endif @@ -375,8 +375,8 @@ struct text_renderer : private mapnik::noncopyable composite_mode_e comp_op = src_over, double scale_factor=1.0); box2d prepare_glyphs(text_path const& path); - void render(pixel_position pos); - void render_id(int feature_id, pixel_position pos, double min_radius=1.0); + void render(pixel_position const& pos); + void render_id(int feature_id, pixel_position const& pos, double min_radius=1.0); private: diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 51ae681d1..478488557 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -236,7 +236,8 @@ char_info font_face_set::character_dimensions(unsigned int c) //Check if char is already in cache std::map::const_iterator itr; itr = dimension_cache_.find(c); - if (itr != dimension_cache_.end()) { + if (itr != dimension_cache_.end()) + { return itr->second; } @@ -351,7 +352,7 @@ box2d text_renderer::prepare_glyphs(text_path const& path) bbox.xMin = bbox.yMin = 32000; // Initialize these so we can tell if we bbox.xMax = bbox.yMax = -32000; // properly grew the bbox later - for (int i = 0; i < path.num_nodes(); i++) + for (int i = 0; i < path.num_nodes(); ++i) { char_info_ptr c; double x, y, angle; @@ -436,7 +437,7 @@ void composite_bitmap(T & pixmap, FT_Bitmap *bitmap, unsigned rgba, int x, int y } template -void text_renderer::render(pixel_position pos) +void text_renderer::render(pixel_position const& pos) { FT_Error error; FT_Vector start; @@ -501,7 +502,7 @@ void text_renderer::render(pixel_position pos) template -void text_renderer::render_id(int feature_id, pixel_position pos, double min_radius) +void text_renderer::render_id(int feature_id, pixel_position const& pos, double min_radius) { FT_Error error; FT_Vector start; @@ -540,11 +541,11 @@ void text_renderer::render_id(int feature_id, pixel_position pos, double min_ boost::mutex freetype_engine::mutex_; #endif std::map > freetype_engine::name2file_; -template void text_renderer::render(pixel_position); +template void text_renderer::render(pixel_position const&); template text_renderer::text_renderer(image_32&, face_manager&, stroker&, composite_mode_e, double); template box2dtext_renderer::prepare_glyphs(text_path const&); -template void text_renderer::render_id(int, pixel_position, double ); +template void text_renderer::render_id(int, pixel_position const& , double ); template text_renderer::text_renderer(grid&, face_manager&, stroker&, composite_mode_e, double); template box2dtext_renderer::prepare_glyphs(text_path const& ); }