From 1e78098967f5283ae4c34afb299b89283d85fcce Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 12 Jun 2015 08:04:42 +0000 Subject: [PATCH] From Farshid Lashkari, "I've modified some setter methods of TextBase to avoid unnecessary calls to computeGlyphRepresentation() if the value has not changed." git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14912 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgText/TextBase.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/osgText/TextBase.cpp b/src/osgText/TextBase.cpp index ebfda7875..88534cf5a 100644 --- a/src/osgText/TextBase.cpp +++ b/src/osgText/TextBase.cpp @@ -105,12 +105,17 @@ void TextBase::setFont(const std::string& fontfile) void TextBase::setFontResolution(unsigned int width, unsigned int height) { - _fontSize = FontResolution(width,height); + FontResolution size(width,height); + if (_fontSize==size) return; + + _fontSize = size; computeGlyphRepresentation(); } void TextBase::setCharacterSize(float height) { + if (_characterHeight==height) return; + _characterHeight = height; computeGlyphRepresentation(); } @@ -126,18 +131,24 @@ void TextBase::setCharacterSize(float height, float aspectRatio) void TextBase::setMaximumWidth(float maximumWidth) { + if (_maximumWidth==maximumWidth) return; + _maximumWidth = maximumWidth; computeGlyphRepresentation(); } void TextBase::setMaximumHeight(float maximumHeight) { + if (_maximumHeight==maximumHeight) return; + _maximumHeight = maximumHeight; computeGlyphRepresentation(); } void TextBase::setLineSpacing(float lineSpacing) { + if (_lineSpacing==lineSpacing) return; + _lineSpacing = lineSpacing; computeGlyphRepresentation(); }