LCOV - code coverage report
Current view: top level - libreoffice/vcl/unx/generic/app - soicon.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 Functions: 0 1 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             : 
      21             : #include <unx/salunx.h>
      22             : #include <unx/saldisp.hxx>
      23             : #include <unx/salbmp.h>
      24             : #include <unx/soicon.hxx>
      25             : 
      26             : #include <vcl/bitmap.hxx>
      27             : #include <vcl/bitmapex.hxx>
      28             : #include <vcl/graph.hxx>
      29             : 
      30             : #include <svdata.hxx>
      31             : #include <svids.hrc>
      32             : #include <salbmp.hxx>
      33             : #include <impbmp.hxx>
      34             : 
      35             : 
      36           0 : sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nXScreen,
      37             :                               sal_uInt16 nIcon, sal_uInt16 iconSize,
      38             :                               Pixmap& icon_pixmap, Pixmap& icon_mask)
      39             : {
      40           0 :     if( ! ImplGetResMgr() )
      41           0 :         return sal_False;
      42             : 
      43             :     sal_uInt16 nIconSizeOffset;
      44             : 
      45           0 :     if( iconSize >= 48 )
      46           0 :         nIconSizeOffset = SV_ICON_SIZE48_START;
      47           0 :     else if( iconSize >= 32 )
      48           0 :         nIconSizeOffset = SV_ICON_SIZE32_START;
      49           0 :     else if( iconSize >= 16 )
      50           0 :         nIconSizeOffset = SV_ICON_SIZE16_START;
      51             :     else
      52           0 :         return sal_False;
      53             : 
      54           0 :     BitmapEx aIcon( ResId(nIconSizeOffset + nIcon, *ImplGetResMgr()));
      55           0 :     if( sal_True == aIcon.IsEmpty() )
      56           0 :         return sal_False;
      57             : 
      58             :     SalTwoRect aRect;
      59           0 :     aRect.mnSrcX = 0; aRect.mnSrcY = 0;
      60           0 :     aRect.mnSrcWidth = iconSize; aRect.mnSrcHeight = iconSize;
      61           0 :     aRect.mnDestX = 0; aRect.mnDestY = 0;
      62           0 :     aRect.mnDestWidth = iconSize; aRect.mnDestHeight = iconSize;
      63             : 
      64             :     X11SalBitmap *pBitmap = static_cast < X11SalBitmap * >
      65           0 :         (aIcon.ImplGetBitmapImpBitmap()->ImplGetSalBitmap());
      66             : 
      67             :     icon_pixmap = XCreatePixmap( pDisplay->GetDisplay(),
      68             :                                  pDisplay->GetRootWindow( nXScreen ),
      69             :                                  iconSize, iconSize,
      70           0 :                                  DefaultDepth( pDisplay->GetDisplay(),
      71             :                                                nXScreen.getXScreen() )
      72           0 :                                  );
      73             : 
      74             :     pBitmap->ImplDraw( icon_pixmap,
      75             :                        nXScreen,
      76           0 :                        DefaultDepth( pDisplay->GetDisplay(),
      77             :                                      nXScreen.getXScreen() ),
      78             :                        aRect,
      79           0 :                        DefaultGC( pDisplay->GetDisplay(),
      80           0 :                                   nXScreen.getXScreen() ) );
      81             : 
      82           0 :     icon_mask = None;
      83             : 
      84           0 :     if( TRANSPARENT_BITMAP == aIcon.GetTransparentType() )
      85             :     {
      86             :         icon_mask = XCreatePixmap( pDisplay->GetDisplay(),
      87             :                                    pDisplay->GetRootWindow( pDisplay->GetDefaultXScreen() ),
      88           0 :                                    iconSize, iconSize, 1);
      89             : 
      90             :         XGCValues aValues;
      91           0 :         aValues.foreground = 0xffffffff;
      92           0 :         aValues.background = 0;
      93           0 :         aValues.function = GXcopy;
      94             :         GC aMonoGC = XCreateGC( pDisplay->GetDisplay(), icon_mask,
      95           0 :             GCFunction|GCForeground|GCBackground, &aValues );
      96             : 
      97           0 :         Bitmap aMask = aIcon.GetMask();
      98           0 :         aMask.Invert();
      99             : 
     100             :         X11SalBitmap *pMask = static_cast < X11SalBitmap * >
     101           0 :             (aMask.ImplGetImpBitmap()->ImplGetSalBitmap());
     102             : 
     103           0 :         pMask->ImplDraw(icon_mask, nXScreen, 1, aRect, aMonoGC);
     104           0 :         XFreeGC( pDisplay->GetDisplay(), aMonoGC );
     105             :     }
     106             : 
     107           0 :     return sal_True;
     108             : }
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10