LCOV - code coverage report
Current view: top level - vcl/headless - svpvd.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 34 40 85.0 %
Date: 2015-06-13 12:38:46 Functions: 8 9 88.9 %
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             : #ifndef IOS
      21             : 
      22             : #include <vcl/svpforlokit.hxx>
      23             : 
      24             : #include "headless/svpbmp.hxx"
      25             : #include "headless/svpinst.hxx"
      26             : #include "headless/svpvd.hxx"
      27             : #include "headless/svpgdi.hxx"
      28             : 
      29             : #include <basegfx/vector/b2ivector.hxx>
      30             : #include <basebmp/scanlineformats.hxx>
      31             : 
      32             : using namespace basegfx;
      33             : using namespace basebmp;
      34             : 
      35      308188 : SvpSalVirtualDevice::~SvpSalVirtualDevice()
      36             : {
      37      308188 : }
      38             : 
      39      159401 : SalGraphics* SvpSalVirtualDevice::AcquireGraphics()
      40             : {
      41      159401 :     SvpSalGraphics* pGraphics = new SvpSalGraphics();
      42      159401 :     pGraphics->setDevice( m_aDevice );
      43      159401 :     m_aGraphics.push_back( pGraphics );
      44      159401 :     return pGraphics;
      45             : }
      46             : 
      47      156843 : void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics )
      48             : {
      49      156843 :     m_aGraphics.remove( dynamic_cast<SvpSalGraphics*>(pGraphics) );
      50      156843 :     delete pGraphics;
      51      156843 : }
      52             : 
      53      230163 : bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY )
      54             : {
      55      230163 :     return SetSizeUsingBuffer( nNewDX, nNewDY, basebmp::RawMemorySharedArray(), false );
      56             : }
      57             : 
      58      230163 : bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY,
      59             :                                               const basebmp::RawMemorySharedArray &pBuffer,
      60             :                                               const bool bTopDown )
      61             : {
      62      230163 :     B2IVector aDevSize( nNewDX, nNewDY );
      63      230163 :     if( aDevSize.getX() == 0 )
      64           0 :         aDevSize.setX( 1 );
      65      230163 :     if( aDevSize.getY() == 0 )
      66           0 :         aDevSize.setY( 1 );
      67      230163 :     if( ! m_aDevice.get() || m_aDevice->getSize() != aDevSize )
      68             :     {
      69      230049 :         SvpSalInstance* pInst = SvpSalInstance::s_pDefaultInstance;
      70             :         assert( pInst );
      71      230049 :         basebmp::Format nFormat = pInst->getFormatForBitCount( m_nBitCount );
      72      230049 :         sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(nFormat, aDevSize.getX());
      73             : 
      74      230049 :         if ( m_nBitCount == 1 )
      75             :         {
      76        7955 :             std::vector< basebmp::Color > aDevPal(2);
      77        7955 :             aDevPal.push_back( basebmp::Color( 0, 0, 0 ) );
      78        7955 :             aDevPal.push_back( basebmp::Color( 0xff, 0xff, 0xff ) );
      79       23865 :             m_aDevice = createBitmapDevice( aDevSize, bTopDown, nFormat, nStride,
      80       23865 :                                             PaletteMemorySharedVector( new std::vector< basebmp::Color >(aDevPal) ) );
      81             :         }
      82             :         else
      83             :         {
      84      444188 :             m_aDevice = pBuffer ?
      85             :                           createBitmapDevice( aDevSize, bTopDown, nFormat, nStride, pBuffer, PaletteMemorySharedVector() )
      86      666282 :                         : createBitmapDevice( aDevSize, bTopDown, nFormat, nStride );
      87             :         }
      88             : 
      89             :         // update device in existing graphics
      90      910338 :         for( std::list< SvpSalGraphics* >::iterator it = m_aGraphics.begin();
      91      606892 :              it != m_aGraphics.end(); ++it )
      92       73397 :              (*it)->setDevice( m_aDevice );
      93             : 
      94             :     }
      95      230163 :     return true;
      96             : }
      97             : 
      98           0 : void InitSvpForLibreOfficeKit()
      99             : {
     100           0 :     ImplSVData* pSVData = ImplGetSVData();
     101           0 :     SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
     102           0 :     pSalInstance->setBitCountFormatMapping( 32, ::basebmp::Format::ThirtyTwoBitTcMaskRGBA );
     103         801 : }
     104             : 
     105             : #endif
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11