From 8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Sun, 5 Sep 2010 10:49:05 +0200 Subject: avoid constructing new strings implicit --- src/ClockTool.cc | 2 +- src/FbTk/MenuItem.cc | 6 +++--- src/FbTk/TextBox.cc | 2 +- src/FbTk/TextButton.cc | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ClockTool.cc b/src/ClockTool.cc index c2d029f..1e4dd58 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc @@ -255,7 +255,7 @@ void ClockTool::update(FbTk::Subject *subj) { unsigned int new_width = m_button.width(); unsigned int new_height = m_button.height(); translateSize(orientation(), new_width, new_height); - new_width = m_theme->font().textWidth(text.c_str(), text.size()); + new_width = m_theme->font().textWidth(text, text.size()); translateSize(orientation(), new_width, new_height); if (new_width != m_button.width() || new_height != m_button.height()) { resize(new_width, new_height); diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc index dcd7dd7..f995666 100644 --- a/src/FbTk/MenuItem.cc +++ b/src/FbTk/MenuItem.cc @@ -54,12 +54,12 @@ void MenuItem::drawLine(FbDrawable &draw, int bottom = height - bevelW - 1; text_y += bottom > underline_height ? underline_height : bottom; - int text_w = theme->frameFont().textWidth(m_label.c_str(), m_label.size()); + int text_w = theme->frameFont().textWidth(m_label, m_label.size()); // width of the searchstring size = size > m_label.length() ? m_label.length() : size; std::string search_string = m_label.substr(0,size); - int search_string_w = theme->frameFont().textWidth(search_string.c_str(), size); + int search_string_w = theme->frameFont().textWidth(search_string, size); // pay attention to the text justification switch(theme->frameFontJustify()) { @@ -157,7 +157,7 @@ void MenuItem::draw(FbDrawable &draw, // int text_y = y, text_x = x; - int text_w = theme->frameFont().textWidth(label().c_str(), label().size()); + int text_w = theme->frameFont().textWidth(label(), label().size()); int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth()); text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2; diff --git a/src/FbTk/TextBox.cc b/src/FbTk/TextBox.cc index 87ad609..87e18e8 100644 --- a/src/FbTk/TextBox.cc +++ b/src/FbTk/TextBox.cc @@ -369,7 +369,7 @@ void TextBox::adjustEndPos() { void TextBox::adjustStartPos() { - int text_width = font().textWidth(text().c_str(), m_end_pos); + int text_width = font().textWidth(text(), m_end_pos); if (text_width < static_cast(width())) return; diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 380537e..04aa367 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc @@ -126,7 +126,7 @@ void TextButton::clearArea(int x, int y, unsigned int TextButton::textWidth() const { - return font().textWidth(text().data(), text().size()); + return font().textWidth(text(), text().size()); } void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { @@ -161,7 +161,7 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) { font().drawText(*drawable, screenNumber(), gc(), // graphic context - text().data(), textlen, // string and string size + text(), textlen, // string and string size textx, texty, m_orientation); // position } -- cgit v0.11.2