LCOV - code coverage report
Current view: top level - eq/fabric - viewport.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 2 28 7.1 %
Date: 2016-09-29 05:02:09 Functions: 2 3 66.7 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2008-2010, 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 "viewport.h"
      19             : #include "pixelViewport.h"
      20             : 
      21             : namespace eq
      22             : {
      23             : namespace fabric
      24             : {
      25          28 : const Viewport Viewport::FULL;
      26             : 
      27           0 : void Viewport::applyView( const Viewport& segmentVP, const Viewport& viewVP,
      28             :                           const PixelViewport& pvp, const Vector4i& overdraw )
      29             : {
      30             :     // part of view covered by segment/view channel
      31           0 :     Viewport contribution( segmentVP );
      32           0 :     contribution.intersect( viewVP );
      33           0 :     contribution.transform( viewVP );
      34             :         
      35             :     // extend by overdraw percentage
      36           0 :     LBASSERT( pvp.hasArea( ));
      37             : 
      38           0 :     const float xDelta(( static_cast< float >( overdraw.x() + pvp.w ) /
      39           0 :                          static_cast< float >( pvp.w ) - 1.0f ) * 
      40           0 :                        contribution.w );
      41           0 :     contribution.x -= xDelta;
      42           0 :     contribution.w += (( static_cast< float >( overdraw.z() + pvp.w ) /
      43           0 :                          static_cast< float >( pvp.w ) - 1.0f ) * 
      44           0 :                        contribution.w ); 
      45           0 :     contribution.w += xDelta;
      46             : 
      47           0 :     const float yDelta(( static_cast< float >( overdraw.y() + pvp.h ) /
      48           0 :                          static_cast< float >( pvp.h ) - 1.0f ) *
      49           0 :                        contribution.h ); 
      50           0 :     contribution.y -= yDelta;
      51           0 :     contribution.h += (( static_cast< float >( overdraw.w() + pvp.h ) /
      52           0 :                          static_cast< float >( pvp.h ) - 1.0f ) *
      53           0 :                        contribution.h ); 
      54           0 :     contribution.h += yDelta;
      55             :     
      56           0 :     x = contribution.x + x * contribution.w;
      57           0 :     y = contribution.y + y * contribution.h;
      58           0 :     w *= contribution.w;
      59           0 :     h *= contribution.h;
      60           0 : }
      61             : 
      62             : }
      63          84 : }

Generated by: LCOV version 1.11