LCOV - code coverage report
Current view: top level - eq/client/compressor - compressorReadDrawPixels.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 4 6 66.7 %
Date: 2014-06-18 Functions: 2 3 66.7 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
       3             :  *               2010-2014, Stefan Eilemann <eile@eyescale.ch>
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #ifndef EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
      20             : #define EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
      21             : 
      22             : #include "compressor.h"
      23             : #include <eq/client/gl.h>
      24             : #include <eq/util/types.h>
      25             : 
      26             : namespace eq
      27             : {
      28             : namespace plugin
      29             : {
      30             : 
      31             : enum FlushMode
      32             : {
      33             :     FLUSH_TEXTURE,
      34             :     KEEP_TEXTURE
      35             : };
      36             : 
      37             : class CompressorReadDrawPixels : public Compressor
      38             : {
      39             : public:
      40             :     CompressorReadDrawPixels( const unsigned name );
      41             :     virtual ~CompressorReadDrawPixels();
      42             : 
      43           2 :     static void* getNewCompressor( const unsigned name )
      44           2 :         { return new CompressorReadDrawPixels( name ); }
      45             : 
      46           3 :     static void* getNewDecompressor( const unsigned name )
      47           3 :         { return new CompressorReadDrawPixels( name ); }
      48             : 
      49           0 :     virtual void compress( const void* const, const uint64_t, const bool )
      50           0 :         { LBDONTCALL; }
      51             : 
      52             :     static bool isCompatible( const GLEWContext* );
      53             : 
      54             :     void download( const GLEWContext*, const eq_uint64_t*, const unsigned,
      55             :                    const eq_uint64_t, eq_uint64_t*, void** ) override;
      56             : 
      57             :     void upload( const GLEWContext*, const void*, const eq_uint64_t*,
      58             :                  const eq_uint64_t, const eq_uint64_t*,
      59             :                  const unsigned ) override;
      60             : 
      61             :     void startDownload( const GLEWContext*, const eq_uint64_t*, const unsigned,
      62             :                         const eq_uint64_t) override;
      63             : 
      64             :     void finishDownload( const GLEWContext*, const eq_uint64_t*,
      65             :                          const eq_uint64_t, eq_uint64_t*, void** ) override;
      66             : 
      67             : protected:
      68             :     lunchbox::Bufferb _buffer;
      69             :     util::Texture*    _texture;
      70             :     util::PixelBufferObject* _pbo;
      71             :     unsigned    _internalFormat; //!< the GL format
      72             :     unsigned    _format;         //!< the GL format
      73             :     unsigned    _type;           //!< the GL type
      74             :     const unsigned _depth;       //!< the size of one output token
      75             : 
      76             :     void _resizeBuffer( const eq_uint64_t );
      77             :     void _initTexture( const GLEWContext*, const eq_uint64_t );
      78             :     void _initAsyncTexture( const GLEWContext*, const eq_uint64_t,
      79             :                             const eq_uint64_t );
      80             :     bool _initPBO( const GLEWContext*, const eq_uint64_t );
      81             :     void _initDownload( const GLEWContext*, const eq_uint64_t*, eq_uint64_t* );
      82             :     void* _downloadTexture( const GLEWContext* glewContext,
      83             :                             const FlushMode mode );
      84             : };
      85             : 
      86             : }
      87             : }
      88             : #endif // EQ_PLUGIN_COMPRESSORREADDRAWPIXELS

Generated by: LCOV version 1.10