LCOV - code coverage report
Current view: top level - eq/util - bitmapFont.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 1 24 4.2 %
Date: 2014-06-18 Functions: 2 7 28.6 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2008-2014, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #include "bitmapFont.h"
      19             : #include "objectManager.h"
      20             : 
      21             : #include <eq/client/gl.h>
      22             : #include <eq/client/windowSystem.h>
      23             : 
      24             : namespace eq
      25             : {
      26             : namespace util
      27             : {
      28             : 
      29           0 : BitmapFont::BitmapFont( ObjectManager& gl, const void* key )
      30             :         // We create a new shared object manager. Typically we are exited by
      31             :         // the last user, at which point the given OM may have been deleted
      32             :         : _gl( gl )
      33           0 :         , _key( key )
      34             : {
      35           0 : }
      36             : 
      37           0 : BitmapFont::~BitmapFont()
      38             : {
      39           0 :     const GLuint lists = _gl.getList( _key );
      40           0 :     if( lists != ObjectManager::INVALID )
      41           0 :         LBWARN << "OpenGL BitmapFont was not freed" << std::endl;
      42           0 : }
      43             : 
      44           0 : bool BitmapFont::init( const WindowSystem& ws, const std::string& name,
      45             :                        const uint32_t size )
      46             : {
      47           0 :     return ws.setupFont( _gl, _key, name, size );
      48             : }
      49             : 
      50           0 : void BitmapFont::exit()
      51             : {
      52           0 :     GLuint lists = _gl.getList( _key );
      53           0 :     if( lists != ObjectManager::INVALID )
      54           0 :         _gl.deleteList( _key );
      55           0 : }
      56             : 
      57           0 : void BitmapFont::draw( const std::string& text ) const
      58             : {
      59           0 :     const GLuint lists = _gl.getList( _key );
      60           0 :     LBASSERTINFO( lists != ObjectManager::INVALID,
      61             :                   "Font not initialized" );
      62             : 
      63           0 :     if( lists != ObjectManager::INVALID )
      64             :     {
      65           0 :         glListBase( lists );
      66           0 :         glCallLists( GLsizei( text.size( )), GL_UNSIGNED_BYTE, text.c_str( ));
      67           0 :         glListBase( 0 );
      68             :     }
      69           0 : }
      70             : 
      71             : }
      72          36 : }

Generated by: LCOV version 1.10