[CanvasText] Fix conditional compiles

This commit is contained in:
Scott Giese 2019-12-14 23:31:13 -06:00
parent 86f3169e4b
commit 879b01004b

View File

@ -61,13 +61,11 @@ namespace canvas
SGVec2i sizeForWidth(int w); SGVec2i sizeForWidth(int w);
#endif #endif
osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2) #if OSG_VERSION_LESS_THAN(3,3,2)
computeBound() osg::BoundingBox computeBound() const override;
#else #else
computeBoundingBox() osg::BoundingBox computeBoundingBox() const override;
#endif #endif
const override;
protected: protected:
friend class TextLine; friend class TextLine;
@ -129,7 +127,6 @@ namespace canvas
_quads = &text->_textureGlyphQuadMap.begin()->second; _quads = &text->_textureGlyphQuadMap.begin()->second;
#if OSG_VERSION_LESS_THAN(3,5,6) #if OSG_VERSION_LESS_THAN(3,5,6)
GlyphQuads::LineNumbers const& line_numbers = _quads->_lineNumbers; GlyphQuads::LineNumbers const& line_numbers = _quads->_lineNumbers;
GlyphQuads::LineNumbers::const_iterator begin_it = GlyphQuads::LineNumbers::const_iterator begin_it =
@ -143,8 +140,7 @@ namespace canvas
_end = std::upper_bound(begin_it, line_numbers.end(), _line) _end = std::upper_bound(begin_it, line_numbers.end(), _line)
- line_numbers.begin(); - line_numbers.begin();
#else #else
//OSG:TODO: Need 3.5.6 version of this // TODO: Need 3.5.6 version of this
#endif #endif
} }
@ -174,11 +170,17 @@ namespace canvas
if( empty() ) if( empty() )
return pos; return pos;
#if OSG_VERSION_LESS_THAN(3,3,5) #if OSG_VERSION_LESS_THAN(3,3,5)
GlyphQuads::Coords2 const& coords = _quads->_coords; GlyphQuads::Coords2 const& coords = _quads->_coords;
#elif OSG_VERSION_LESS_THAN(3,5,6) #elif OSG_VERSION_LESS_THAN(3,5,6)
GlyphQuads::Coords2 refCoords = _quads->_coords; GlyphQuads::Coords2 refCoords = _quads->_coords;
GlyphQuads::Coords2::element_type &coords = *refCoords.get(); GlyphQuads::Coords2::element_type &coords = *refCoords.get();
#else
// TODO: need 3.5.7 version of this.
return pos;
#endif
size_t global_i = _begin + i; size_t global_i = _begin + i;
if (global_i == _begin) if (global_i == _begin)
@ -201,9 +203,6 @@ namespace canvas
// position at center between characters // position at center between characters
pos.x() = 0.5 * (prev_r + cur_l); pos.x() = 0.5 * (prev_r + cur_l);
} }
#else
//OSG:TODO: need 3.5.7 version of this.
#endif
return pos; return pos;
} }
@ -214,13 +213,17 @@ namespace canvas
if (empty()) if (empty())
return cursorPos(0); return cursorPos(0);
GlyphQuads::Glyphs const& glyphs = _quads->_glyphs;
#if OSG_VERSION_LESS_THAN(3,3,5) #if OSG_VERSION_LESS_THAN(3,3,5)
GlyphQuads::Coords2 const& coords = _quads->_coords; GlyphQuads::Coords2 const& coords = _quads->_coords;
#elif OSG_VERSION_LESS_THAN(3,5,6) #elif OSG_VERSION_LESS_THAN(3,5,6)
GlyphQuads::Coords2 refCoords = _quads->_coords; GlyphQuads::Coords2 refCoords = _quads->_coords;
GlyphQuads::Coords2::element_type &coords = *refCoords.get(); GlyphQuads::Coords2::element_type &coords = *refCoords.get();
#else
// TODO: need 3.5.7 version of this.
return cursorPos(0);
#endif
GlyphQuads::Glyphs const& glyphs = _quads->_glyphs;
float const HIT_FRACTION = 0.6; float const HIT_FRACTION = 0.6;
float const character_width = _text->getCharacterHeight() float const character_width = _text->getCharacterHeight()
@ -240,10 +243,6 @@ namespace canvas
} }
return cursorPos(i - _begin); return cursorPos(i - _begin);
#else
//OSG:TODO: need 3.5.7 version of this.
return cursorPos(0);
#endif
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -647,19 +646,16 @@ namespace canvas
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2) #if OSG_VERSION_LESS_THAN(3,3,2)
Text::TextOSG::computeBound() osg::BoundingBox Text::TextOSG::computeBound() const
#else #else
Text::TextOSG::computeBoundingBox() osg::BoundingBox Text::TextOSG::computeBoundingBox() const
#endif #endif
const
{ {
osg::BoundingBox bb =
#if OSG_VERSION_LESS_THAN(3,3,2) #if OSG_VERSION_LESS_THAN(3,3,2)
osgText::Text::computeBound(); osg::BoundingBox bb = osgText::Text::computeBound();
#else #else
osgText::Text::computeBoundingBox(); osg::BoundingBox bb = osgText::Text::computeBoundingBox();
#endif #endif
#if OSG_VERSION_LESS_THAN(3,1,0) #if OSG_VERSION_LESS_THAN(3,1,0)