LCOV - code coverage report
Current view: top level - vcl/source/outdev - curvedshapes.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 20 111 18.0 %
Date: 2014-11-03 Functions: 3 6 50.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             : #include <vcl/outdev.hxx>
      21             : #include <vcl/virdev.hxx>
      22             : 
      23             : #include <salgdi.hxx>
      24             : 
      25           2 : void OutputDevice::DrawEllipse( const Rectangle& rRect )
      26             : {
      27           2 :     if ( mpMetaFile )
      28           2 :         mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
      29             : 
      30           2 :     if  ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
      31           0 :         return;
      32             : 
      33           2 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
      34           2 :     if ( aRect.IsEmpty() )
      35           0 :         return;
      36             : 
      37             :     // we need a graphics
      38           2 :     if ( !mpGraphics )
      39             :     {
      40           0 :         if ( !AcquireGraphics() )
      41           0 :             return;
      42             :     }
      43             : 
      44           2 :     if ( mbInitClipRegion )
      45           0 :         InitClipRegion();
      46           2 :     if ( mbOutputClipped )
      47           0 :         return;
      48             : 
      49           2 :     if ( mbInitLineColor )
      50           2 :         InitLineColor();
      51             : 
      52           2 :     Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
      53           2 :     if ( aRectPoly.GetSize() >= 2 )
      54             :     {
      55           2 :         const SalPoint* pPtAry = (const SalPoint*)aRectPoly.GetConstPointAry();
      56           2 :         if ( !mbFillColor )
      57           0 :             mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry, this );
      58             :         else
      59             :         {
      60           2 :             if ( mbInitFillColor )
      61           2 :                 InitFillColor();
      62           2 :             mpGraphics->DrawPolygon( aRectPoly.GetSize(), pPtAry, this );
      63             :         }
      64             :     }
      65             : 
      66           2 :     if( mpAlphaVDev )
      67           0 :         mpAlphaVDev->DrawEllipse( rRect );
      68             : }
      69             : 
      70           0 : void OutputDevice::DrawArc( const Rectangle& rRect,
      71             :                             const Point& rStartPt, const Point& rEndPt )
      72             : {
      73           0 :     if ( mpMetaFile )
      74           0 :         mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
      75             : 
      76           0 :     if ( !IsDeviceOutputNecessary() || !mbLineColor || ImplIsRecordLayout() )
      77           0 :         return;
      78             : 
      79           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
      80           0 :     if ( aRect.IsEmpty() )
      81           0 :         return;
      82             : 
      83             :     // we need a graphics
      84           0 :     if ( !mpGraphics )
      85             :     {
      86           0 :         if ( !AcquireGraphics() )
      87           0 :             return;
      88             :     }
      89             : 
      90           0 :     if ( mbInitClipRegion )
      91           0 :         InitClipRegion();
      92           0 :     if ( mbOutputClipped )
      93           0 :         return;
      94             : 
      95           0 :     if ( mbInitLineColor )
      96           0 :         InitLineColor();
      97             : 
      98           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
      99           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     100           0 :     Polygon         aArcPoly( aRect, aStart, aEnd, POLY_ARC );
     101             : 
     102           0 :     if ( aArcPoly.GetSize() >= 2 )
     103             :     {
     104           0 :         const SalPoint* pPtAry = (const SalPoint*)aArcPoly.GetConstPointAry();
     105           0 :         mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry, this );
     106             :     }
     107             : 
     108           0 :     if( mpAlphaVDev )
     109           0 :         mpAlphaVDev->DrawArc( rRect, rStartPt, rEndPt );
     110             : }
     111             : 
     112           0 : void OutputDevice::DrawPie( const Rectangle& rRect,
     113             :                             const Point& rStartPt, const Point& rEndPt )
     114             : {
     115           0 :     if ( mpMetaFile )
     116           0 :         mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
     117             : 
     118           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     119           0 :         return;
     120             : 
     121           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     122           0 :     if ( aRect.IsEmpty() )
     123           0 :         return;
     124             : 
     125             :     // we need a graphics
     126           0 :     if ( !mpGraphics )
     127             :     {
     128           0 :         if ( !AcquireGraphics() )
     129           0 :             return;
     130             :     }
     131             : 
     132           0 :     if ( mbInitClipRegion )
     133           0 :         InitClipRegion();
     134           0 :     if ( mbOutputClipped )
     135           0 :         return;
     136             : 
     137           0 :     if ( mbInitLineColor )
     138           0 :         InitLineColor();
     139             : 
     140           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     141           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     142           0 :     Polygon         aPiePoly( aRect, aStart, aEnd, POLY_PIE );
     143             : 
     144           0 :     if ( aPiePoly.GetSize() >= 2 )
     145             :     {
     146           0 :         const SalPoint* pPtAry = (const SalPoint*)aPiePoly.GetConstPointAry();
     147           0 :         if ( !mbFillColor )
     148           0 :             mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry, this );
     149             :         else
     150             :         {
     151           0 :             if ( mbInitFillColor )
     152           0 :                 InitFillColor();
     153           0 :             mpGraphics->DrawPolygon( aPiePoly.GetSize(), pPtAry, this );
     154             :         }
     155             :     }
     156             : 
     157           0 :     if( mpAlphaVDev )
     158           0 :         mpAlphaVDev->DrawPie( rRect, rStartPt, rEndPt );
     159             : }
     160             : 
     161           0 : void OutputDevice::DrawChord( const Rectangle& rRect,
     162             :                               const Point& rStartPt, const Point& rEndPt )
     163             : {
     164           0 :     if ( mpMetaFile )
     165           0 :         mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
     166             : 
     167           0 :     if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || ImplIsRecordLayout() )
     168           0 :         return;
     169             : 
     170           0 :     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
     171           0 :     if ( aRect.IsEmpty() )
     172           0 :         return;
     173             : 
     174             :     // we need a graphics
     175           0 :     if ( !mpGraphics )
     176             :     {
     177           0 :         if ( !AcquireGraphics() )
     178           0 :             return;
     179             :     }
     180             : 
     181           0 :     if ( mbInitClipRegion )
     182           0 :         InitClipRegion();
     183           0 :     if ( mbOutputClipped )
     184           0 :         return;
     185             : 
     186           0 :     if ( mbInitLineColor )
     187           0 :         InitLineColor();
     188             : 
     189           0 :     const Point     aStart( ImplLogicToDevicePixel( rStartPt ) );
     190           0 :     const Point     aEnd( ImplLogicToDevicePixel( rEndPt ) );
     191           0 :     Polygon         aChordPoly( aRect, aStart, aEnd, POLY_CHORD );
     192             : 
     193           0 :     if ( aChordPoly.GetSize() >= 2 )
     194             :     {
     195           0 :         const SalPoint* pPtAry = (const SalPoint*)aChordPoly.GetConstPointAry();
     196           0 :         if ( !mbFillColor )
     197           0 :             mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry, this );
     198             :         else
     199             :         {
     200           0 :             if ( mbInitFillColor )
     201           0 :                 InitFillColor();
     202           0 :             mpGraphics->DrawPolygon( aChordPoly.GetSize(), pPtAry, this );
     203             :         }
     204             :     }
     205             : 
     206           0 :     if( mpAlphaVDev )
     207           0 :         mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt );
     208        1233 : }
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10