in place construction of glyph_positions

This commit is contained in:
Dane Springmeyer 2014-10-12 13:54:07 -07:00
parent 4e7feaf747
commit 2000c1713d
4 changed files with 6 additions and 6 deletions

View file

@ -72,7 +72,7 @@ public:
const_iterator begin() const;
const_iterator end() const;
void push_back(glyph_info const& glyph, pixel_position offset, rotation const& rot);
void emplace_back(glyph_info const& glyph, pixel_position offset, rotation const& rot);
void reserve(unsigned count);
pixel_position const& get_base_point() const;

View file

@ -65,7 +65,7 @@ text_render_thunk::text_render_thunk(placements_list const& placements,
for (glyph_position const& pos : *positions)
{
glyph_vec.push_back(pos.glyph);
new_pos.push_back(glyph_vec.back(), pos.pos, pos.rot);
new_pos.emplace_back(glyph_vec.back(), pos.pos, pos.rot);
}
placements_.push_back(new_positions);

View file

@ -48,9 +48,9 @@ glyph_positions::const_iterator glyph_positions::end() const
return data_.end();
}
void glyph_positions::push_back(glyph_info const& glyph, pixel_position offset, rotation const& rot)
void glyph_positions::emplace_back(glyph_info const& glyph, pixel_position offset, rotation const& rot)
{
data_.push_back(glyph_position(glyph, offset, rot));
data_.emplace_back(glyph, offset, rot);
}
void glyph_positions::reserve(unsigned count)

View file

@ -154,7 +154,7 @@ bool placement_finder::find_point_placement(pixel_position const& pos)
for (auto const& glyph : line)
{
// place the character relative to the center of the string envelope
glyphs->push_back(glyph, (pixel_position(x, y).rotate(orientation)) + layout_offset, orientation);
glyphs->emplace_back(glyph, (pixel_position(x, y).rotate(orientation)) + layout_offset, orientation);
if (glyph.advance())
{
//Only advance if glyph is not part of a multiple glyph sequence
@ -252,7 +252,7 @@ bool placement_finder::single_line_placement(vertex_cache &pp, text_upright_e or
box2d<double> bbox = get_bbox(layout, glyph, pos, rot);
if (collision(bbox, layouts_.text(), true)) return false;
bboxes.push_back(std::move(bbox));
glyphs->push_back(glyph, pos, rot);
glyphs->emplace_back(glyph, pos, rot);
}
// See comment above
offset -= sign * line.height()/2;