Avoid surface copying when rendering text
This was a small proposed change as part of PR #844. While that PR is rather outdated at this point, this seemed like a simple, useful change.
This commit is contained in:
parent
1e8d8ff7d7
commit
f70f1b37e4
3 changed files with 3 additions and 3 deletions
|
@ -100,7 +100,7 @@ pango_text::~pango_text()
|
|||
surface_.assign(nullptr);
|
||||
}
|
||||
|
||||
surface pango_text::render() const
|
||||
surface& pango_text::render() const
|
||||
{
|
||||
this->rerender();
|
||||
return surface_;
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
* Before rendering it tests whether a redraw is needed and if so it first
|
||||
* redraws the surface before returning it.
|
||||
*/
|
||||
surface render() const;
|
||||
surface& render() const;
|
||||
|
||||
/** Returns the width needed for the text. */
|
||||
int get_width() const;
|
||||
|
|
|
@ -1346,7 +1346,7 @@ void text_shape::draw(surface& canvas,
|
|||
: PANGO_ELLIPSIZE_END)
|
||||
.set_characters_per_line(characters_per_line_);
|
||||
|
||||
surface surf = text_renderer.render();
|
||||
surface& surf = text_renderer.render();
|
||||
if(surf->w == 0) {
|
||||
DBG_GUI_D << "Text: Rendering '" << text
|
||||
<< "' resulted in an empty canvas, leave.\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue