LCOV - code coverage report
Current view: top level - eq - transferFinder.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 18 18 100.0 %
Date: 2017-12-16 05:07:20 Functions: 3 4 75.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2013-2017, Stefan.Eilemann@epfl.ch
       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             : #ifndef EQ_TRANSFERFINDER_H
      19             : #define EQ_TRANSFERFINDER_H
      20             : 
      21             : #include <pression/plugin.h>
      22             : #include <pression/pluginVisitor.h>
      23             : #include <pression/plugins/compressor.h>
      24             : 
      25             : namespace eq
      26             : {
      27             : namespace
      28             : {
      29             : class TransferFinder : public pression::ConstPluginVisitor
      30             : {
      31             : public:
      32          12 :     TransferFinder(const uint32_t internal, const uint32_t external,
      33             :                    const uint64_t caps, const float minQuality,
      34             :                    const bool ignoreAlpha, const GLEWContext* gl)
      35          12 :         : internal_(internal)
      36             :         , external_(external)
      37          12 :         , caps_(caps | EQ_COMPRESSOR_TRANSFER)
      38             :         , minQuality_(minQuality)
      39             :         , ignoreAlpha_(ignoreAlpha)
      40          24 :         , gl_(gl)
      41             :     {
      42          12 :     }
      43             : 
      44          12 :     virtual ~TransferFinder() {}
      45         624 :     fabric::VisitorResult visit(const pression::Plugin& plugin,
      46             :                                 const EqCompressorInfo& info) final
      47             :     {
      48        1608 :         if (((info.capabilities & caps_) == caps_) &&
      49         720 :             (internal_ == EQ_COMPRESSOR_DATATYPE_NONE ||
      50         426 :              info.tokenType == internal_) &&
      51         132 :             (external_ == EQ_COMPRESSOR_DATATYPE_NONE ||
      52          78 :              info.outputTokenType == external_) &&
      53          24 :             (info.quality >= minQuality_) &&
      54          24 :             (ignoreAlpha_ ||
      55         660 :              !(info.capabilities & EQ_COMPRESSOR_IGNORE_ALPHA)) &&
      56          12 :             (!gl_ || plugin.isCompatible(info.name, gl_)))
      57             :         {
      58          12 :             result.push_back(info);
      59             :         }
      60         624 :         return fabric::TRAVERSE_CONTINUE;
      61             :     }
      62             : 
      63             :     EqCompressorInfos result;
      64             : 
      65             : private:
      66             :     const uint32_t internal_;
      67             :     const uint32_t external_;
      68             :     const uint64_t caps_;
      69             :     const float minQuality_;
      70             :     const bool ignoreAlpha_;
      71             :     const GLEWContext* gl_;
      72             : };
      73             : }
      74             : }
      75             : #endif

Generated by: LCOV version 1.11