moving instead of copying mapnik::glyph_info
This commit is contained in:
parent
a5547b0473
commit
3c72aedba0
5 changed files with 6 additions and 6 deletions
|
@ -80,7 +80,7 @@ static void shape_text(text_line & line,
|
|||
tmp.scale_multiplier = size / face->get_face()->units_per_EM;
|
||||
tmp.offset.clear();
|
||||
width_map[i] += tmp.advance();
|
||||
line.add_glyph(tmp, scale_factor);
|
||||
line.add_glyph(std::move(tmp), scale_factor);
|
||||
}
|
||||
line.update_max_char_height(face->get_char_height(size));
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ static void shape_text(text_line & line,
|
|||
|
||||
tmp.offset.set(positions[i].x_offset * tmp.scale_multiplier, positions[i].y_offset * tmp.scale_multiplier);
|
||||
width_map[glyphs[i].cluster] += tmp.advance();
|
||||
line.add_glyph(tmp, scale_factor);
|
||||
line.add_glyph(std::move(tmp), scale_factor);
|
||||
}
|
||||
line.update_max_char_height(face->get_char_height(size));
|
||||
break; //When we reach this point the current font had all glyphs.
|
||||
|
|
|
@ -107,7 +107,7 @@ static void shape_text(text_line & line,
|
|||
face->glyph_dimensions(tmp);
|
||||
tmp.scale_multiplier = size / face->get_face()->units_per_EM;
|
||||
width_map[i] += tmp.advance();
|
||||
line.add_glyph(tmp, scale_factor);
|
||||
line.add_glyph(std::move(tmp), scale_factor);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
/** Get glyph vector. */
|
||||
glyph_vector const& glyphs() const { return glyphs_; }
|
||||
/** Append glyph. */
|
||||
void add_glyph(glyph_info const& glyph, double scale_factor_);
|
||||
void add_glyph(glyph_info && glyph, double scale_factor_);
|
||||
|
||||
/** Preallocate memory. */
|
||||
void reserve(glyph_vector::size_type length);
|
||||
|
|
|
@ -34,7 +34,7 @@ text_line::text_line(unsigned first_char, unsigned last_char)
|
|||
first_line_(false)
|
||||
{}
|
||||
|
||||
void text_line::add_glyph(glyph_info const& glyph, double scale_factor_)
|
||||
void text_line::add_glyph(glyph_info && glyph, double scale_factor_)
|
||||
{
|
||||
line_height_ = std::max(line_height_, glyph.line_height() + glyph.format->line_spacing);
|
||||
double advance = glyph.advance();
|
||||
|
@ -47,7 +47,7 @@ void text_line::add_glyph(glyph_info const& glyph, double scale_factor_)
|
|||
// Only add character spacing if the character is not a zero-width part of a cluster.
|
||||
width_ += advance + glyphs_.back().format->character_spacing * scale_factor_;
|
||||
}
|
||||
glyphs_.push_back(glyph);
|
||||
glyphs_.push_back(std::move(glyph));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue