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

Generated by: LCOV version 1.11