LCOV - code coverage report
Current view: top level - vcl/inc/unx - salbmp.h (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 7 0.0 %
Date: 2014-04-11 Functions: 0 6 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             : #ifndef INCLUDED_VCL_INC_UNX_SALBMP_H
      21             : #define INCLUDED_VCL_INC_UNX_SALBMP_H
      22             : 
      23             : #include <prex.h>
      24             : #include <postx.h>
      25             : #include <vcl/salgtype.hxx>
      26             : #include <unx/saldisp.hxx>
      27             : #include <salbmp.hxx>
      28             : #include <vclpluginapi.h>
      29             : #include <list>
      30             : 
      31             : struct  BitmapBuffer;
      32             : class   BitmapPalette;
      33             : class   SalGraphics;
      34             : class   ImplSalDDB;
      35             : class   ImplSalBitmapCache;
      36             : 
      37             : // - SalBitmap -
      38             : 
      39             : class VCLPLUG_GEN_PUBLIC X11SalBitmap : public SalBitmap
      40             : {
      41             : private:
      42             : 
      43             :     static BitmapBuffer*        ImplCreateDIB(
      44             :                                     const Size& rSize,
      45             :                                     sal_uInt16 nBitCount,
      46             :                                     const BitmapPalette& rPal
      47             :                                 );
      48             : 
      49             :     static BitmapBuffer*        ImplCreateDIB(
      50             :                                     Drawable aDrawable,
      51             :                                     SalX11Screen nXScreen,
      52             :                                     long nDrawableDepth,
      53             :                                     long nX,
      54             :                                     long nY,
      55             :                                     long nWidth,
      56             :                                     long nHeight,
      57             :                                     bool bGrey
      58             :                                 );
      59             : 
      60             : public:
      61             : 
      62             :     static ImplSalBitmapCache*  mpCache;
      63             :     static sal_uIntPtr          mnCacheInstCount;
      64             : 
      65             :     static void                 ImplCreateCache();
      66             :     static void                 ImplDestroyCache();
      67             :     void                        ImplRemovedFromCache();
      68             : 
      69             : private:
      70             : 
      71             :     BitmapBuffer*   mpDIB;
      72             :     ImplSalDDB*     mpDDB;
      73             :     bool            mbGrey;
      74             : 
      75             : public:
      76             : 
      77             :     SAL_DLLPRIVATE bool         ImplCreateFromDrawable(
      78             :                                     Drawable aDrawable,
      79             :                                     SalX11Screen nXScreen,
      80             :                                     long nDrawableDepth,
      81             :                                     long nX,
      82             :                                     long nY,
      83             :                                     long nWidth,
      84             :                                     long nHeight
      85             :                                 );
      86             : 
      87             :     SAL_DLLPRIVATE XImage*      ImplCreateXImage(
      88             :                                     SalDisplay* pSalDisp,
      89             :                                     SalX11Screen nXScreen,
      90             :                                     long nDepth,
      91             :                                     const SalTwoRect& rTwoRect
      92             :                                 ) const;
      93             : 
      94             :     SAL_DLLPRIVATE ImplSalDDB*  ImplGetDDB(
      95             :                                     Drawable,
      96             :                                     SalX11Screen nXScreen,
      97             :                                     long nDrawableDepth,
      98             :                                     const SalTwoRect&
      99             :                                 ) const;
     100             : 
     101             :     void                        ImplDraw(
     102             :                                     Drawable aDrawable,
     103             :                                     SalX11Screen nXScreen,
     104             :                                     long nDrawableDepth,
     105             :                                     const SalTwoRect& rTwoRect,
     106             :                                     const GC& rGC
     107             :                                 ) const;
     108             : 
     109             : public:
     110             : 
     111             :                                 X11SalBitmap();
     112             :     virtual                     ~X11SalBitmap();
     113             : 
     114             :     // overload pure virtual methods
     115             :     virtual bool                Create(
     116             :                                     const Size& rSize,
     117             :                                     sal_uInt16 nBitCount,
     118             :                                     const BitmapPalette& rPal
     119             :                                 ) SAL_OVERRIDE;
     120             : 
     121             :     virtual bool                Create( const SalBitmap& rSalBmp ) SAL_OVERRIDE;
     122             :     virtual bool                Create(
     123             :                                     const SalBitmap& rSalBmp,
     124             :                                     SalGraphics* pGraphics
     125             :                                 ) SAL_OVERRIDE;
     126             : 
     127             :     virtual bool                Create(
     128             :                                     const SalBitmap& rSalBmp,
     129             :                                     sal_uInt16 nNewBitCount
     130             :                                 ) SAL_OVERRIDE;
     131             : 
     132             :     virtual bool                Create(
     133             :                                     const ::com::sun::star::uno::Reference<
     134             :                                         ::com::sun::star::rendering::XBitmapCanvas
     135             :                                     > xBitmapCanvas,
     136             :                                     Size& rSize,
     137             :                                     bool bMask = false
     138             :                                 ) SAL_OVERRIDE;
     139             : 
     140             :     virtual void                Destroy() SAL_OVERRIDE;
     141             : 
     142             :     virtual Size                GetSize() const SAL_OVERRIDE;
     143             :     virtual sal_uInt16          GetBitCount() const SAL_OVERRIDE;
     144             : 
     145             :     virtual BitmapBuffer*       AcquireBuffer( bool bReadOnly ) SAL_OVERRIDE;
     146             :     virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) SAL_OVERRIDE;
     147             :     virtual bool                GetSystemData( BitmapSystemData& rData ) SAL_OVERRIDE;
     148             : };
     149             : 
     150             : // - ImplSalDDB -
     151             : 
     152             : class ImplSalDDB
     153             : {
     154             : private:
     155             : 
     156             :     Pixmap          maPixmap;
     157             :     SalTwoRect      maTwoRect;
     158             :     long            mnDepth;
     159             :     SalX11Screen    mnXScreen;
     160             : 
     161             :                     ImplSalDDB() : mnXScreen(0) {}
     162             : 
     163             :     static void     ImplDraw(
     164             :                         Drawable aSrcDrawable,
     165             :                         long nSrcDrawableDepth,
     166             :                         Drawable aDstDrawable,
     167             :                         long nDstDrawableDepth,
     168             :                         long nSrcX,
     169             :                         long nSrcY,
     170             :                         long nDestWidth,
     171             :                         long nDestHeight,
     172             :                         long nDestX,
     173             :                         long nDestY,
     174             :                         const GC& rGC
     175             :                     );
     176             : 
     177             : public:
     178             : 
     179             :                     ImplSalDDB(
     180             :                         XImage* pImage,
     181             :                         Drawable aDrawable,
     182             :                         SalX11Screen nXScreen,
     183             :                         const SalTwoRect& rTwoRect
     184             :                     );
     185             : 
     186             :                     ImplSalDDB(
     187             :                         Drawable aDrawable,
     188             :                         SalX11Screen nXScreen,
     189             :                         long nDrawableDepth,
     190             :                         long nX,
     191             :                         long nY,
     192             :                         long nWidth,
     193             :                         long nHeight
     194             :                     );
     195             : 
     196             :                     ~ImplSalDDB();
     197             : 
     198           0 :     Pixmap          ImplGetPixmap() const { return maPixmap; }
     199           0 :     long            ImplGetWidth() const { return maTwoRect.mnDestWidth; }
     200           0 :     long            ImplGetHeight() const { return maTwoRect.mnDestHeight; }
     201           0 :     long            ImplGetDepth() const { return mnDepth; }
     202           0 :     sal_uIntPtr     ImplGetMemSize() const
     203             :                     {
     204           0 :                         return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 );
     205             :                     }
     206           0 :     SalX11Screen    ImplGetScreen() const { return mnXScreen; }
     207             : 
     208             :     bool            ImplMatches( SalX11Screen nXScreen, long nDepth, const SalTwoRect& rTwoRect ) const;
     209             : 
     210             :     void            ImplDraw(
     211             :                         Drawable aDrawable,
     212             :                         long nDrawableDepth,
     213             :                         const SalTwoRect& rTwoRect,
     214             :                         const GC& rGC
     215             :                     ) const;
     216             : };
     217             : 
     218             : // - ImplSalBitmapCache -
     219             : 
     220             : struct ImplBmpObj;
     221             : 
     222             : class ImplSalBitmapCache
     223             : {
     224             : private:
     225             :     typedef ::std::list< ImplBmpObj* > BmpList_impl;
     226             : 
     227             :     BmpList_impl    maBmpList;
     228             :     sal_uIntPtr     mnTotalSize;
     229             : 
     230             : public:
     231             : 
     232             :                     ImplSalBitmapCache();
     233             :                     ~ImplSalBitmapCache();
     234             : 
     235             :     void            ImplAdd( X11SalBitmap* pBmp, sal_uIntPtr nMemSize = 0UL, sal_uIntPtr nFlags = 0UL );
     236             :     void            ImplRemove( X11SalBitmap* pBmp );
     237             :     void            ImplClear();
     238             : };
     239             : 
     240             : #endif // INCLUDED_VCL_INC_UNX_SALBMP_H
     241             : 
     242             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10