cairo: avoid creating evaluated_format_properties_ptr on stack

This commit is contained in:
Dane Springmeyer 2014-10-11 11:37:16 -07:00
parent e1eb9fa5b1
commit 51620e2b4d

View File

@ -443,23 +443,16 @@ void cairo_context::add_text(glyph_positions_ptr path,
//render halo
double halo_radius = 0;
evaluated_format_properties_ptr format;
set_operator(halo_comp_op);
for (auto const& glyph_pos : *path)
{
glyph_info const& glyph = glyph_pos.glyph;
if (glyph.format)
{
format = glyph.format;
// Settings have changed.
halo_radius = format->halo_radius * scale_factor;
}
face_set_ptr faces = font_manager.get_face_set(glyph.format->face_name, glyph.format->fontset);
halo_radius = glyph.format->halo_radius * scale_factor;
// make sure we've got reasonable values.
if (halo_radius <= 0.0 || halo_radius > 1024.0) continue;
face_set_ptr faces = font_manager.get_face_set(format->face_name, format->fontset);
double text_size = format->text_size * scale_factor;
double text_size = glyph.format->text_size * scale_factor;
faces->set_character_sizes(text_size);
cairo_matrix_t matrix;
@ -475,21 +468,16 @@ void cairo_context::add_text(glyph_positions_ptr path,
glyph_path(glyph.glyph_index, pixel_position(sx + pos.x, sy - pos.y));
set_line_width(2.0 * halo_radius);
set_line_join(ROUND_JOIN);
set_color(format->halo_fill, format->halo_opacity);
set_color(glyph.format->halo_fill, glyph.format->halo_opacity);
stroke();
}
set_operator(comp_op);
for (auto const& glyph_pos : *path)
{
glyph_info const& glyph = glyph_pos.glyph;
face_set_ptr faces = font_manager.get_face_set(glyph.format->face_name, glyph.format->fontset);
if (glyph.format)
{
format = glyph.format;
}
face_set_ptr faces = font_manager.get_face_set(format->face_name, format->fontset);
double text_size = format->text_size * scale_factor;
double text_size = glyph.format->text_size * scale_factor;
faces->set_character_sizes(text_size);
cairo_matrix_t matrix;
@ -502,7 +490,7 @@ void cairo_context::add_text(glyph_positions_ptr path,
set_font_matrix(matrix);
set_font_face(manager, glyph.face);
pixel_position pos = glyph_pos.pos + glyph.offset.rotate(glyph_pos.rot);
set_color(format->fill, format->text_opacity);
set_color(glyph.format->fill, glyph.format->text_opacity);
show_glyph(glyph.glyph_index, pixel_position(sx + pos.x, sy - pos.y));
}