LCOV - code coverage report
Current view: top level - vcl/source/gdi - outdev5.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 1 143 0.7 %
Date: 2014-04-14 Functions: 2 7 28.6 %
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             : #include <tools/debug.hxx>
      21             : #include <tools/poly.hxx>
      22             : 
      23             : #include <vcl/metaact.hxx>
      24             : #include <vcl/gdimtf.hxx>
      25             : #include <vcl/outdev.hxx>
      26             : #include <vcl/virdev.hxx>
      27             : 
      28             : #include <salgdi.hxx>
      29             : #include <svdata.hxx>
      30             : #include <outdata.hxx>
      31             : #include <outdev.h>
      32             : 
      33           0 : void OutputDevice::DrawRect( const Rectangle& rRect,
      34             :                              sal_uLong nHorzRound, sal_uLong nVertRound )
      35             : {
      36             : 
      37           0 :     if ( mpMetaFile )
      38           0 :         mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) );
      39             : 
      40           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
      41           0 :         return;
      42             : 
      43           0 :     const Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
      44             : 
      45           0 :     if ( aRect.IsEmpty() )
      46           0 :         return;
      47             : 
      48           0 :     nHorzRound = ImplLogicWidthToDevicePixel( nHorzRound );
      49           0 :     nVertRound = ImplLogicHeightToDevicePixel( nVertRound );
      50             : 
      51             :     // we need a graphics
      52           0 :     if ( !mpGraphics )
      53             :     {
      54           0 :         if ( !ImplGetGraphics() )
      55           0 :             return;
      56             :     }
      57             : 
      58           0 :     if ( mbInitClipRegion )
      59           0 :         ImplInitClipRegion();
      60           0 :     if ( mbOutputClipped )
      61           0 :         return;
      62             : 
      63           0 :     if ( mbInitLineColor )
      64           0 :         ImplInitLineColor();
      65           0 :     if ( mbInitFillColor )
      66           0 :         ImplInitFillColor();
      67             : 
      68           0 :     if ( !nHorzRound && !nVertRound )
      69           0 :         mpGraphics->DrawRect( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), this );
      70             :     else
      71             :     {
      72           0 :         const Polygon aRoundRectPoly( aRect, nHorzRound, nVertRound );
      73             : 
      74           0 :         if ( aRoundRectPoly.GetSize() >= 2 )
      75             :         {
      76           0 :             const SalPoint* pPtAry = (const SalPoint*) aRoundRectPoly.GetConstPointAry();
      77             : 
      78           0 :             if ( !mbFillColor )
      79           0 :                 mpGraphics->DrawPolyLine( aRoundRectPoly.GetSize(), pPtAry, this );
      80             :             else
      81           0 :                 mpGraphics->DrawPolygon( aRoundRectPoly.GetSize(), pPtAry, this );
      82           0 :         }
      83             :     }
      84             : 
      85           0 :     if( mpAlphaVDev )
      86           0 :         mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound );
      87             : }
      88             : 
      89           0 : void OutputDevice::DrawEllipse( const Rectangle& rRect )
      90             : {
      91             : 
      92           0 :     if ( mpMetaFile )
      93           0 :         mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
      94             : 
      95           0 :     if  ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
      96           0 :         return;
      97             : 
      98           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
      99           0 :     if ( aRect.IsEmpty() )
     100           0 :         return;
     101             : 
     102             :     // we need a graphics
     103           0 :     if ( !mpGraphics )
     104             :     {
     105           0 :         if ( !ImplGetGraphics() )
     106           0 :             return;
     107             :     }
     108             : 
     109           0 :     if ( mbInitClipRegion )
     110           0 :         ImplInitClipRegion();
     111           0 :     if ( mbOutputClipped )
     112           0 :         return;
     113             : 
     114           0 :     if ( mbInitLineColor )
     115           0 :         ImplInitLineColor();
     116             : 
     117           0 :     Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
     118           0 :     if ( aRectPoly.GetSize() >= 2 )
     119             :     {
     120           0 :         const SalPoint* pPtAry = (const SalPoint*)aRectPoly.GetConstPointAry();
     121           0 :         if ( !mbFillColor )
     122           0 :             mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, this );
     123             :         else
     124             :         {
     125           0 :             if ( mbInitFillColor )
     126           0 :                 ImplInitFillColor();
     127           0 :             mpGraphics->DrawPolygon( aRectPoly.GetSize(), pPtAry, this );
     128             :         }
     129             :     }
     130             : 
     131           0 :     if( mpAlphaVDev )
     132           0 :         mpAlphaVDev->DrawEllipse( rRect );
     133             : }
     134             : 
     135           0 : void OutputDevice::DrawArc( const Rectangle& rRect,
     136             :                             const Point& rStartPt, const Point& rEndPt )
     137             : {
     138             : 
     139           0 :     if ( mpMetaFile )
     140           0 :         mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
     141             : 
     142           0 :     if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
     143           0 :         return;
     144             : 
     145           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     146           0 :     if ( aRect.IsEmpty() )
     147           0 :         return;
     148             : 
     149             :     // we need a graphics
     150           0 :     if ( !mpGraphics )
     151             :     {
     152           0 :         if ( !ImplGetGraphics() )
     153           0 :             return;
     154             :     }
     155             : 
     156           0 :     if ( mbInitClipRegion )
     157           0 :         ImplInitClipRegion();
     158           0 :     if ( mbOutputClipped )
     159           0 :         return;
     160             : 
     161           0 :     if ( mbInitLineColor )
     162           0 :         ImplInitLineColor();
     163             : 
     164           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     165           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     166           0 :     Polygon         aArcPoly( aRect, aStart, aEnd, POLY_ARC );
     167             : 
     168           0 :     if ( aArcPoly.GetSize() >= 2 )
     169             :     {
     170           0 :         const SalPoint* pPtAry = (const SalPoint*)aArcPoly.GetConstPointAry();
     171           0 :         mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, this );
     172             :     }
     173             : 
     174           0 :     if( mpAlphaVDev )
     175           0 :         mpAlphaVDev->DrawArc( rRect, rStartPt, rEndPt );
     176             : }
     177             : 
     178           0 : void OutputDevice::DrawPie( const Rectangle& rRect,
     179             :                             const Point& rStartPt, const Point& rEndPt )
     180             : {
     181             : 
     182           0 :     if ( mpMetaFile )
     183           0 :         mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
     184             : 
     185           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     186           0 :         return;
     187             : 
     188           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     189           0 :     if ( aRect.IsEmpty() )
     190           0 :         return;
     191             : 
     192             :     // we need a graphics
     193           0 :     if ( !mpGraphics )
     194             :     {
     195           0 :         if ( !ImplGetGraphics() )
     196           0 :             return;
     197             :     }
     198             : 
     199           0 :     if ( mbInitClipRegion )
     200           0 :         ImplInitClipRegion();
     201           0 :     if ( mbOutputClipped )
     202           0 :         return;
     203             : 
     204           0 :     if ( mbInitLineColor )
     205           0 :         ImplInitLineColor();
     206             : 
     207           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     208           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     209           0 :     Polygon         aPiePoly( aRect, aStart, aEnd, POLY_PIE );
     210             : 
     211           0 :     if ( aPiePoly.GetSize() >= 2 )
     212             :     {
     213           0 :         const SalPoint* pPtAry = (const SalPoint*)aPiePoly.GetConstPointAry();
     214           0 :         if ( !mbFillColor )
     215           0 :             mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, this );
     216             :         else
     217             :         {
     218           0 :             if ( mbInitFillColor )
     219           0 :                 ImplInitFillColor();
     220           0 :             mpGraphics->DrawPolygon( aPiePoly.GetSize(), pPtAry, this );
     221             :         }
     222             :     }
     223             : 
     224           0 :     if( mpAlphaVDev )
     225           0 :         mpAlphaVDev->DrawPie( rRect, rStartPt, rEndPt );
     226             : }
     227             : 
     228           0 : void OutputDevice::DrawChord( const Rectangle& rRect,
     229             :                               const Point& rStartPt, const Point& rEndPt )
     230             : {
     231             : 
     232           0 :     if ( mpMetaFile )
     233           0 :         mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
     234             : 
     235           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     236           0 :         return;
     237             : 
     238           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     239           0 :     if ( aRect.IsEmpty() )
     240           0 :         return;
     241             : 
     242             :     // we need a graphics
     243           0 :     if ( !mpGraphics )
     244             :     {
     245           0 :         if ( !ImplGetGraphics() )
     246           0 :             return;
     247             :     }
     248             : 
     249           0 :     if ( mbInitClipRegion )
     250           0 :         ImplInitClipRegion();
     251           0 :     if ( mbOutputClipped )
     252           0 :         return;
     253             : 
     254           0 :     if ( mbInitLineColor )
     255           0 :         ImplInitLineColor();
     256             : 
     257           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     258           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     259           0 :     Polygon         aChordPoly( aRect, aStart, aEnd, POLY_CHORD );
     260             : 
     261           0 :     if ( aChordPoly.GetSize() >= 2 )
     262             :     {
     263           0 :         const SalPoint* pPtAry = (const SalPoint*)aChordPoly.GetConstPointAry();
     264           0 :         if ( !mbFillColor )
     265           0 :             mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, this );
     266             :         else
     267             :         {
     268           0 :             if ( mbInitFillColor )
     269           0 :                 ImplInitFillColor();
     270           0 :             mpGraphics->DrawPolygon( aChordPoly.GetSize(), pPtAry, this );
     271             :         }
     272             :     }
     273             : 
     274           0 :     if( mpAlphaVDev )
     275           0 :         mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt );
     276           3 : }
     277             : 
     278             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10