LCOV - code coverage report
Current view: top level - vcl/source/gdi - bmpacc2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 36 138 26.1 %
Date: 2012-08-25 Functions: 9 32 28.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 12 50.0 %

           Branch data     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                 :            : // ----------------
      24                 :            : // - BitmapAccess -
      25                 :            : // ----------------
      26                 :            : 
      27                 :    7971111 : IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_MSB_PAL )
      28                 :            : {
      29                 :    7971111 :     return( pScanline[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 );
      30                 :            : }
      31                 :            : 
      32                 :            : // ------------------------------------------------------------------
      33                 :            : 
      34                 :    1173897 : IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_MSB_PAL )
      35                 :            : {
      36                 :    1173897 :     sal_uInt8& rByte = pScanline[ nX >> 3 ];
      37                 :            : 
      38                 :    1173897 :     ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( 7 - ( nX & 7 ) ) ) :
      39         [ +  + ]:    1173897 :                                       ( rByte &= ~( 1 << ( 7 - ( nX & 7 ) ) ) );
      40                 :    1173897 : }
      41                 :            : 
      42                 :            : // ------------------------------------------------------------------
      43                 :            : 
      44                 :          0 : IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_LSB_PAL )
      45                 :            : {
      46                 :          0 :     return( pScanline[ nX >> 3 ] & ( 1 << ( nX & 7 ) ) ? 1 : 0 );
      47                 :            : }
      48                 :            : 
      49                 :            : // ------------------------------------------------------------------
      50                 :            : 
      51                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_LSB_PAL )
      52                 :            : {
      53                 :          0 :     sal_uInt8& rByte = pScanline[ nX >> 3 ];
      54                 :            : 
      55                 :          0 :     ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( nX & 7 ) ) :
      56         [ #  # ]:          0 :                                       ( rByte &= ~( 1 << ( nX & 7 ) ) );
      57                 :          0 : }
      58                 :            : 
      59                 :            : // ------------------------------------------------------------------
      60                 :            : 
      61                 :      35614 : IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_MSN_PAL )
      62                 :            : {
      63         [ +  + ]:      35614 :     return( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f );
      64                 :            : }
      65                 :            : 
      66                 :            : // ------------------------------------------------------------------
      67                 :            : 
      68                 :     329466 : IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_MSN_PAL )
      69                 :            : {
      70                 :     329466 :     sal_uInt8& rByte = pScanline[ nX >> 1 ];
      71                 :            : 
      72                 :     163732 :     ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) ) :
      73         [ +  + ]:     493198 :                  ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) );
      74                 :     329466 : }
      75                 :            : 
      76                 :            : // ------------------------------------------------------------------
      77                 :            : 
      78                 :          0 : IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_LSN_PAL )
      79                 :            : {
      80         [ #  # ]:          0 :     return( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 4 : 0 ) ) & 0x0f );
      81                 :            : }
      82                 :            : 
      83                 :            : // ------------------------------------------------------------------
      84                 :            : 
      85                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_LSN_PAL )
      86                 :            : {
      87                 :          0 :     sal_uInt8& rByte = pScanline[ nX >> 1 ];
      88                 :            : 
      89                 :          0 :     ( nX & 1 ) ? ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) ) :
      90         [ #  # ]:          0 :                  ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) );
      91                 :          0 : }
      92                 :            : 
      93                 :            : // ------------------------------------------------------------------
      94                 :            : 
      95                 :  234860644 : IMPL_FORMAT_GETPIXEL_NOMASK( _8BIT_PAL )
      96                 :            : {
      97                 :  234860644 :     return pScanline[ nX ];
      98                 :            : }
      99                 :            : 
     100                 :            : // ------------------------------------------------------------------
     101                 :            : 
     102                 :  189956111 : IMPL_FORMAT_SETPIXEL_NOMASK( _8BIT_PAL )
     103                 :            : {
     104                 :  189956111 :     pScanline[ nX ] = rBitmapColor.GetIndex();
     105                 :  189956111 : }
     106                 :            : 
     107                 :            : // ------------------------------------------------------------------
     108                 :            : 
     109                 :          0 : IMPL_FORMAT_GETPIXEL( _8BIT_TC_MASK )
     110                 :            : {
     111                 :          0 :     BitmapColor aColor;
     112                 :          0 :     rMask.GetColorFor8Bit( aColor, pScanline + nX );
     113                 :          0 :     return aColor;
     114                 :            : }
     115                 :            : 
     116                 :            : // ------------------------------------------------------------------
     117                 :            : 
     118                 :          0 : IMPL_FORMAT_SETPIXEL( _8BIT_TC_MASK )
     119                 :            : {
     120                 :          0 :     rMask.SetColorFor8Bit( rBitmapColor, pScanline + nX );
     121                 :          0 : }
     122                 :            : 
     123                 :            : // ------------------------------------------------------------------
     124                 :            : 
     125                 :          0 : IMPL_FORMAT_GETPIXEL( _16BIT_TC_MSB_MASK )
     126                 :            : {
     127                 :          0 :     BitmapColor aColor;
     128                 :          0 :     rMask.GetColorFor16BitMSB( aColor, pScanline + ( nX << 1UL ) );
     129                 :          0 :     return aColor;
     130                 :            : }
     131                 :            : 
     132                 :            : // ------------------------------------------------------------------
     133                 :            : 
     134                 :          0 : IMPL_FORMAT_SETPIXEL( _16BIT_TC_MSB_MASK )
     135                 :            : {
     136                 :          0 :     rMask.SetColorFor16BitMSB( rBitmapColor, pScanline + ( nX << 1UL ) );
     137                 :          0 : }
     138                 :            : 
     139                 :            : // ------------------------------------------------------------------
     140                 :            : 
     141                 :          0 : IMPL_FORMAT_GETPIXEL( _16BIT_TC_LSB_MASK )
     142                 :            : {
     143                 :          0 :     BitmapColor aColor;
     144                 :          0 :     rMask.GetColorFor16BitLSB( aColor, pScanline + ( nX << 1UL ) );
     145                 :          0 :     return aColor;
     146                 :            : }
     147                 :            : 
     148                 :            : // ------------------------------------------------------------------
     149                 :            : 
     150                 :          0 : IMPL_FORMAT_SETPIXEL( _16BIT_TC_LSB_MASK )
     151                 :            : {
     152                 :          0 :     rMask.SetColorFor16BitLSB( rBitmapColor, pScanline + ( nX << 1UL ) );
     153                 :          0 : }
     154                 :            : 
     155                 :            : // ------------------------------------------------------------------
     156                 :            : 
     157                 :  768100447 : IMPL_FORMAT_GETPIXEL_NOMASK( _24BIT_TC_BGR )
     158                 :            : {
     159                 :  768100447 :     BitmapColor aBitmapColor;
     160                 :            : 
     161                 :  768100447 :     aBitmapColor.SetBlue( *( pScanline = pScanline + nX * 3 )++ );
     162                 :  768100447 :     aBitmapColor.SetGreen( *pScanline++ );
     163                 :  768100447 :     aBitmapColor.SetRed( *pScanline );
     164                 :            : 
     165                 :  768100447 :     return aBitmapColor;
     166                 :            : }
     167                 :            : 
     168                 :            : // ------------------------------------------------------------------
     169                 :            : 
     170                 :  746273277 : IMPL_FORMAT_SETPIXEL_NOMASK( _24BIT_TC_BGR )
     171                 :            : {
     172                 :  746273277 :     *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetBlue();
     173                 :  746273277 :     *pScanline++ = rBitmapColor.GetGreen();
     174                 :  746273277 :     *pScanline = rBitmapColor.GetRed();
     175                 :  746273277 : }
     176                 :            : 
     177                 :            : // ------------------------------------------------------------------
     178                 :            : 
     179                 :     188266 : IMPL_FORMAT_GETPIXEL_NOMASK( _24BIT_TC_RGB )
     180                 :            : {
     181                 :     188266 :     BitmapColor aBitmapColor;
     182                 :            : 
     183                 :     188266 :     aBitmapColor.SetRed( *( pScanline = pScanline + nX * 3 )++ );
     184                 :     188266 :     aBitmapColor.SetGreen( *pScanline++ );
     185                 :     188266 :     aBitmapColor.SetBlue( *pScanline );
     186                 :            : 
     187                 :     188266 :     return aBitmapColor;
     188                 :            : }
     189                 :            : 
     190                 :            : // ------------------------------------------------------------------
     191                 :            : 
     192                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _24BIT_TC_RGB )
     193                 :            : {
     194                 :          0 :     *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetRed();
     195                 :          0 :     *pScanline++ = rBitmapColor.GetGreen();
     196                 :          0 :     *pScanline = rBitmapColor.GetBlue();
     197                 :          0 : }
     198                 :            : 
     199                 :            : // ------------------------------------------------------------------
     200                 :            : 
     201                 :          0 : IMPL_FORMAT_GETPIXEL( _24BIT_TC_MASK )
     202                 :            : {
     203                 :          0 :     BitmapColor aColor;
     204                 :          0 :     rMask.GetColorFor24Bit( aColor, pScanline + nX * 3L );
     205                 :          0 :     return aColor;
     206                 :            : }
     207                 :            : 
     208                 :            : // ------------------------------------------------------------------
     209                 :            : 
     210                 :          0 : IMPL_FORMAT_SETPIXEL( _24BIT_TC_MASK )
     211                 :            : {
     212                 :          0 :     rMask.SetColorFor24Bit( rBitmapColor, pScanline + nX * 3L );
     213                 :          0 : }
     214                 :            : 
     215                 :            : // ------------------------------------------------------------------
     216                 :            : 
     217                 :          0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_ABGR )
     218                 :            : {
     219                 :          0 :     BitmapColor aBitmapColor;
     220                 :            : 
     221                 :          0 :     aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
     222                 :          0 :     aBitmapColor.SetGreen( *pScanline++ );
     223                 :          0 :     aBitmapColor.SetRed( *pScanline );
     224                 :            : 
     225                 :          0 :     return aBitmapColor;
     226                 :            : }
     227                 :            : 
     228                 :            : // ------------------------------------------------------------------
     229                 :            : 
     230                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_ABGR )
     231                 :            : {
     232                 :          0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = 0;
     233                 :          0 :     *pScanline++ = rBitmapColor.GetBlue();
     234                 :          0 :     *pScanline++ = rBitmapColor.GetGreen();
     235                 :          0 :     *pScanline = rBitmapColor.GetRed();
     236                 :          0 : }
     237                 :            : 
     238                 :            : // ------------------------------------------------------------------
     239                 :            : 
     240                 :          0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_ARGB )
     241                 :            : {
     242                 :          0 :     BitmapColor aBitmapColor;
     243                 :            : 
     244                 :          0 :     aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
     245                 :          0 :     aBitmapColor.SetGreen( *pScanline++ );
     246                 :          0 :     aBitmapColor.SetBlue( *pScanline );
     247                 :            : 
     248                 :          0 :     return aBitmapColor;
     249                 :            : }
     250                 :            : 
     251                 :            : // ------------------------------------------------------------------
     252                 :            : 
     253                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_ARGB )
     254                 :            : {
     255                 :          0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = 0;
     256                 :          0 :     *pScanline++ = rBitmapColor.GetRed();
     257                 :          0 :     *pScanline++ = rBitmapColor.GetGreen();
     258                 :          0 :     *pScanline = rBitmapColor.GetBlue();
     259                 :          0 : }
     260                 :            : 
     261                 :            : // ------------------------------------------------------------------
     262                 :            : 
     263                 :          0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_BGRA )
     264                 :            : {
     265                 :          0 :     BitmapColor aBitmapColor;
     266                 :            : 
     267                 :          0 :     aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ );
     268                 :          0 :     aBitmapColor.SetGreen( *pScanline++ );
     269                 :          0 :     aBitmapColor.SetRed( *pScanline );
     270                 :            : 
     271                 :          0 :     return aBitmapColor;
     272                 :            : }
     273                 :            : 
     274                 :            : // ------------------------------------------------------------------
     275                 :            : 
     276                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_BGRA )
     277                 :            : {
     278                 :          0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue();
     279                 :          0 :     *pScanline++ = rBitmapColor.GetGreen();
     280                 :          0 :     *pScanline++ = rBitmapColor.GetRed();
     281                 :          0 :     *pScanline = 0;
     282                 :          0 : }
     283                 :            : 
     284                 :            : // ------------------------------------------------------------------
     285                 :            : 
     286                 :          0 : IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_RGBA )
     287                 :            : {
     288                 :          0 :     BitmapColor aBitmapColor;
     289                 :            : 
     290                 :          0 :     aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) )++ );
     291                 :          0 :     aBitmapColor.SetGreen( *pScanline++ );
     292                 :          0 :     aBitmapColor.SetBlue( *pScanline );
     293                 :            : 
     294                 :          0 :     return aBitmapColor;
     295                 :            : }
     296                 :            : 
     297                 :            : // ------------------------------------------------------------------
     298                 :            : 
     299                 :          0 : IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_RGBA )
     300                 :            : {
     301                 :          0 :     *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed();
     302                 :          0 :     *pScanline++ = rBitmapColor.GetGreen();
     303                 :          0 :     *pScanline++ = rBitmapColor.GetBlue();
     304                 :          0 :     *pScanline = 0;
     305                 :          0 : }
     306                 :            : 
     307                 :            : // ------------------------------------------------------------------
     308                 :            : 
     309                 :          0 : IMPL_FORMAT_GETPIXEL( _32BIT_TC_MASK )
     310                 :            : {
     311                 :          0 :     BitmapColor aColor;
     312                 :          0 :     rMask.GetColorFor32Bit( aColor, pScanline + ( nX << 2UL ) );
     313                 :          0 :     return aColor;
     314                 :            : }
     315                 :            : 
     316                 :            : // ------------------------------------------------------------------
     317                 :            : 
     318                 :          0 : IMPL_FORMAT_SETPIXEL( _32BIT_TC_MASK )
     319                 :            : {
     320                 :          0 :     rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) );
     321                 :          0 : }
     322                 :            : 
     323                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10