LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/vcl/source/gdi - impbmp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 33 33 100.0 %
Date: 2013-07-09 Functions: 13 13 100.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 <vcl/bitmap.hxx>
      22             : 
      23             : #include <svdata.hxx>
      24             : #include <salinst.hxx>
      25             : #include <salbmp.hxx>
      26             : #include <impbmp.hxx>
      27             : 
      28             : // --------------
      29             : // - ImpBitmap  -
      30             : // --------------
      31             : 
      32      314454 : ImpBitmap::ImpBitmap() :
      33             :             mnRefCount  ( 1UL ),
      34             :             mnChecksum  ( 0UL ),
      35      314454 :             mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() ),
      36      628908 :             maSourceSize( 0, 0 )
      37             : {
      38      314454 : }
      39             : 
      40             : // -----------------------------------------------------------------------
      41             : 
      42      314438 : ImpBitmap::~ImpBitmap()
      43             : {
      44      314438 :     delete mpSalBitmap;
      45      314438 : }
      46             : 
      47             : // -----------------------------------------------------------------------
      48      119210 : void ImpBitmap::ImplSetSalBitmap( SalBitmap* pBitmap )
      49             : {
      50      119210 :     delete mpSalBitmap, mpSalBitmap = pBitmap;
      51      119210 : }
      52             : 
      53             : // -----------------------------------------------------------------------
      54             : 
      55       86453 : sal_Bool ImpBitmap::ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal )
      56             : {
      57       86453 :     maSourceSize = rSize;
      58       86453 :     return mpSalBitmap->Create( rSize, nBitCount, rPal );
      59             : }
      60             : 
      61             : // -----------------------------------------------------------------------
      62             : 
      63      108786 : sal_Bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
      64             : {
      65      108786 :     maSourceSize = rImpBitmap.maSourceSize;
      66      108786 :     mnChecksum = rImpBitmap.mnChecksum;
      67      108786 :     return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap );
      68             : }
      69             : 
      70             : // -----------------------------------------------------------------------
      71             : 
      72           1 : sal_Bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics )
      73             : {
      74           1 :     return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, pGraphics );
      75             : }
      76             : 
      77             : // -----------------------------------------------------------------------
      78             : 
      79           4 : sal_Bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount )
      80             : {
      81           4 :     return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount );
      82             : }
      83             : 
      84             : // -----------------------------------------------------------------------
      85             : 
      86      789647 : Size ImpBitmap::ImplGetSize() const
      87             : {
      88      789647 :     return mpSalBitmap->GetSize();
      89             : }
      90             : 
      91             : // -----------------------------------------------------------------------
      92             : 
      93      258185 : sal_uInt16 ImpBitmap::ImplGetBitCount() const
      94             : {
      95      258185 :     sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
      96      258185 :     return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
      97             : }
      98             : 
      99             : // -----------------------------------------------------------------------
     100             : 
     101      581741 : BitmapBuffer* ImpBitmap::ImplAcquireBuffer( sal_Bool bReadOnly )
     102             : {
     103      581741 :     return mpSalBitmap->AcquireBuffer( bReadOnly );
     104             : }
     105             : 
     106             : // -----------------------------------------------------------------------
     107             : 
     108      581737 : void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly )
     109             : {
     110      581737 :     mpSalBitmap->ReleaseBuffer( pBuffer, bReadOnly );
     111             : 
     112      581737 :     if( !bReadOnly )
     113      196349 :         mnChecksum = 0;
     114      582202 : }
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10