From 6985f45882b0fcfcbd4bd7d468c385b4af8c1fd4 Mon Sep 17 00:00:00 2001 From: Calum Robinson Date: Fri, 29 May 2020 11:03:56 +0100 Subject: [PATCH] Return early in osgText::Text property setters Matches what the rest of the properties are doing & avoids unnecessary computation. --- src/osgText/Text.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index a5991ab4d..86b800e77 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -1342,6 +1342,8 @@ void Text::setBackdropType(BackdropType type) void Text::setBackdropOffset(float offset) { + if (_backdropHorizontalOffset == offset && _backdropVerticalOffset == offset) return; + _backdropHorizontalOffset = offset; _backdropVerticalOffset = offset; @@ -1352,6 +1354,8 @@ void Text::setBackdropOffset(float offset) void Text::setBackdropOffset(float horizontal, float vertical) { + if (_backdropHorizontalOffset == horizontal && _backdropVerticalOffset == vertical) return; + _backdropHorizontalOffset = horizontal; _backdropVerticalOffset = vertical; @@ -1362,6 +1366,8 @@ void Text::setBackdropOffset(float horizontal, float vertical) void Text::setBackdropColor(const osg::Vec4& color) { + if (_backdropColor==color) return; + _backdropColor = color; assignStateSet();