Return early in osgText::Text property setters

Matches what the rest of the properties are doing & avoids unnecessary
computation.
This commit is contained in:
Calum Robinson 2020-05-29 11:03:56 +01:00 committed by Robert Osfield
parent e0b288fe37
commit 2b64d30fca

View File

@ -1342,6 +1342,8 @@ void Text::setBackdropType(BackdropType type)
void Text::setBackdropOffset(float offset) void Text::setBackdropOffset(float offset)
{ {
if (_backdropHorizontalOffset == offset && _backdropVerticalOffset == offset) return;
_backdropHorizontalOffset = offset; _backdropHorizontalOffset = offset;
_backdropVerticalOffset = offset; _backdropVerticalOffset = offset;
@ -1352,6 +1354,8 @@ void Text::setBackdropOffset(float offset)
void Text::setBackdropOffset(float horizontal, float vertical) void Text::setBackdropOffset(float horizontal, float vertical)
{ {
if (_backdropHorizontalOffset == horizontal && _backdropVerticalOffset == vertical) return;
_backdropHorizontalOffset = horizontal; _backdropHorizontalOffset = horizontal;
_backdropVerticalOffset = vertical; _backdropVerticalOffset = vertical;
@ -1362,6 +1366,8 @@ void Text::setBackdropOffset(float horizontal, float vertical)
void Text::setBackdropColor(const osg::Vec4& color) void Text::setBackdropColor(const osg::Vec4& color)
{ {
if (_backdropColor==color) return;
_backdropColor = color; _backdropColor = color;
assignStateSet(); assignStateSet();