LCOV - code coverage report
Current view: top level - libreoffice/vcl/source/gdi - outdev5.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 122 15.6 %
Date: 2012-12-27 Functions: 1 5 20.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <tools/debug.hxx>
      22             : #include <tools/poly.hxx>
      23             : 
      24             : #include <vcl/metaact.hxx>
      25             : #include <vcl/gdimtf.hxx>
      26             : #include <vcl/outdev.hxx>
      27             : #include <vcl/virdev.hxx>
      28             : 
      29             : #include <salgdi.hxx>
      30             : #include <svdata.hxx>
      31             : #include <outdata.hxx>
      32             : #include <outdev.h>
      33             : 
      34             : // =======================================================================
      35             : 
      36             : DBG_NAMEEX( OutputDevice )
      37             : 
      38             : // =======================================================================
      39             : 
      40           0 : void OutputDevice::DrawRect( const Rectangle& rRect,
      41             :                              sal_uLong nHorzRound, sal_uLong nVertRound )
      42             : {
      43             :     OSL_TRACE( "OutputDevice::DrawRoundRect()" );
      44             :     DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
      45             : 
      46           0 :     if ( mpMetaFile )
      47           0 :         mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) );
      48             : 
      49           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
      50             :         return;
      51             : 
      52           0 :     const Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
      53             : 
      54           0 :     if ( aRect.IsEmpty() )
      55             :         return;
      56             : 
      57           0 :     nHorzRound = ImplLogicWidthToDevicePixel( nHorzRound );
      58           0 :     nVertRound = ImplLogicHeightToDevicePixel( nVertRound );
      59             : 
      60             :     // we need a graphics
      61           0 :     if ( !mpGraphics )
      62             :     {
      63           0 :         if ( !ImplGetGraphics() )
      64             :             return;
      65             :     }
      66             : 
      67           0 :     if ( mbInitClipRegion )
      68           0 :         ImplInitClipRegion();
      69           0 :     if ( mbOutputClipped )
      70             :         return;
      71             : 
      72           0 :     if ( mbInitLineColor )
      73           0 :         ImplInitLineColor();
      74           0 :     if ( mbInitFillColor )
      75           0 :         ImplInitFillColor();
      76             : 
      77           0 :     if ( !nHorzRound && !nVertRound )
      78           0 :         mpGraphics->DrawRect( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), this );
      79             :     else
      80             :     {
      81           0 :         const Polygon aRoundRectPoly( aRect, nHorzRound, nVertRound );
      82             : 
      83           0 :         if ( aRoundRectPoly.GetSize() >= 2 )
      84             :         {
      85           0 :             const SalPoint* pPtAry = (const SalPoint*) aRoundRectPoly.GetConstPointAry();
      86             : 
      87           0 :             if ( !mbFillColor )
      88           0 :                 mpGraphics->DrawPolyLine( aRoundRectPoly.GetSize(), pPtAry, this );
      89             :             else
      90           0 :                 mpGraphics->DrawPolygon( aRoundRectPoly.GetSize(), pPtAry, this );
      91           0 :         }
      92             :     }
      93             : 
      94           0 :     if( mpAlphaVDev )
      95           0 :         mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound );
      96             : }
      97             : 
      98             : // -----------------------------------------------------------------------
      99             : 
     100           1 : void OutputDevice::DrawEllipse( const Rectangle& rRect )
     101             : {
     102             :     OSL_TRACE( "OutputDevice::DrawEllipse()" );
     103             :     DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
     104             : 
     105           1 :     if ( mpMetaFile )
     106           1 :         mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
     107             : 
     108           1 :     if  ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     109             :         return;
     110             : 
     111           1 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     112           1 :     if ( aRect.IsEmpty() )
     113             :         return;
     114             : 
     115             :     // we need a graphics
     116           1 :     if ( !mpGraphics )
     117             :     {
     118           0 :         if ( !ImplGetGraphics() )
     119             :             return;
     120             :     }
     121             : 
     122           1 :     if ( mbInitClipRegion )
     123           0 :         ImplInitClipRegion();
     124           1 :     if ( mbOutputClipped )
     125             :         return;
     126             : 
     127           1 :     if ( mbInitLineColor )
     128           1 :         ImplInitLineColor();
     129             : 
     130           1 :     Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
     131           1 :     if ( aRectPoly.GetSize() >= 2 )
     132             :     {
     133           1 :         const SalPoint* pPtAry = (const SalPoint*)aRectPoly.GetConstPointAry();
     134           1 :         if ( !mbFillColor )
     135           0 :             mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, this );
     136             :         else
     137             :         {
     138           1 :             if ( mbInitFillColor )
     139           1 :                 ImplInitFillColor();
     140           1 :             mpGraphics->DrawPolygon( aRectPoly.GetSize(), pPtAry, this );
     141             :         }
     142             :     }
     143             : 
     144           1 :     if( mpAlphaVDev )
     145           0 :         mpAlphaVDev->DrawEllipse( rRect );
     146             : }
     147             : 
     148             : // -----------------------------------------------------------------------
     149             : 
     150           0 : void OutputDevice::DrawArc( const Rectangle& rRect,
     151             :                             const Point& rStartPt, const Point& rEndPt )
     152             : {
     153             :     OSL_TRACE( "OutputDevice::DrawArc()" );
     154             :     DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
     155             : 
     156           0 :     if ( mpMetaFile )
     157           0 :         mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
     158             : 
     159           0 :     if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
     160             :         return;
     161             : 
     162           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     163           0 :     if ( aRect.IsEmpty() )
     164             :         return;
     165             : 
     166             :     // we need a graphics
     167           0 :     if ( !mpGraphics )
     168             :     {
     169           0 :         if ( !ImplGetGraphics() )
     170             :             return;
     171             :     }
     172             : 
     173           0 :     if ( mbInitClipRegion )
     174           0 :         ImplInitClipRegion();
     175           0 :     if ( mbOutputClipped )
     176             :         return;
     177             : 
     178           0 :     if ( mbInitLineColor )
     179           0 :         ImplInitLineColor();
     180             : 
     181           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     182           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     183           0 :     Polygon         aArcPoly( aRect, aStart, aEnd, POLY_ARC );
     184             : 
     185           0 :     if ( aArcPoly.GetSize() >= 2 )
     186             :     {
     187           0 :         const SalPoint* pPtAry = (const SalPoint*)aArcPoly.GetConstPointAry();
     188           0 :         mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, this );
     189             :     }
     190             : 
     191           0 :     if( mpAlphaVDev )
     192           0 :         mpAlphaVDev->DrawArc( rRect, rStartPt, rEndPt );
     193             : }
     194             : 
     195             : // -----------------------------------------------------------------------
     196             : 
     197           0 : void OutputDevice::DrawPie( const Rectangle& rRect,
     198             :                             const Point& rStartPt, const Point& rEndPt )
     199             : {
     200             :     OSL_TRACE( "OutputDevice::DrawPie()" );
     201             :     DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
     202             : 
     203           0 :     if ( mpMetaFile )
     204           0 :         mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
     205             : 
     206           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     207             :         return;
     208             : 
     209           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     210           0 :     if ( aRect.IsEmpty() )
     211             :         return;
     212             : 
     213             :     // we need a graphics
     214           0 :     if ( !mpGraphics )
     215             :     {
     216           0 :         if ( !ImplGetGraphics() )
     217             :             return;
     218             :     }
     219             : 
     220           0 :     if ( mbInitClipRegion )
     221           0 :         ImplInitClipRegion();
     222           0 :     if ( mbOutputClipped )
     223             :         return;
     224             : 
     225           0 :     if ( mbInitLineColor )
     226           0 :         ImplInitLineColor();
     227             : 
     228           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     229           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     230           0 :     Polygon         aPiePoly( aRect, aStart, aEnd, POLY_PIE );
     231             : 
     232           0 :     if ( aPiePoly.GetSize() >= 2 )
     233             :     {
     234           0 :         const SalPoint* pPtAry = (const SalPoint*)aPiePoly.GetConstPointAry();
     235           0 :         if ( !mbFillColor )
     236           0 :             mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, this );
     237             :         else
     238             :         {
     239           0 :             if ( mbInitFillColor )
     240           0 :                 ImplInitFillColor();
     241           0 :             mpGraphics->DrawPolygon( aPiePoly.GetSize(), pPtAry, this );
     242             :         }
     243             :     }
     244             : 
     245           0 :     if( mpAlphaVDev )
     246           0 :         mpAlphaVDev->DrawPie( rRect, rStartPt, rEndPt );
     247             : }
     248             : 
     249             : // -----------------------------------------------------------------------
     250             : 
     251           0 : void OutputDevice::DrawChord( const Rectangle& rRect,
     252             :                               const Point& rStartPt, const Point& rEndPt )
     253             : {
     254             :     OSL_TRACE( "OutputDevice::DrawChord()" );
     255             :     DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
     256             : 
     257           0 :     if ( mpMetaFile )
     258           0 :         mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
     259             : 
     260           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     261             :         return;
     262             : 
     263           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     264           0 :     if ( aRect.IsEmpty() )
     265             :         return;
     266             : 
     267             :     // we need a graphics
     268           0 :     if ( !mpGraphics )
     269             :     {
     270           0 :         if ( !ImplGetGraphics() )
     271             :             return;
     272             :     }
     273             : 
     274           0 :     if ( mbInitClipRegion )
     275           0 :         ImplInitClipRegion();
     276           0 :     if ( mbOutputClipped )
     277             :         return;
     278             : 
     279           0 :     if ( mbInitLineColor )
     280           0 :         ImplInitLineColor();
     281             : 
     282           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     283           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     284           0 :     Polygon         aChordPoly( aRect, aStart, aEnd, POLY_CHORD );
     285             : 
     286           0 :     if ( aChordPoly.GetSize() >= 2 )
     287             :     {
     288           0 :         const SalPoint* pPtAry = (const SalPoint*)aChordPoly.GetConstPointAry();
     289           0 :         if ( !mbFillColor )
     290           0 :             mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, this );
     291             :         else
     292             :         {
     293           0 :             if ( mbInitFillColor )
     294           0 :                 ImplInitFillColor();
     295           0 :             mpGraphics->DrawPolygon( aChordPoly.GetSize(), pPtAry, this );
     296             :         }
     297             :     }
     298             : 
     299           0 :     if( mpAlphaVDev )
     300           0 :         mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt );
     301             : }
     302             : 
     303             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10