LCOV - code coverage report
Current view: top level - eq/fabric - colorMask.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 14 14 100.0 %
Date: 2017-12-16 05:07:20 Functions: 2 2 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2007-2017, 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             : #ifndef EQFABRIC_COLORMASK_H
      19             : #define EQFABRIC_COLORMASK_H
      20             : 
      21             : #include <eq/fabric/api.h>
      22             : #include <iostream>
      23             : #include <lunchbox/bitOperation.h>
      24             : 
      25             : namespace eq
      26             : {
      27             : namespace fabric
      28             : {
      29             : /**
      30             :  * Defines which parts of the color buffer are to be written.
      31             :  *
      32             :  * Used to configure anaglyphic stereo rendering.
      33             :  */
      34             : class ColorMask
      35             : {
      36             : public:
      37             :     /** Construct a color mask with all components enabled. @version 1.0 */
      38        3783 :     ColorMask()
      39        3783 :         : red(true)
      40             :         , green(true)
      41             :         , blue(true)
      42        3783 :         , alpha(true)
      43             :     {
      44        3783 :     }
      45             : 
      46             :     /** Construct a color mask with given default values. @version 1.0 */
      47             :     ColorMask(const bool r, const bool g, const bool b, const bool a = true)
      48             :         : red(r)
      49             :         , green(g)
      50             :         , blue(b)
      51             :         , alpha(a)
      52             :     {
      53             :     }
      54             : 
      55             :     bool red;
      56             :     bool green;
      57             :     bool blue;
      58             :     bool alpha;
      59             : 
      60             :     EQFABRIC_API static const ColorMask ALL;
      61             : };
      62             : 
      63          12 : inline std::ostream& operator<<(std::ostream& os, const ColorMask& mask)
      64             : {
      65          12 :     os << "[ ";
      66          12 :     if (mask.red)
      67          10 :         os << "RED ";
      68          12 :     if (mask.green)
      69          10 :         os << "GREEN ";
      70          12 :     if (mask.blue)
      71          10 :         os << "BLUE ";
      72          12 :     os << "]";
      73             : 
      74          12 :     return os;
      75             : }
      76             : }
      77             : }
      78             : 
      79             : #endif // EQFABRIC_COLORMASK_H

Generated by: LCOV version 1.11