LCOV - code coverage report
Current view: top level - vcl/source/gdi - bmpacc2.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 38 138 27.5 %
Date: 2014-11-03 Functions: 12 34 35.3 %
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/salbtype.hxx>
      21             : #include <vcl/bmpacc.hxx>
      22             : 
      23     6373887 : IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_MSB_PAL )
      24             : {
      25     6373887 :     return BitmapColor( pScanline[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 );
      26             : }
      27             : 
      28    30814590 : IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_MSB_PAL )
      29             : {
      30    30814590 :     sal_uInt8& rByte = pScanline[ nX >> 3 ];
      31             : 
      32    37571898 :     ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( 7 - ( nX & 7 ) ) ) :
      33    37571898 :                                       ( rByte &= ~( 1 << ( 7 - ( nX & 7 ) ) ) );
      34    30814590 : }
      35             : 
      36           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_LSB_PAL )
      37             : {
      38           0 :     return BitmapColor( pScanline[ nX >> 3 ] & ( 1 << ( nX & 7 ) ) ? 1 : 0 );
      39             : }
      40             : 
      41           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_LSB_PAL )
      42             : {
      43           0 :     sal_uInt8& rByte = pScanline[ nX >> 3 ];
      44             : 
      45           0 :     ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( nX & 7 ) ) :
      46           0 :                                       ( rByte &= ~( 1 << ( nX & 7 ) ) );
      47           0 : }
      48             : 
      49     2094248 : IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_MSN_PAL )
      50             : {
      51     2094248 :     return BitmapColor( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f );
      52             : }
      53             : 
      54     1419734 : IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_MSN_PAL )
      55             : {
      56     1419734 :     sal_uInt8& rByte = pScanline[ nX >> 1 ];
      57             : 
      58     2128772 :     ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) ) :
      59     2128772 :                  ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) );
      60     1419734 : }
      61             : 
      62           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_LSN_PAL )
      63             : {
      64           0 :     return BitmapColor( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 4 : 0 ) ) & 0x0f );
      65             : }
      66             : 
      67           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_LSN_PAL )
      68             : {
      69           0 :     sal_uInt8& rByte = pScanline[ nX >> 1 ];
      70             : 
      71           0 :     ( nX & 1 ) ? ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) ) :
      72           0 :                  ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) );
      73           0 : }
      74             : 
      75   359994505 : IMPL_FORMAT_GETPIXEL_NOMASK( _8BIT_PAL )
      76             : {
      77   359994505 :     return BitmapColor( pScanline[ nX ] );
      78             : }
      79             : 
      80    69584570 : IMPL_FORMAT_SETPIXEL_NOMASK( _8BIT_PAL )
      81             : {
      82    69584570 :     pScanline[ nX ] = rBitmapColor.GetIndex();
      83    69584570 : }
      84             : 
      85           0 : IMPL_FORMAT_GETPIXEL( _8BIT_TC_MASK )
      86             : {
      87           0 :     BitmapColor aColor;
      88           0 :     rMask.GetColorFor8Bit( aColor, pScanline + nX );
      89           0 :     return aColor;
      90             : }
      91             : 
      92           0 : IMPL_FORMAT_SETPIXEL( _8BIT_TC_MASK )
      93             : {
      94           0 :     rMask.SetColorFor8Bit( rBitmapColor, pScanline + nX );
      95           0 : }
      96             : 
      97           0 : IMPL_FORMAT_GETPIXEL( _16BIT_TC_MSB_MASK )
      98             : {
      99           0 :     BitmapColor aColor;
     100           0 :     rMask.GetColorFor16BitMSB( aColor, pScanline + ( nX << 1UL ) );
     101           0 :     return aColor;
     102             : }
     103             : 
     104           0 : IMPL_FORMAT_SETPIXEL( _16BIT_TC_MSB_MASK )
     105             : {
     106           0 :     rMask.SetColorFor16BitMSB( rBitmapColor, pScanline + ( nX << 1UL ) );
     107           0 : }
     108             : 
     109     3002400 : IMPL_FORMAT_GETPIXEL( _16BIT_TC_LSB_MASK )
     110             : {
     111     3002400 :     BitmapColor aColor;
     112     3002400 :     rMask.GetColorFor16BitLSB( aColor, pScanline + ( nX << 1UL ) );
     113     3002400 :     return aColor;
     114             : }
     115             : 
     116      100416 : IMPL_FORMAT_SETPIXEL( _16BIT_TC_LSB_MASK )
     117             : {
     118      100416 :     rMask.SetColorFor16BitLSB( rBitmapColor, pScanline + ( nX << 1UL ) );
     119      100416 : }
     120             : 
     121   672971267 : IMPL_FORMAT_GETPIXEL_NOMASK( _24BIT_TC_BGR )
     122             : {
     123   672971267 :     BitmapColor aBitmapColor;
     124             : 
     125   672971267 :     aBitmapColor.SetBlue( *( pScanline = pScanline + nX * 3 )++ );
     126   672971267 :     aBitmapColor.SetGreen( *pScanline++ );
     127   672971267 :     aBitmapColor.SetRed( *pScanline );
     128             : 
     129   672971267 :     return aBitmapColor;
     130             : }
     131             : 
     132   257167283 : IMPL_FORMAT_SETPIXEL_NOMASK( _24BIT_TC_BGR )
     133             : {
     134   257167283 :     *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetBlue();
     135   257167283 :     *pScanline++ = rBitmapColor.GetGreen();
     136   257167283 :     *pScanline = rBitmapColor.GetRed();
     137   257167283 : }
     138             : 
     139           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _24BIT_TC_RGB )
     140             : {
     141           0 :     BitmapColor aBitmapColor;
     142             : 
     143           0 :     aBitmapColor.SetRed( *( pScanline = pScanline + nX * 3 )++ );
     144           0 :     aBitmapColor.SetGreen( *pScanline++ );
     145           0 :     aBitmapColor.SetBlue( *pScanline );
     146             : 
     147           0 :     return aBitmapColor;
     148             : }
     149             : 
     150           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _24BIT_TC_RGB )
     151             : {
     152           0 :     *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetRed();
     153           0 :     *pScanline++ = rBitmapColor.GetGreen();
     154           0 :     *pScanline = rBitmapColor.GetBlue();
     155           0 : }
     156             : 
     157           0 : IMPL_FORMAT_GETPIXEL( _24BIT_TC_MASK )
     158             : {
     159           0 :     BitmapColor aColor;
     160           0 :     rMask.GetColorFor24Bit( aColor, pScanline + nX * 3L );
     161           0 :     return aColor;
     162             : }
     163             : 
     164           0 : IMPL_FORMAT_SETPIXEL( _24BIT_TC_MASK )
     165             : {
     166           0 :     rMask.SetColorFor24Bit( rBitmapColor, pScanline + nX * 3L );
     167           0 : }
     168             : 
     169           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_ABGR )
     170             : {
     171           0 :     BitmapColor aBitmapColor;
     172             : 
     173           0 :     aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
     174           0 :     aBitmapColor.SetGreen( *pScanline++ );
     175           0 :     aBitmapColor.SetRed( *pScanline );
     176             : 
     177           0 :     return aBitmapColor;
     178             : }
     179             : 
     180           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_ABGR )
     181             : {
     182           0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
     183           0 :     *pScanline++ = rBitmapColor.GetBlue();
     184           0 :     *pScanline++ = rBitmapColor.GetGreen();
     185           0 :     *pScanline = rBitmapColor.GetRed();
     186           0 : }
     187             : 
     188           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_ARGB )
     189             : {
     190           0 :     BitmapColor aBitmapColor;
     191             : 
     192           0 :     aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
     193           0 :     aBitmapColor.SetGreen( *pScanline++ );
     194           0 :     aBitmapColor.SetBlue( *pScanline );
     195             : 
     196           0 :     return aBitmapColor;
     197             : }
     198             : 
     199           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_ARGB )
     200             : {
     201           0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
     202           0 :     *pScanline++ = rBitmapColor.GetRed();
     203           0 :     *pScanline++ = rBitmapColor.GetGreen();
     204           0 :     *pScanline = rBitmapColor.GetBlue();
     205           0 : }
     206             : 
     207           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_BGRA )
     208             : {
     209           0 :     BitmapColor aBitmapColor;
     210             : 
     211           0 :     aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ );
     212           0 :     aBitmapColor.SetGreen( *pScanline++ );
     213           0 :     aBitmapColor.SetRed( *pScanline );
     214             : 
     215           0 :     return aBitmapColor;
     216             : }
     217             : 
     218           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_BGRA )
     219             : {
     220           0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue();
     221           0 :     *pScanline++ = rBitmapColor.GetGreen();
     222           0 :     *pScanline++ = rBitmapColor.GetRed();
     223           0 :     *pScanline = 0xFF;
     224           0 : }
     225             : 
     226           0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_RGBA )
     227             : {
     228           0 :     BitmapColor aBitmapColor;
     229             : 
     230           0 :     aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) )++ );
     231           0 :     aBitmapColor.SetGreen( *pScanline++ );
     232           0 :     aBitmapColor.SetBlue( *pScanline );
     233             : 
     234           0 :     return aBitmapColor;
     235             : }
     236             : 
     237           0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_RGBA )
     238             : {
     239           0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed();
     240           0 :     *pScanline++ = rBitmapColor.GetGreen();
     241           0 :     *pScanline++ = rBitmapColor.GetBlue();
     242           0 :     *pScanline = 0xFF;
     243           0 : }
     244             : 
     245           0 : IMPL_FORMAT_GETPIXEL( _32BIT_TC_MASK )
     246             : {
     247           0 :     BitmapColor aColor;
     248           0 :     rMask.GetColorFor32Bit( aColor, pScanline + ( nX << 2UL ) );
     249           0 :     return aColor;
     250             : }
     251             : 
     252           0 : IMPL_FORMAT_SETPIXEL( _32BIT_TC_MASK )
     253             : {
     254           0 :     rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) );
     255        1233 : }
     256             : 
     257             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10