LCOV - code coverage report
Current view: top level - vcl/inc/unx - salbmp.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SV_SALBMP_H
      30                 :            : #define _SV_SALBMP_H
      31                 :            : 
      32                 :            : #include <unx/salstd.hxx>
      33                 :            : #ifndef _SV_SALGTYPE
      34                 :            : #include <vcl/salgtype.hxx>
      35                 :            : #endif
      36                 :            : #include <unx/saldisp.hxx>
      37                 :            : #include <salbmp.hxx>
      38                 :            : #include <vclpluginapi.h>
      39                 :            : #include <list>
      40                 :            : 
      41                 :            : struct  BitmapBuffer;
      42                 :            : class   BitmapPalette;
      43                 :            : class   SalGraphics;
      44                 :            : class   ImplSalDDB;
      45                 :            : class   ImplSalBitmapCache;
      46                 :            : 
      47                 :            : // -------------
      48                 :            : // - SalBitmap -
      49                 :            : // -------------
      50                 :            : 
      51                 :            : class VCLPLUG_GEN_PUBLIC X11SalBitmap : public SalBitmap
      52                 :            : {
      53                 :            : private:
      54                 :            : 
      55                 :            :     static BitmapBuffer*        ImplCreateDIB(
      56                 :            :                                     const Size& rSize,
      57                 :            :                                     sal_uInt16 nBitCount,
      58                 :            :                                     const BitmapPalette& rPal
      59                 :            :                                 );
      60                 :            : 
      61                 :            :     static BitmapBuffer*        ImplCreateDIB(
      62                 :            :                                     Drawable aDrawable,
      63                 :            :                                     SalX11Screen nXScreen,
      64                 :            :                                     long nDrawableDepth,
      65                 :            :                                     long nX,
      66                 :            :                                     long nY,
      67                 :            :                                     long nWidth,
      68                 :            :                                     long nHeight,
      69                 :            :                                     bool bGrey
      70                 :            :                                 );
      71                 :            : 
      72                 :            : public:
      73                 :            : 
      74                 :            :     static ImplSalBitmapCache*  mpCache;
      75                 :            :     static sal_uIntPtr          mnCacheInstCount;
      76                 :            : 
      77                 :            :     static void                 ImplCreateCache();
      78                 :            :     static void                 ImplDestroyCache();
      79                 :            :     void                        ImplRemovedFromCache();
      80                 :            : 
      81                 :            : private:
      82                 :            : 
      83                 :            :     BitmapBuffer*   mpDIB;
      84                 :            :     ImplSalDDB*     mpDDB;
      85                 :            :     bool            mbGrey;
      86                 :            : 
      87                 :            : public:
      88                 :            : 
      89                 :            :     SAL_DLLPRIVATE bool         ImplCreateFromDrawable(
      90                 :            :                                     Drawable aDrawable,
      91                 :            :                                     SalX11Screen nXScreen,
      92                 :            :                                     long nDrawableDepth,
      93                 :            :                                     long nX,
      94                 :            :                                     long nY,
      95                 :            :                                     long nWidth,
      96                 :            :                                     long nHeight
      97                 :            :                                 );
      98                 :            : 
      99                 :            :     SAL_DLLPRIVATE XImage*      ImplCreateXImage(
     100                 :            :                                     SalDisplay* pSalDisp,
     101                 :            :                                     SalX11Screen nXScreen,
     102                 :            :                                     long nDepth,
     103                 :            :                                     const SalTwoRect& rTwoRect
     104                 :            :                                 ) const;
     105                 :            : 
     106                 :            :     SAL_DLLPRIVATE ImplSalDDB*  ImplGetDDB(
     107                 :            :                                     Drawable,
     108                 :            :                                     SalX11Screen nXScreen,
     109                 :            :                                     long nDrawableDepth,
     110                 :            :                                     const SalTwoRect&
     111                 :            :                                 ) const;
     112                 :            : 
     113                 :            :     void                        ImplDraw(
     114                 :            :                                     Drawable aDrawable,
     115                 :            :                                     SalX11Screen nXScreen,
     116                 :            :                                     long nDrawableDepth,
     117                 :            :                                     const SalTwoRect& rTwoRect,
     118                 :            :                                     const GC& rGC
     119                 :            :                                 ) const;
     120                 :            : 
     121                 :            : public:
     122                 :            : 
     123                 :            :                                 X11SalBitmap();
     124                 :            :     virtual                     ~X11SalBitmap();
     125                 :            : 
     126                 :            :     // overload pure virtual methods
     127                 :            :     virtual bool                Create(
     128                 :            :                                     const Size& rSize,
     129                 :            :                                     sal_uInt16 nBitCount,
     130                 :            :                                     const BitmapPalette& rPal
     131                 :            :                                 );
     132                 :            : 
     133                 :            :     virtual bool                Create( const SalBitmap& rSalBmp );
     134                 :            :     virtual bool                Create(
     135                 :            :                                     const SalBitmap& rSalBmp,
     136                 :            :                                     SalGraphics* pGraphics
     137                 :            :                                 );
     138                 :            : 
     139                 :            :     virtual bool                Create(
     140                 :            :                                     const SalBitmap& rSalBmp,
     141                 :            :                                     sal_uInt16 nNewBitCount
     142                 :            :                                 );
     143                 :            : 
     144                 :            :     virtual bool                Create(
     145                 :            :                                     const ::com::sun::star::uno::Reference<
     146                 :            :                                         ::com::sun::star::rendering::XBitmapCanvas
     147                 :            :                                     > xBitmapCanvas,
     148                 :            :                                     Size& rSize,
     149                 :            :                                     bool bMask = false
     150                 :            :                                 );
     151                 :            : 
     152                 :            :     virtual void                Destroy();
     153                 :            : 
     154                 :            :     virtual Size                GetSize() const;
     155                 :            :     virtual sal_uInt16          GetBitCount() const;
     156                 :            : 
     157                 :            :     virtual BitmapBuffer*       AcquireBuffer( bool bReadOnly );
     158                 :            :     virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
     159                 :            :     virtual bool                GetSystemData( BitmapSystemData& rData );
     160                 :            : };
     161                 :            : 
     162                 :            : // --------------
     163                 :            : // - ImplSalDDB -
     164                 :            : // --------------
     165                 :            : 
     166                 :            : class ImplSalDDB
     167                 :            : {
     168                 :            : private:
     169                 :            : 
     170                 :            :     Pixmap          maPixmap;
     171                 :            :     SalTwoRect      maTwoRect;
     172                 :            :     long            mnDepth;
     173                 :            :     SalX11Screen    mnXScreen;
     174                 :            : 
     175                 :            :                     ImplSalDDB() : mnXScreen(0) {}
     176                 :            : 
     177                 :            :     static void     ImplDraw(
     178                 :            :                         Drawable aSrcDrawable,
     179                 :            :                         long nSrcDrawableDepth,
     180                 :            :                         Drawable aDstDrawable,
     181                 :            :                         long nDstDrawableDepth,
     182                 :            :                         long nSrcX,
     183                 :            :                         long nSrcY,
     184                 :            :                         long nDestWidth,
     185                 :            :                         long nDestHeight,
     186                 :            :                         long nDestX,
     187                 :            :                         long nDestY,
     188                 :            :                         const GC& rGC
     189                 :            :                     );
     190                 :            : 
     191                 :            : public:
     192                 :            : 
     193                 :            :                     ImplSalDDB(
     194                 :            :                         XImage* pImage,
     195                 :            :                         Drawable aDrawable,
     196                 :            :                         SalX11Screen nXScreen,
     197                 :            :                         const SalTwoRect& rTwoRect
     198                 :            :                     );
     199                 :            : 
     200                 :            :                     ImplSalDDB(
     201                 :            :                         Drawable aDrawable,
     202                 :            :                         SalX11Screen nXScreen,
     203                 :            :                         long nDrawableDepth,
     204                 :            :                         long nX,
     205                 :            :                         long nY,
     206                 :            :                         long nWidth,
     207                 :            :                         long nHeight
     208                 :            :                     );
     209                 :            : 
     210                 :            :                     ~ImplSalDDB();
     211                 :            : 
     212                 :          0 :     Pixmap          ImplGetPixmap() const { return maPixmap; }
     213                 :          0 :     long            ImplGetWidth() const { return maTwoRect.mnDestWidth; }
     214                 :          0 :     long            ImplGetHeight() const { return maTwoRect.mnDestHeight; }
     215                 :          0 :     long            ImplGetDepth() const { return mnDepth; }
     216                 :          0 :     sal_uIntPtr     ImplGetMemSize() const
     217                 :            :                     {
     218                 :          0 :                         return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 );
     219                 :            :                     }
     220                 :          0 :     SalX11Screen    ImplGetScreen() const { return mnXScreen; }
     221                 :            : 
     222                 :            :     bool            ImplMatches( SalX11Screen nXScreen, long nDepth, const SalTwoRect& rTwoRect ) const;
     223                 :            : 
     224                 :            :     void            ImplDraw(
     225                 :            :                         Drawable aDrawable,
     226                 :            :                         long nDrawableDepth,
     227                 :            :                         const SalTwoRect& rTwoRect,
     228                 :            :                         const GC& rGC
     229                 :            :                     ) const;
     230                 :            : };
     231                 :            : 
     232                 :            : // ----------------------
     233                 :            : // - ImplSalBitmapCache -
     234                 :            : // ----------------------
     235                 :            : 
     236                 :            : struct ImplBmpObj;
     237                 :            : 
     238                 :            : class ImplSalBitmapCache
     239                 :            : {
     240                 :            : private:
     241                 :            :     typedef ::std::list< ImplBmpObj* > BmpList_impl;
     242                 :            : 
     243                 :            :     BmpList_impl    maBmpList;
     244                 :            :     sal_uIntPtr     mnTotalSize;
     245                 :            : 
     246                 :            : public:
     247                 :            : 
     248                 :            :                     ImplSalBitmapCache();
     249                 :            :                     ~ImplSalBitmapCache();
     250                 :            : 
     251                 :            :     void            ImplAdd( X11SalBitmap* pBmp, sal_uIntPtr nMemSize = 0UL, sal_uIntPtr nFlags = 0UL );
     252                 :            :     void            ImplRemove( X11SalBitmap* pBmp );
     253                 :            :     void            ImplClear();
     254                 :            : };
     255                 :            : 
     256                 :            : #endif // _SV_SALBMP_HXX
     257                 :            : 
     258                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10