LCOV - code coverage report
Current view: top level - vcl/unx/generic/gdi - salgdi2.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 423 0.0 %
Date: 2014-04-14 Functions: 0 24 0.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             : #include <stdio.h>
      21             : #include <poll.h>
      22             : 
      23             : #include "vcl/salbtype.hxx"
      24             : 
      25             : #include "unx/salunx.h"
      26             : #include "unx/saldata.hxx"
      27             : #include "unx/saldisp.hxx"
      28             : #include "unx/salbmp.h"
      29             : #include "unx/salgdi.h"
      30             : #include "unx/salframe.h"
      31             : #include "unx/salvd.h"
      32             : #include <unx/x11/xlimits.hxx>
      33             : #include "xrender_peer.hxx"
      34             : 
      35             : #include "generic/printergfx.hxx"
      36             : 
      37             : #include "vcl/bmpacc.hxx"
      38             : #include <outdata.hxx>
      39             : #include <boost/scoped_ptr.hpp>
      40             : 
      41             : #undef SALGDI2_TESTTRANS
      42             : 
      43             : #if (OSL_DEBUG_LEVEL > 1) && defined SALGDI2_TESTTRANS
      44             : #define DBG_TESTTRANS( _def_drawable )                              \
      45             : {                                                                   \
      46             :     XCopyArea( pXDisp, _def_drawable, aDrawable, GetCopyGC(),       \
      47             :                0, 0,                                                \
      48             :                rPosAry.mnDestWidth, rPosAry.mnDestHeight,         \
      49             :                0, 0 );                                              \
      50             : }
      51             : #else // (OSL_DEBUG_LEVEL > 1) && defined SALGDI2_TESTTRANS
      52             : #define DBG_TESTTRANS( _def_drawable )
      53             : #endif // (OSL_DEBUG_LEVEL > 1) && defined SALGDI2_TESTTRANS
      54             : 
      55           0 : void X11SalGraphics::CopyScreenArea( Display* pDisplay,
      56             :                                      Drawable aSrc, SalX11Screen nXScreenSrc, int nSrcDepth,
      57             :                                      Drawable aDest, SalX11Screen nXScreenDest, int nDestDepth,
      58             :                                      GC aDestGC,
      59             :                                      int src_x, int src_y,
      60             :                                      unsigned int w, unsigned int h,
      61             :                                      int dest_x, int dest_y )
      62             : {
      63           0 :     if( nSrcDepth == nDestDepth )
      64             :     {
      65           0 :         if( nXScreenSrc == nXScreenDest )
      66             :             XCopyArea( pDisplay, aSrc, aDest, aDestGC,
      67           0 :                        src_x, src_y, w, h, dest_x, dest_y );
      68             :         else
      69             :         {
      70           0 :             GetGenericData()->ErrorTrapPush();
      71             :             XImage* pImage = XGetImage( pDisplay, aSrc, src_x, src_y, w, h,
      72           0 :                                         AllPlanes, ZPixmap );
      73           0 :             if( pImage )
      74             :             {
      75           0 :                 if( pImage->data )
      76             :                     XPutImage( pDisplay, aDest, aDestGC, pImage,
      77           0 :                                0, 0, dest_x, dest_y, w, h );
      78           0 :                 XDestroyImage( pImage );
      79             :             }
      80           0 :             GetGenericData()->ErrorTrapPop();
      81             :         }
      82             :     }
      83             :     else
      84             :     {
      85           0 :         X11SalBitmap aBM;
      86           0 :         aBM.ImplCreateFromDrawable( aSrc, nXScreenSrc, nSrcDepth, src_x, src_y, w, h );
      87             :         SalTwoRect aTwoRect;
      88           0 :         aTwoRect.mnSrcX = aTwoRect.mnSrcY = 0;
      89           0 :         aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = w;
      90           0 :         aTwoRect.mnSrcHeight = aTwoRect.mnDestHeight = h;
      91           0 :         aTwoRect.mnDestX = dest_x;
      92           0 :         aTwoRect.mnDestY = dest_y;
      93           0 :         aBM.ImplDraw( aDest, nXScreenDest, nDestDepth, aTwoRect,aDestGC );
      94             :     }
      95           0 : }
      96             : 
      97           0 : GC X11SalGraphics::CreateGC( Drawable hDrawable, unsigned long nMask )
      98             : {
      99             :     XGCValues values;
     100             : 
     101           0 :     values.graphics_exposures   = False;
     102           0 :     values.foreground           = m_pColormap->GetBlackPixel()
     103           0 :                                   ^ m_pColormap->GetWhitePixel();
     104           0 :     values.function             = GXxor;
     105           0 :     values.line_width           = 1;
     106           0 :     values.fill_style           = FillStippled;
     107           0 :     values.stipple              = GetDisplay()->GetInvert50( m_nXScreen );
     108           0 :     values.subwindow_mode       = ClipByChildren;
     109             : 
     110           0 :     return XCreateGC( GetXDisplay(), hDrawable, nMask | GCSubwindowMode, &values );
     111             : }
     112             : 
     113             : inline GC X11SalGraphics::GetMonoGC( Pixmap hPixmap )
     114             : {
     115             :     if( !pMonoGC_ )
     116             :         pMonoGC_ = CreateGC( hPixmap );
     117             : 
     118             :     if( !bMonoGC_ )
     119             :     {
     120             :         SetClipRegion( pMonoGC_ );
     121             :         bMonoGC_ = true;
     122             :     }
     123             : 
     124             :     return pMonoGC_;
     125             : }
     126             : 
     127           0 : inline GC X11SalGraphics::GetCopyGC()
     128             : {
     129           0 :     if( bXORMode_ ) return GetInvertGC();
     130             : 
     131           0 :     if( !pCopyGC_ )
     132           0 :         pCopyGC_ = CreateGC( GetDrawable() );
     133             : 
     134           0 :     if( !bCopyGC_ )
     135             :     {
     136           0 :         SetClipRegion( pCopyGC_ );
     137           0 :         bCopyGC_ = true;
     138             :     }
     139           0 :     return pCopyGC_;
     140             : }
     141             : 
     142           0 : GC X11SalGraphics::GetInvertGC()
     143             : {
     144           0 :     if( !pInvertGC_ )
     145             :         pInvertGC_ = CreateGC( GetDrawable(),
     146             :                                GCGraphicsExposures
     147             :                                | GCForeground
     148             :                                | GCFunction
     149           0 :                                | GCLineWidth );
     150             : 
     151           0 :     if( !bInvertGC_ )
     152             :     {
     153           0 :         SetClipRegion( pInvertGC_ );
     154           0 :         bInvertGC_ = true;
     155             :     }
     156           0 :     return pInvertGC_;
     157             : }
     158             : 
     159           0 : GC X11SalGraphics::GetInvert50GC()
     160             : {
     161           0 :     if( !pInvert50GC_ )
     162             :     {
     163             :         XGCValues values;
     164             : 
     165           0 :         values.graphics_exposures   = False;
     166           0 :         values.foreground           = m_pColormap->GetWhitePixel();
     167           0 :         values.background           = m_pColormap->GetBlackPixel();
     168           0 :         values.function             = GXinvert;
     169           0 :         values.line_width           = 1;
     170           0 :         values.line_style           = LineSolid;
     171             :         unsigned long nValueMask =
     172             :                                   GCGraphicsExposures
     173             :                                   | GCForeground
     174             :                                   | GCBackground
     175             :                                   | GCFunction
     176             :                                   | GCLineWidth
     177             :                                   | GCLineStyle
     178             :                                   | GCFillStyle
     179           0 :                                   | GCStipple;
     180             : 
     181           0 :         char* pEnv = getenv( "SAL_DO_NOT_USE_INVERT50" );
     182           0 :         if( pEnv && ! strcasecmp( pEnv, "true" ) )
     183             :         {
     184           0 :             values.fill_style = FillSolid;
     185           0 :             nValueMask &= ~ GCStipple;
     186             :         }
     187             :         else
     188             :         {
     189           0 :             values.fill_style           = FillStippled;
     190           0 :             values.stipple              = GetDisplay()->GetInvert50( m_nXScreen );
     191             :         }
     192             : 
     193             :         pInvert50GC_ = XCreateGC( GetXDisplay(), GetDrawable(),
     194             :                                   nValueMask,
     195           0 :                                   &values );
     196             :     }
     197             : 
     198           0 :     if( !bInvert50GC_ )
     199             :     {
     200           0 :         SetClipRegion( pInvert50GC_ );
     201           0 :         bInvert50GC_ = true;
     202             :     }
     203           0 :     return pInvert50GC_;
     204             : }
     205             : 
     206           0 : inline GC X11SalGraphics::GetStippleGC()
     207             : {
     208           0 :     if( !pStippleGC_ )
     209             :         pStippleGC_ = CreateGC( GetDrawable(),
     210             :                                 GCGraphicsExposures
     211             :                                 | GCFillStyle
     212           0 :                                 | GCLineWidth );
     213             : 
     214           0 :     if( !bStippleGC_ )
     215             :     {
     216           0 :         XSetFunction( GetXDisplay(), pStippleGC_, bXORMode_ ? GXxor : GXcopy );
     217           0 :         SetClipRegion( pStippleGC_ );
     218           0 :         bStippleGC_ = true;
     219             :     }
     220             : 
     221           0 :     return pStippleGC_;
     222             : }
     223             : 
     224             : extern "C"
     225             : {
     226           0 :     static Bool GraphicsExposePredicate( Display*, XEvent* pEvent, XPointer pFrameWindow )
     227             :     {
     228           0 :         Bool bRet = False;
     229           0 :         if( (pEvent->type == GraphicsExpose || pEvent->type == NoExpose) &&
     230           0 :             pEvent->xnoexpose.drawable == (Drawable)pFrameWindow )
     231             :         {
     232           0 :             bRet = True;
     233             :         }
     234           0 :         return bRet;
     235             :     }
     236             : }
     237             : 
     238           0 : void X11SalGraphics::YieldGraphicsExpose()
     239             : {
     240             :     // get frame if necessary
     241           0 :     SalFrame* pFrame    = m_pFrame;
     242           0 :     Display* pDisplay   = GetXDisplay();
     243           0 :     XLIB_Window aWindow = GetDrawable();
     244           0 :     if( ! pFrame )
     245             :     {
     246           0 :         const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
     247           0 :         for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end() && ! pFrame; ++it )
     248             :         {
     249           0 :             const SystemEnvData* pEnvData = (*it)->GetSystemData();
     250           0 :             if( Drawable(pEnvData->aWindow) == aWindow )
     251           0 :                 pFrame = *it;
     252             :         }
     253           0 :         if( ! pFrame )
     254           0 :             return;
     255             :     }
     256             : 
     257             :     XEvent aEvent;
     258           0 :     while( XCheckTypedWindowEvent( pDisplay, aWindow, Expose, &aEvent ) )
     259             :     {
     260           0 :         SalPaintEvent aPEvt( aEvent.xexpose.x, aEvent.xexpose.y, aEvent.xexpose.width+1, aEvent.xexpose.height+1 );
     261           0 :         pFrame->CallCallback( SALEVENT_PAINT, &aPEvt );
     262             :     }
     263             : 
     264           0 :     do
     265             :     {
     266           0 :         if( ! GetDisplay()->XIfEventWithTimeout( &aEvent, (XPointer)aWindow, GraphicsExposePredicate ) )
     267             :             // this should not happen at all; still sometimes it happens
     268           0 :             break;
     269             : 
     270           0 :         if( aEvent.type == NoExpose )
     271           0 :             break;
     272             : 
     273           0 :         if( pFrame )
     274             :         {
     275           0 :             SalPaintEvent aPEvt( aEvent.xgraphicsexpose.x, aEvent.xgraphicsexpose.y, aEvent.xgraphicsexpose.width+1, aEvent.xgraphicsexpose.height+1 );
     276           0 :             pFrame->CallCallback( SALEVENT_PAINT, &aPEvt );
     277             :         }
     278           0 :     } while( aEvent.xgraphicsexpose.count != 0 );
     279             : }
     280             : 
     281           0 : void X11SalGraphics::copyBits( const SalTwoRect& rPosAry,
     282             :                                   SalGraphics      *pSSrcGraphics )
     283             : {
     284             :     X11SalGraphics* pSrcGraphics = pSSrcGraphics
     285             :         ? static_cast<X11SalGraphics*>(pSSrcGraphics)
     286           0 :         : this;
     287             : 
     288           0 :     if( rPosAry.mnSrcWidth <= 0
     289           0 :         || rPosAry.mnSrcHeight <= 0
     290           0 :         || rPosAry.mnDestWidth <= 0
     291           0 :         || rPosAry.mnDestHeight <= 0 )
     292             :     {
     293           0 :         return;
     294             :     }
     295             : 
     296             :     int n;
     297           0 :     if( pSrcGraphics == this )
     298             :     {
     299           0 :         n = 2;
     300             :     }
     301           0 :     else if( pSrcGraphics->bWindow_ )
     302             :     {
     303             :         // window or compatible virtual device
     304           0 :         if( pSrcGraphics->GetDisplay() == GetDisplay() &&
     305           0 :             pSrcGraphics->m_nXScreen == m_nXScreen &&
     306           0 :             pSrcGraphics->GetVisual().GetDepth() == GetVisual().GetDepth()
     307             :             )
     308           0 :             n = 2; // same Display
     309             :         else
     310           0 :             n = 1; // printer or other display
     311             :     }
     312           0 :     else if( pSrcGraphics->bVirDev_ )
     313             :     {
     314             :         // printer compatible virtual device
     315           0 :         if( bPrinter_ )
     316           0 :             n = 2; // printer or compatible virtual device == same display
     317             :         else
     318           0 :             n = 1; // window or compatible virtual device
     319             :     }
     320             :     else
     321           0 :         n = 0;
     322             : 
     323           0 :     if( n == 2
     324           0 :         && rPosAry.mnSrcWidth   == rPosAry.mnDestWidth
     325           0 :         && rPosAry.mnSrcHeight == rPosAry.mnDestHeight
     326             :         )
     327             :     {
     328             :         // #i60699# Need to generate graphics exposures (to repaint
     329             :         // obscured areas beneath overlapping windows), src and dest
     330             :         // are the same window.
     331           0 :         const bool bNeedGraphicsExposures( pSrcGraphics == this &&
     332           0 :                                            !bVirDev_ &&
     333           0 :                                            pSrcGraphics->bWindow_ );
     334             : 
     335             :         GC pCopyGC;
     336             : 
     337           0 :         if( bXORMode_
     338           0 :             && !pSrcGraphics->bVirDev_
     339           0 :             && (GetDisplay()->GetProperties() & PROPERTY_BUG_XCopyArea_GXxor) )
     340             :         {
     341             :             Pixmap hPixmap = limitXCreatePixmap( GetXDisplay(),
     342             :                                             pSrcGraphics->GetDrawable(),        // source
     343             :                                             rPosAry.mnSrcWidth, rPosAry.mnSrcHeight,
     344           0 :                                             pSrcGraphics->GetBitCount() );
     345             : 
     346           0 :             pCopyGC = GetDisplay()->GetCopyGC( m_nXScreen );
     347             : 
     348           0 :             if( bNeedGraphicsExposures )
     349             :                 XSetGraphicsExposures( GetXDisplay(),
     350             :                                        pCopyGC,
     351           0 :                                        True );
     352             : 
     353             :             XCopyArea( GetXDisplay(),
     354             :                        pSrcGraphics->GetDrawable(),     // source
     355             :                        hPixmap,                         // destination
     356             :                        pCopyGC,                         // no clipping
     357             :                        rPosAry.mnSrcX,     rPosAry.mnSrcY,
     358             :                        rPosAry.mnSrcWidth, rPosAry.mnSrcHeight,
     359           0 :                        0,                   0 );            // destination
     360             :             XCopyArea( GetXDisplay(),
     361             :                        hPixmap,                             // source
     362             :                        GetDrawable(),                       // destination
     363             :                        GetInvertGC(),       // destination clipping
     364             :                        0,                   0,              // source
     365             :                        rPosAry.mnSrcWidth, rPosAry.mnSrcHeight,
     366           0 :                        rPosAry.mnDestX,    rPosAry.mnDestY );
     367           0 :             XFreePixmap( GetXDisplay(), hPixmap );
     368             :         }
     369             :         else
     370             :         {
     371           0 :             pCopyGC = GetCopyGC();
     372             : 
     373           0 :             if( bNeedGraphicsExposures )
     374             :                 XSetGraphicsExposures( GetXDisplay(),
     375             :                                        pCopyGC,
     376           0 :                                        True );
     377             : 
     378             :             XCopyArea( GetXDisplay(),
     379             :                        pSrcGraphics->GetDrawable(),     // source
     380             :                        GetDrawable(),                   // destination
     381             :                        pCopyGC,                         // destination clipping
     382             :                        rPosAry.mnSrcX,     rPosAry.mnSrcY,
     383             :                        rPosAry.mnSrcWidth, rPosAry.mnSrcHeight,
     384           0 :                        rPosAry.mnDestX,    rPosAry.mnDestY );
     385             :         }
     386             : 
     387           0 :         if( bNeedGraphicsExposures )
     388             :         {
     389           0 :             YieldGraphicsExpose();
     390             : 
     391           0 :             if( pCopyGC )
     392             :                 XSetGraphicsExposures( GetXDisplay(),
     393             :                                        pCopyGC,
     394           0 :                                        False );
     395           0 :         }
     396             :     }
     397           0 :     else if( n )
     398             :     {
     399             :         // #i60699# No chance to handle graphics exposures - we copy
     400             :         // to a temp bitmap first, into which no repaints are
     401             :         // technically possible.
     402             :         boost::scoped_ptr<SalBitmap> pDDB(pSrcGraphics->getBitmap( rPosAry.mnSrcX,
     403             :                                                                    rPosAry.mnSrcY,
     404             :                                                                    rPosAry.mnSrcWidth,
     405           0 :                                                                    rPosAry.mnSrcHeight ));
     406             : 
     407           0 :         if( !pDDB )
     408             :         {
     409             :             stderr0( "SalGraphics::CopyBits !pSrcGraphics->GetBitmap()\n" );
     410           0 :             return;
     411             :         }
     412             : 
     413           0 :         SalTwoRect aPosAry( rPosAry );
     414             : 
     415           0 :         aPosAry.mnSrcX = 0, aPosAry.mnSrcY = 0;
     416           0 :         drawBitmap( aPosAry, *pDDB );
     417             :     }
     418             :     else {
     419             :         stderr0( "X11SalGraphics::CopyBits from Printer not yet implemented\n" );
     420             :     }
     421             : }
     422             : 
     423           0 : void X11SalGraphics::copyArea ( long nDestX,    long nDestY,
     424             :                                 long nSrcX,     long nSrcY,
     425             :                                 long nSrcWidth, long nSrcHeight,
     426             :                                 sal_uInt16 )
     427             : {
     428             :     SalTwoRect aPosAry;
     429             : 
     430           0 :     aPosAry.mnDestX = nDestX;
     431           0 :     aPosAry.mnDestY = nDestY;
     432           0 :     aPosAry.mnDestWidth  = nSrcWidth;
     433           0 :     aPosAry.mnDestHeight = nSrcHeight;
     434             : 
     435           0 :     aPosAry.mnSrcX = nSrcX;
     436           0 :     aPosAry.mnSrcY = nSrcY;
     437           0 :     aPosAry.mnSrcWidth  = nSrcWidth;
     438           0 :     aPosAry.mnSrcHeight = nSrcHeight;
     439             : 
     440           0 :     copyBits ( aPosAry, 0 );
     441           0 : }
     442             : 
     443           0 : void X11SalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap )
     444             : {
     445           0 :     const SalDisplay*   pSalDisp = GetDisplay();
     446           0 :     Display*            pXDisp = pSalDisp->GetDisplay();
     447           0 :     const Drawable      aDrawable( GetDrawable() );
     448           0 :     const SalColormap&  rColMap = pSalDisp->GetColormap( m_nXScreen );
     449           0 :     const long          nDepth = GetDisplay()->GetVisual( m_nXScreen ).GetDepth();
     450           0 :     GC                  aGC( GetCopyGC() );
     451             :     XGCValues           aOldVal, aNewVal;
     452           0 :     int                 nValues = GCForeground | GCBackground;
     453             : 
     454           0 :     if( rSalBitmap.GetBitCount() == 1 )
     455             :     {
     456             :         // set foreground/background values for 1Bit bitmaps
     457           0 :         XGetGCValues( pXDisp, aGC, nValues, &aOldVal );
     458             : 
     459           0 :         aNewVal.foreground = rColMap.GetWhitePixel();
     460           0 :         aNewVal.background = rColMap.GetBlackPixel();
     461             : 
     462             :         //fdo#33455 handle 1 bit depth pngs with palette entries
     463             :         //to set fore/back colors
     464           0 :         if (const BitmapBuffer* pBitmapBuffer = const_cast<SalBitmap&>(rSalBitmap).AcquireBuffer(true))
     465             :         {
     466           0 :             const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
     467           0 :             if (rPalette.GetEntryCount() == 2)
     468             :             {
     469           0 :                 const BitmapColor aBlack( rPalette[rPalette.GetBestIndex( Color( COL_BLACK ) )] );
     470           0 :                 const BitmapColor aWhite( rPalette[rPalette.GetBestIndex( Color( COL_WHITE ) )] );
     471           0 :                 aNewVal.foreground = rColMap.GetPixel(ImplColorToSal(aWhite));
     472           0 :                 aNewVal.background = rColMap.GetPixel(ImplColorToSal(aBlack));
     473             :             }
     474             :         }
     475             : 
     476           0 :         XChangeGC( pXDisp, aGC, nValues, &aNewVal );
     477             :     }
     478             : 
     479           0 :     static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aDrawable, m_nXScreen, nDepth, rPosAry, aGC );
     480             : 
     481           0 :     if( rSalBitmap.GetBitCount() == 1 )
     482           0 :         XChangeGC( pXDisp, aGC, nValues, &aOldVal );
     483           0 :     XFlush( pXDisp );
     484           0 : }
     485             : 
     486           0 : void X11SalGraphics::drawBitmap( const SalTwoRect& rPosAry,
     487             :                                  const SalBitmap& rSrcBitmap,
     488             :                                  const SalBitmap& rMaskBitmap )
     489             : {
     490             :     DBG_ASSERT( !bPrinter_, "Drawing of transparent bitmaps on printer devices is strictly forbidden" );
     491             : 
     492             :     // decide if alpha masking or transparency masking is needed
     493           0 :     BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rMaskBitmap).AcquireBuffer( true );
     494           0 :     if( pAlphaBuffer != NULL )
     495             :     {
     496           0 :         int nMaskFormat = pAlphaBuffer->mnFormat;
     497           0 :         const_cast<SalBitmap&>(rMaskBitmap).ReleaseBuffer( pAlphaBuffer, true );
     498           0 :         if( nMaskFormat == BMP_FORMAT_8BIT_PAL )
     499           0 :             drawAlphaBitmap( rPosAry, rSrcBitmap, rMaskBitmap );
     500             :     }
     501             : 
     502           0 :     drawMaskedBitmap( rPosAry, rSrcBitmap, rMaskBitmap );
     503           0 : }
     504             : 
     505           0 : void X11SalGraphics::drawMaskedBitmap( const SalTwoRect& rPosAry,
     506             :                                        const SalBitmap& rSalBitmap,
     507             :                                        const SalBitmap& rTransBitmap )
     508             : {
     509           0 :     const SalDisplay*   pSalDisp = GetDisplay();
     510           0 :     Display*            pXDisp = pSalDisp->GetDisplay();
     511           0 :     Drawable            aDrawable( GetDrawable() );
     512             : 
     513             :     // figure work mode depth. If this is a VDev Drawable, use its
     514             :     // bitdepth to create pixmaps for, otherwise, XCopyArea will
     515             :     // refuse to work.
     516             :     const sal_uInt16    nDepth( m_pVDev ?
     517           0 :                             m_pVDev->GetDepth() :
     518           0 :                             pSalDisp->GetVisual( m_nXScreen ).GetDepth() );
     519             :     Pixmap          aFG( limitXCreatePixmap( pXDisp, aDrawable, rPosAry.mnDestWidth,
     520           0 :                                         rPosAry.mnDestHeight, nDepth ) );
     521             :     Pixmap          aBG( limitXCreatePixmap( pXDisp, aDrawable, rPosAry.mnDestWidth,
     522           0 :                                         rPosAry.mnDestHeight, nDepth ) );
     523             : 
     524           0 :     if( aFG && aBG )
     525             :     {
     526             :         GC                  aTmpGC;
     527             :         XGCValues           aValues;
     528           0 :         const SalColormap&  rColMap = pSalDisp->GetColormap( m_nXScreen );
     529           0 :         const int           nBlack = rColMap.GetBlackPixel(), nWhite = rColMap.GetWhitePixel();
     530           0 :         const int           nValues = GCFunction | GCForeground | GCBackground;
     531           0 :         SalTwoRect          aTmpRect( rPosAry ); aTmpRect.mnDestX = aTmpRect.mnDestY = 0;
     532             : 
     533             :         // draw paint bitmap in pixmap #1
     534           0 :         aValues.function = GXcopy, aValues.foreground = nWhite, aValues.background = nBlack;
     535           0 :         aTmpGC = XCreateGC( pXDisp, aFG, nValues, &aValues );
     536           0 :         static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aFG, m_nXScreen, nDepth, aTmpRect, aTmpGC );
     537             :         DBG_TESTTRANS( aFG );
     538             : 
     539             :         // draw background in pixmap #2
     540             :         XCopyArea( pXDisp, aDrawable, aBG, aTmpGC,
     541             :                    rPosAry.mnDestX, rPosAry.mnDestY,
     542             :                    rPosAry.mnDestWidth, rPosAry.mnDestHeight,
     543           0 :                    0, 0 );
     544             : 
     545             :         DBG_TESTTRANS( aBG );
     546             : 
     547             :         // mask out paint bitmap in pixmap #1 (transparent areas 0)
     548           0 :         aValues.function = GXand, aValues.foreground = 0x00000000, aValues.background = 0xffffffff;
     549           0 :         XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
     550           0 :         static_cast<const X11SalBitmap&>(rTransBitmap).ImplDraw( aFG, m_nXScreen, 1, aTmpRect, aTmpGC );
     551             : 
     552             :         DBG_TESTTRANS( aFG );
     553             : 
     554             :         // #105055# For XOR mode, keep background behind bitmap intact
     555           0 :         if( !bXORMode_ )
     556             :         {
     557             :             // mask out background in pixmap #2 (nontransparent areas 0)
     558           0 :             aValues.function = GXand, aValues.foreground = 0xffffffff, aValues.background = 0x00000000;
     559           0 :             XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
     560           0 :             static_cast<const X11SalBitmap&>(rTransBitmap).ImplDraw( aBG, m_nXScreen, 1, aTmpRect, aTmpGC );
     561             : 
     562             :             DBG_TESTTRANS( aBG );
     563             :         }
     564             : 
     565             :         // merge pixmap #1 and pixmap #2 in pixmap #2
     566           0 :         aValues.function = GXxor, aValues.foreground = 0xffffffff, aValues.background = 0x00000000;
     567           0 :         XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
     568             :         XCopyArea( pXDisp, aFG, aBG, aTmpGC,
     569             :                    0, 0,
     570             :                    rPosAry.mnDestWidth, rPosAry.mnDestHeight,
     571           0 :                    0, 0 );
     572             :         DBG_TESTTRANS( aBG );
     573             : 
     574             :         // #105055# Disable XOR temporarily
     575           0 :         bool bOldXORMode( bXORMode_ );
     576           0 :         bXORMode_ = false;
     577             : 
     578             :         // copy pixmap #2 (result) to background
     579             :         XCopyArea( pXDisp, aBG, aDrawable, GetCopyGC(),
     580             :                    0, 0,
     581             :                    rPosAry.mnDestWidth, rPosAry.mnDestHeight,
     582           0 :                    rPosAry.mnDestX, rPosAry.mnDestY );
     583             : 
     584             :         DBG_TESTTRANS( aBG );
     585             : 
     586           0 :         bXORMode_ = bOldXORMode;
     587             : 
     588           0 :         XFreeGC( pXDisp, aTmpGC );
     589           0 :         XFlush( pXDisp );
     590             :     }
     591             :     else
     592           0 :         drawBitmap( rPosAry, rSalBitmap );
     593             : 
     594           0 :     if( aFG )
     595           0 :         XFreePixmap( pXDisp, aFG );
     596             : 
     597           0 :     if( aBG )
     598           0 :         XFreePixmap( pXDisp, aBG );
     599           0 : }
     600             : 
     601           0 : bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
     602             :     const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp )
     603             : {
     604             :     // non 8-bit alpha not implemented yet
     605           0 :     if( rAlphaBmp.GetBitCount() != 8 )
     606           0 :         return false;
     607             : 
     608             :     // horizontal mirroring not implemented yet
     609           0 :     if( rTR.mnDestWidth < 0 )
     610           0 :         return false;
     611             : 
     612             :     // stretched conversion is not implemented yet
     613           0 :     if( rTR.mnDestWidth != rTR.mnSrcWidth )
     614           0 :         return false;
     615           0 :     if( rTR.mnDestHeight!= rTR.mnSrcHeight )
     616           0 :         return false;
     617             : 
     618             :     // create destination picture
     619           0 :     Picture aDstPic = GetXRenderPicture();
     620           0 :     if( !aDstPic )
     621           0 :         return false;
     622             : 
     623           0 :     const SalDisplay* pSalDisp = GetDisplay();
     624           0 :     const SalVisual& rSalVis = pSalDisp->GetVisual( m_nXScreen );
     625           0 :     Display* pXDisplay = pSalDisp->GetDisplay();
     626             : 
     627             :     // create source Picture
     628           0 :     int nDepth = m_pVDev ? m_pVDev->GetDepth() : rSalVis.GetDepth();
     629           0 :     const X11SalBitmap& rSrcX11Bmp = static_cast<const X11SalBitmap&>( rSrcBitmap );
     630           0 :     ImplSalDDB* pSrcDDB = rSrcX11Bmp.ImplGetDDB( hDrawable_, m_nXScreen, nDepth, rTR );
     631           0 :     if( !pSrcDDB )
     632           0 :         return false;
     633             : 
     634             :     //#i75249# workaround for ImplGetDDB() giving us back a different depth than
     635             :     // we requested. E.g. mask pixmaps are always compatible with the drawable
     636             :     // TODO: find an appropriate picture format for these cases
     637             :     //       then remove the workaround below and the one for #i75531#
     638           0 :     if( nDepth != pSrcDDB->ImplGetDepth() )
     639           0 :         return false;
     640             : 
     641           0 :     Pixmap aSrcPM = pSrcDDB->ImplGetPixmap();
     642           0 :     if( !aSrcPM )
     643           0 :         return false;
     644             : 
     645             :     // create source picture
     646             :     // TODO: use scoped picture
     647           0 :     Visual* pSrcXVisual = rSalVis.GetVisual();
     648           0 :     XRenderPeer& rPeer = XRenderPeer::GetInstance();
     649           0 :     XRenderPictFormat* pSrcVisFmt = rPeer.FindVisualFormat( pSrcXVisual );
     650           0 :     if( !pSrcVisFmt )
     651           0 :         return false;
     652           0 :     Picture aSrcPic = rPeer.CreatePicture( aSrcPM, pSrcVisFmt, 0, NULL );
     653           0 :     if( !aSrcPic )
     654           0 :         return false;
     655             : 
     656             :     // create alpha Picture
     657             : 
     658             :     // TODO: use SalX11Bitmap functionality and caching for the Alpha Pixmap
     659             :     // problem is that they don't provide an 8bit Pixmap on a non-8bit display
     660           0 :     BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rAlphaBmp).AcquireBuffer( true );
     661             : 
     662             :     // an XImage needs its data top_down
     663             :     // TODO: avoid wrongly oriented images in upper layers!
     664           0 :     const int nImageSize = pAlphaBuffer->mnHeight * pAlphaBuffer->mnScanlineSize;
     665           0 :     const char* pSrcBits = (char*)pAlphaBuffer->mpBits;
     666           0 :     char* pAlphaBits = new char[ nImageSize ];
     667           0 :     if( BMP_SCANLINE_ADJUSTMENT( pAlphaBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
     668           0 :         memcpy( pAlphaBits, pSrcBits, nImageSize );
     669             :     else
     670             :     {
     671           0 :         char* pDstBits = pAlphaBits + nImageSize;
     672           0 :         const int nLineSize = pAlphaBuffer->mnScanlineSize;
     673           0 :         for(; (pDstBits -= nLineSize) >= pAlphaBits; pSrcBits += nLineSize )
     674           0 :             memcpy( pDstBits, pSrcBits, nLineSize );
     675             :     }
     676             : 
     677             :     // the alpha values need to be inverted for XRender
     678             :     // TODO: make upper layers use standard alpha
     679           0 :     long* pLDst = (long*)pAlphaBits;
     680           0 :     for( int i = nImageSize/sizeof(long); --i >= 0; ++pLDst )
     681           0 :         *pLDst = ~*pLDst;
     682             : 
     683           0 :     char* pCDst = (char*)pLDst;
     684           0 :     for( int i = nImageSize & (sizeof(long)-1); --i >= 0; ++pCDst )
     685           0 :         *pCDst = ~*pCDst;
     686             : 
     687           0 :     const XRenderPictFormat* pAlphaFormat = rPeer.GetStandardFormatA8();
     688             :     XImage* pAlphaImg = XCreateImage( pXDisplay, pSrcXVisual, 8, ZPixmap, 0,
     689             :         pAlphaBits, pAlphaBuffer->mnWidth, pAlphaBuffer->mnHeight,
     690           0 :         pAlphaFormat->depth, pAlphaBuffer->mnScanlineSize );
     691             : 
     692             :     Pixmap aAlphaPM = limitXCreatePixmap( pXDisplay, hDrawable_,
     693           0 :         rTR.mnDestWidth, rTR.mnDestHeight, 8 );
     694             : 
     695             :     XGCValues aAlphaGCV;
     696           0 :     aAlphaGCV.function = GXcopy;
     697           0 :     GC aAlphaGC = XCreateGC( pXDisplay, aAlphaPM, GCFunction, &aAlphaGCV );
     698             :     XPutImage( pXDisplay, aAlphaPM, aAlphaGC, pAlphaImg,
     699           0 :         rTR.mnSrcX, rTR.mnSrcY, 0, 0, rTR.mnDestWidth, rTR.mnDestHeight );
     700           0 :     XFreeGC( pXDisplay, aAlphaGC );
     701           0 :     XFree( pAlphaImg );
     702           0 :     if( pAlphaBits != (char*)pAlphaBuffer->mpBits )
     703           0 :         delete[] pAlphaBits;
     704             : 
     705           0 :     const_cast<SalBitmap&>(rAlphaBmp).ReleaseBuffer( pAlphaBuffer, true );
     706             : 
     707             :     XRenderPictureAttributes aAttr;
     708           0 :     aAttr.repeat = int(true);
     709           0 :     Picture aAlphaPic = rPeer.CreatePicture( aAlphaPM, pAlphaFormat, CPRepeat, &aAttr );
     710           0 :     if( !aAlphaPic )
     711           0 :         return false;
     712             : 
     713             :     // set clipping
     714           0 :     if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
     715           0 :         rPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
     716             : 
     717             :     // paint source * mask over destination picture
     718             :     rPeer.CompositePicture( PictOpOver, aSrcPic, aAlphaPic, aDstPic,
     719             :         rTR.mnSrcX, rTR.mnSrcY, 0, 0,
     720           0 :         rTR.mnDestX, rTR.mnDestY, rTR.mnDestWidth, rTR.mnDestHeight );
     721             : 
     722           0 :     rPeer.FreePicture( aAlphaPic );
     723           0 :     XFreePixmap(pXDisplay, aAlphaPM);
     724           0 :     rPeer.FreePicture( aSrcPic );
     725           0 :     return true;
     726             : }
     727             : 
     728           0 : bool X11SalGraphics::drawTransformedBitmap(
     729             :     const basegfx::B2DPoint& rNull,
     730             :     const basegfx::B2DPoint& rX,
     731             :     const basegfx::B2DPoint& rY,
     732             :     const SalBitmap& rSourceBitmap,
     733             :     const SalBitmap* pAlphaBitmap)
     734             : {
     735             :     // here direct support for transformed bitmaps can be impemented
     736             :     (void)rNull; (void)rX; (void)rY; (void)rSourceBitmap; (void)pAlphaBitmap;
     737           0 :     return false;
     738             : }
     739             : 
     740           0 : bool X11SalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
     741             :                                     long nHeight, sal_uInt8 nTransparency )
     742             : {
     743           0 :     if( ! m_pFrame && ! m_pVDev )
     744           0 :         return false;
     745             : 
     746           0 :     if( bPenGC_ || !bBrushGC_ || bXORMode_ )
     747           0 :         return false; // can only perform solid fills without XOR.
     748             : 
     749           0 :     if( m_pVDev && m_pVDev->GetDepth() < 8 )
     750           0 :         return false;
     751             : 
     752           0 :     Picture aDstPic = GetXRenderPicture();
     753           0 :     if( !aDstPic )
     754           0 :         return false;
     755             : 
     756           0 :     const double fTransparency = (100 - nTransparency) * (1.0/100);
     757           0 :     const XRenderColor aRenderColor = GetXRenderColor( nBrushColor_ , fTransparency);
     758             : 
     759           0 :     XRenderPeer& rPeer = XRenderPeer::GetInstance();
     760             :     rPeer.FillRectangle( PictOpOver,
     761             :                          aDstPic,
     762             :                          &aRenderColor,
     763             :                          nX, nY,
     764           0 :                          nWidth, nHeight );
     765             : 
     766           0 :     return true;
     767             : }
     768             : 
     769           0 : void X11SalGraphics::drawBitmap( const SalTwoRect&,
     770             :                                  const SalBitmap&,
     771             :                                  SalColor )
     772             : {
     773             :     OSL_FAIL( "::DrawBitmap with transparent color not supported" );
     774           0 : }
     775             : 
     776           0 : void X11SalGraphics::drawMask( const SalTwoRect& rPosAry,
     777             :                                const SalBitmap &rSalBitmap,
     778             :                                SalColor nMaskColor )
     779             : {
     780           0 :     const SalDisplay*   pSalDisp = GetDisplay();
     781           0 :     Display*            pXDisp = pSalDisp->GetDisplay();
     782           0 :     Drawable            aDrawable( GetDrawable() );
     783             :     Pixmap              aStipple( limitXCreatePixmap( pXDisp, aDrawable,
     784             :                                                  rPosAry.mnDestWidth,
     785           0 :                                                  rPosAry.mnDestHeight, 1 ) );
     786             : 
     787           0 :     if( aStipple )
     788             :     {
     789           0 :         SalTwoRect  aTwoRect( rPosAry ); aTwoRect.mnDestX = aTwoRect.mnDestY = 0;
     790             :         GC          aTmpGC;
     791             :         XGCValues   aValues;
     792             : 
     793             :         // create a stipple bitmap first (set bits are changed to unset bits and vice versa)
     794           0 :         aValues.function = GXcopyInverted;
     795           0 :         aValues.foreground = 1, aValues.background = 0;
     796           0 :         aTmpGC = XCreateGC( pXDisp, aStipple, GCFunction | GCForeground | GCBackground, &aValues );
     797           0 :         static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aStipple, m_nXScreen, 1, aTwoRect, aTmpGC );
     798             : 
     799           0 :         XFreeGC( pXDisp, aTmpGC );
     800             : 
     801             :         // Set stipple and draw rectangle
     802           0 :         GC  aStippleGC( GetStippleGC() );
     803           0 :         int nX = rPosAry.mnDestX, nY = rPosAry.mnDestY;
     804             : 
     805           0 :         XSetStipple( pXDisp, aStippleGC, aStipple );
     806           0 :         XSetTSOrigin( pXDisp, aStippleGC, nX, nY );
     807           0 :         XSetForeground( pXDisp, aStippleGC, GetPixel( nMaskColor ) );
     808             :         XFillRectangle( pXDisp, aDrawable, aStippleGC,
     809             :                         nX, nY,
     810           0 :                         rPosAry.mnDestWidth, rPosAry.mnDestHeight );
     811           0 :         XFreePixmap( pXDisp, aStipple );
     812           0 :         XFlush( pXDisp );
     813             :     }
     814             :     else
     815           0 :         drawBitmap( rPosAry, rSalBitmap );
     816           0 : }
     817             : 
     818           0 : SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY )
     819             : {
     820           0 :     if( bPrinter_ && !bVirDev_ )
     821           0 :         return NULL;
     822             : 
     823           0 :     bool bFakeWindowBG = false;
     824             : 
     825             :     // normalize
     826           0 :     if( nDX < 0 )
     827             :     {
     828           0 :         nX += nDX;
     829           0 :         nDX = -nDX;
     830             :     }
     831           0 :     if ( nDY < 0 )
     832             :     {
     833           0 :         nY += nDY;
     834           0 :         nDY = -nDY;
     835             :     }
     836             : 
     837           0 :     if( bWindow_ && !bVirDev_ )
     838             :     {
     839             :         XWindowAttributes aAttrib;
     840             : 
     841           0 :         XGetWindowAttributes( GetXDisplay(), GetDrawable(), &aAttrib );
     842           0 :         if( aAttrib.map_state != IsViewable )
     843           0 :             bFakeWindowBG = true;
     844             :         else
     845             :         {
     846           0 :             long nOrgDX = nDX, nOrgDY = nDY;
     847             : 
     848             :             // clip to window size
     849           0 :             if ( nX < 0 )
     850             :             {
     851           0 :                 nDX += nX;
     852           0 :                 nX   = 0;
     853             :             }
     854           0 :             if ( nY < 0 )
     855             :             {
     856           0 :                 nDY += nY;
     857           0 :                 nY   = 0;
     858             :             }
     859           0 :             if( nX + nDX > aAttrib.width )
     860           0 :                 nDX = aAttrib.width  - nX;
     861           0 :             if( nY + nDY > aAttrib.height )
     862           0 :                 nDY = aAttrib.height - nY;
     863             : 
     864             :             // inside ?
     865           0 :             if( nDX <= 0 || nDY <= 0 )
     866             :             {
     867           0 :                 bFakeWindowBG = true;
     868           0 :                 nDX = nOrgDX;
     869           0 :                 nDY = nOrgDY;
     870             :             }
     871             :         }
     872             :     }
     873             : 
     874           0 :     X11SalBitmap*   pSalBitmap = new X11SalBitmap;
     875           0 :     sal_uInt16          nBitCount = GetBitCount();
     876             : 
     877           0 :     if( &GetDisplay()->GetColormap( m_nXScreen ) != &GetColormap() )
     878           0 :         nBitCount = 1;
     879             : 
     880           0 :     if( ! bFakeWindowBG )
     881           0 :         pSalBitmap->ImplCreateFromDrawable( GetDrawable(), m_nXScreen, nBitCount, nX, nY, nDX, nDY );
     882             :     else
     883           0 :         pSalBitmap->Create( Size( nDX, nDY ), (nBitCount > 8) ? 24 : nBitCount, BitmapPalette( nBitCount > 8 ? nBitCount : 0 ) );
     884             : 
     885           0 :     return pSalBitmap;
     886             : }
     887             : 
     888           0 : SalColor X11SalGraphics::getPixel( long nX, long nY )
     889             : {
     890           0 :     if( bWindow_ && !bVirDev_ )
     891             :     {
     892             :         XWindowAttributes aAttrib;
     893             : 
     894           0 :         XGetWindowAttributes( GetXDisplay(), GetDrawable(), &aAttrib );
     895           0 :         if( aAttrib.map_state != IsViewable )
     896             :         {
     897             :             stderr0( "X11SalGraphics::GetPixel drawable not viewable\n" );
     898           0 :             return 0;
     899             :         }
     900             :     }
     901             : 
     902             :     XImage *pXImage = XGetImage( GetXDisplay(),
     903             :                                      GetDrawable(),
     904             :                                  nX, nY,
     905             :                                  1,  1,
     906             :                                  AllPlanes,
     907           0 :                                  ZPixmap );
     908           0 :     if( !pXImage )
     909             :     {
     910             :         stderr0( "X11SalGraphics::GetPixel !XGetImage()\n" );
     911           0 :         return 0;
     912             :     }
     913             : 
     914             :     XColor aXColor;
     915             : 
     916           0 :     aXColor.pixel = XGetPixel( pXImage, 0, 0 );
     917           0 :     XDestroyImage( pXImage );
     918             : 
     919           0 :     return GetColormap().GetColor( aXColor.pixel );
     920             : }
     921             : 
     922           0 : void X11SalGraphics::invert( long       nX,
     923             :                                 long        nY,
     924             :                                 long        nDX,
     925             :                                 long        nDY,
     926             :                                 SalInvert   nFlags )
     927             : {
     928             :     GC pGC;
     929           0 :     if( SAL_INVERT_50 & nFlags )
     930             :     {
     931           0 :         pGC = GetInvert50GC();
     932           0 :         XFillRectangle( GetXDisplay(), GetDrawable(), pGC, nX, nY, nDX, nDY );
     933             :     }
     934             :     else
     935             :     {
     936           0 :         if ( SAL_INVERT_TRACKFRAME & nFlags )
     937             :         {
     938           0 :             pGC = GetTrackingGC();
     939           0 :             XDrawRectangle( GetXDisplay(), GetDrawable(),  pGC, nX, nY, nDX, nDY );
     940             :         }
     941             :         else
     942             :         {
     943           0 :             pGC = GetInvertGC();
     944           0 :             XFillRectangle( GetXDisplay(), GetDrawable(),  pGC, nX, nY, nDX, nDY );
     945             :         }
     946             :     }
     947           0 : }
     948             : 
     949           0 : bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const
     950             : {
     951           0 :     bool bRet = false;
     952           0 :     switch( eType )
     953             :     {
     954             :     case OutDevSupport_TransparentRect:
     955             :     case OutDevSupport_B2DDraw:
     956             :         {
     957           0 :             XRenderPeer& rPeer = XRenderPeer::GetInstance();
     958           0 :             const SalDisplay* pSalDisp = GetDisplay();
     959           0 :             const SalVisual& rSalVis = pSalDisp->GetVisual( m_nXScreen );
     960             : 
     961           0 :             Visual* pDstXVisual = rSalVis.GetVisual();
     962           0 :             XRenderPictFormat* pDstVisFmt = rPeer.FindVisualFormat( pDstXVisual );
     963           0 :             if( pDstVisFmt )
     964           0 :                 bRet = true;
     965             :         }
     966           0 :         break;
     967           0 :     default: break;
     968             :     }
     969           0 :     return bRet;
     970           0 : }
     971             : 
     972             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10