LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/basebmp/source - debug.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 22 4.5 %
Date: 2013-07-09 Functions: 2 3 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 <osl/diagnose.h>
      21             : 
      22             : #include <basegfx/point/b2ipoint.hxx>
      23             : #include <basegfx/vector/b2ivector.hxx>
      24             : 
      25             : #include <basebmp/scanlineformats.hxx>
      26             : #include <basebmp/color.hxx>
      27             : #include <basebmp/bitmapdevice.hxx>
      28             : #include <basebmp/debug.hxx>
      29             : 
      30             : #include <iomanip>
      31             : 
      32             : namespace basebmp
      33             : {
      34             :     namespace Format
      35             :     {
      36           0 :         const char* formatName( sal_Int32 nScanlineFormat )
      37             :         {
      38           0 :             switch( nScanlineFormat )
      39             :             {
      40             :                 case Format::NONE:
      41           0 :                     return "NONE";
      42             :                 case Format::ONE_BIT_MSB_GREY:
      43           0 :                     return "ONE_BIT_MSB_GREY";
      44             :                 case Format::ONE_BIT_LSB_GREY:
      45           0 :                     return "ONE_BIT_LSB_GREY";
      46             :                 case Format::ONE_BIT_MSB_PAL:
      47           0 :                     return "ONE_BIT_MSB_PAL";
      48             :                 case Format::ONE_BIT_LSB_PAL:
      49           0 :                     return "ONE_BIT_LSB_PAL";
      50             :                 case Format::FOUR_BIT_MSB_GREY:
      51           0 :                     return "FOUR_BIT_MSB_GREY";
      52             :                 case Format::FOUR_BIT_LSB_GREY:
      53           0 :                     return "FOUR_BIT_LSB_GREY";
      54             :                 case Format::FOUR_BIT_MSB_PAL:
      55           0 :                     return "FOUR_BIT_MSB_PAL";
      56             :                 case Format::FOUR_BIT_LSB_PAL:
      57           0 :                     return "FOUR_BIT_LSB_PAL";
      58             :                 case Format::EIGHT_BIT_PAL:
      59           0 :                     return "EIGHT_BIT_PAL";
      60             :                 case Format::EIGHT_BIT_GREY:
      61           0 :                     return "EIGHT_BIT_GREY";
      62             :                 case Format::SIXTEEN_BIT_LSB_TC_MASK:
      63           0 :                     return "SIXTEEN_BIT_LSB_TC_MASK";
      64             :                 case Format::SIXTEEN_BIT_MSB_TC_MASK:
      65           0 :                     return "SIXTEEN_BIT_MSB_TC_MASK";
      66             :                 case Format::TWENTYFOUR_BIT_TC_MASK:
      67           0 :                     return "TWENTYFOUR_BIT_TC_MASK";
      68             :                 case Format::THIRTYTWO_BIT_TC_MASK_BGRA:
      69           0 :                     return "THIRTYTWO_BIT_TC_MASK_BGRA";
      70             :                 case Format::THIRTYTWO_BIT_TC_MASK_ARGB:
      71           0 :                     return "THIRTYTWO_BIT_TC_MASK_ARGB";
      72             :                 case Format::THIRTYTWO_BIT_TC_MASK_ABGR:
      73           0 :                     return "THIRTYTWO_BIT_TC_MASK_ABGR";
      74             :                 case Format::THIRTYTWO_BIT_TC_MASK_RGBA:
      75           0 :                     return "THIRTYTWO_BIT_TC_MASK_RGBA";
      76             :                 default:
      77           0 :                     return "<unknown>";
      78             :             }
      79             :         }
      80             :     }
      81             : 
      82             : #if OSL_DEBUG_LEVEL > 2
      83             : 
      84             :     void debugDump( const BitmapDeviceSharedPtr& rDevice,
      85             :                     std::ostream&                rOutputStream )
      86             :     {
      87             :         const basegfx::B2IVector aSize( rDevice->getSize() );
      88             :         const bool               bTopDown( rDevice->isTopDown() );
      89             :         const sal_Int32          nScanlineFormat( rDevice->getScanlineFormat() );
      90             : 
      91             :         rOutputStream
      92             :             << "/* basebmp::BitmapDevice content dump */" << std::endl
      93             :             << "/* Width   = " << aSize.getX() << " */" << std::endl
      94             :             << "/* Height  = " << aSize.getY() << " */" << std::endl
      95             :             << "/* TopDown = " << bTopDown << " */" << std::endl
      96             :             << "/* Format  = " << formatName(nScanlineFormat) << " */" << std::endl
      97             :             << "/* (dumped entries are already mapped RGBA color values) */" << std::endl
      98             :             << std::endl;
      99             : 
     100             :         rOutputStream << std::hex;
     101             :         for( int y=0; y<aSize.getY(); ++y )
     102             :         {
     103             :             for( int x=0; x<aSize.getX(); ++x )
     104             :                 rOutputStream << std::setw(8) << (sal_uInt32)rDevice->getPixel( basegfx::B2IPoint(x,y) ).toInt32() << " ";
     105             :             rOutputStream << std::endl;
     106             :         }
     107             :     }
     108             : 
     109             : #endif // OSL_DEBUG_LEVEL > 2
     110             : 
     111         456 : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10