[Libreoffice-commits] .: vcl/inc vcl/unx

Joseph Powers jpowers at kemper.freedesktop.org
Mon Jul 18 20:56:25 PDT 2011


 vcl/inc/unx/salbmp.h           |  290 ++++++++++++++++++----------------
 vcl/unx/generic/gdi/salbmp.cxx |  343 ++++++++++++++++++++++++++---------------
 2 files changed, 379 insertions(+), 254 deletions(-)

New commits:
commit d0297b8435b9ce6d6203e9cd35d1c7b2413a2ab1
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Mon Jul 18 20:55:51 2011 -0700

    Whitespace cleanup

diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 15fb5fd..42230d8 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -37,11 +37,11 @@
 #include <salbmp.hxx>
 #include <vclpluginapi.h>
 
-struct	BitmapBuffer;
-class	BitmapPalette;
-class	SalGraphics;
-class	ImplSalDDB;
-class	ImplSalBitmapCache;
+struct  BitmapBuffer;
+class   BitmapPalette;
+class   SalGraphics;
+class   ImplSalDDB;
+class   ImplSalBitmapCache;
 
 // -------------
 // - SalBitmap -
@@ -51,80 +51,118 @@ class VCLPLUG_GEN_PUBLIC X11SalBitmap : public SalBitmap
 {
 private:
 
-    static BitmapBuffer*		ImplCreateDIB( const Size& rSize,
-                                               sal_uInt16 nBitCount,
-                                               const BitmapPalette& rPal );
-    static BitmapBuffer*		ImplCreateDIB( Drawable aDrawable,
-                                               int nScreen,
-                                               long nDrawableDepth,
-                                               long nX, long nY,
-                                               long nWidth, long nHeight,
-                                               bool bGrey );
+    static BitmapBuffer*        ImplCreateDIB(
+                                    const Size& rSize,
+                                    sal_uInt16 nBitCount,
+                                    const BitmapPalette& rPal
+                                );
+
+    static BitmapBuffer*        ImplCreateDIB(
+                                    Drawable aDrawable,
+                                    int nScreen,
+                                    long nDrawableDepth,
+                                    long nX,
+                                    long nY,
+                                    long nWidth,
+                                    long nHeight,
+                                    bool bGrey
+                                );
 
 public:
 
-    static ImplSalBitmapCache*	mpCache;
-    static sal_uIntPtr				mnCacheInstCount;
+    static ImplSalBitmapCache*  mpCache;
+    static sal_uIntPtr          mnCacheInstCount;
 
-    static void					ImplCreateCache();
-    static void					ImplDestroyCache();
-    void				        ImplRemovedFromCache();
+    static void                 ImplCreateCache();
+    static void                 ImplDestroyCache();
+    void                        ImplRemovedFromCache();
 
     bool                        SnapShot (Display* pDisplay, XLIB_Window hWindow);
-    bool                        ImplCreateFromXImage( Display* pDisplay,
-                                                      XLIB_Window hWindow,
-                                                      int nScreen,
-                                                      XImage* pImage);
+    bool                        ImplCreateFromXImage(
+                                    Display* pDisplay,
+                                    XLIB_Window hWindow,
+                                    int nScreen,
+                                    XImage* pImage
+                                );
 private:
 
-
-    BitmapBuffer*	mpDIB;
-    ImplSalDDB*		mpDDB;
+    BitmapBuffer*   mpDIB;
+    ImplSalDDB*     mpDDB;
     bool            mbGrey;
 
 public:
 
-    SAL_DLLPRIVATE bool    ImplCreateFromDrawable( Drawable aDrawable,
-                                                  int nScreen,
-                                                  long nDrawableDepth,
-                                                  long nX, long nY,
-                                                  long nWidth, long nHeight );
-
-    SAL_DLLPRIVATE XImage* ImplCreateXImage( SalDisplay* pSalDisp,
-                                            int nScreen, long nDepth,
-                                              const SalTwoRect& rTwoRect ) const;
-
-    SAL_DLLPRIVATE ImplSalDDB* ImplGetDDB( Drawable, int nScreen, long nDrawableDepth,
-                                           const SalTwoRect& ) const;
-    void    ImplDraw( Drawable aDrawable, int nScreen, long nDrawableDepth,
-                      const SalTwoRect& rTwoRect, const GC& rGC ) const;
+    SAL_DLLPRIVATE bool         ImplCreateFromDrawable(
+                                    Drawable aDrawable,
+                                    int nScreen,
+                                    long nDrawableDepth,
+                                    long nX,
+                                    long nY,
+                                    long nWidth,
+                                    long nHeight
+                                );
+
+    SAL_DLLPRIVATE XImage*      ImplCreateXImage(
+                                    SalDisplay* pSalDisp,
+                                    int nScreen,
+                                    long nDepth,
+                                    const SalTwoRect& rTwoRect
+                                ) const;
+
+    SAL_DLLPRIVATE ImplSalDDB*  ImplGetDDB(
+                                    Drawable,
+                                    int nScreen,
+                                    long nDrawableDepth,
+                                    const SalTwoRect&
+                                ) const;
+
+    void                        ImplDraw(
+                                    Drawable aDrawable,
+                                    int nScreen,
+                                    long nDrawableDepth,
+                                    const SalTwoRect& rTwoRect,
+                                    const GC& rGC
+                                ) const;
 
 public:
 
-    X11SalBitmap();
-    virtual ~X11SalBitmap();
+                                X11SalBitmap();
+    virtual                     ~X11SalBitmap();
 
     // overload pure virtual methods
-    virtual bool			Create( const Size& rSize,
-                            sal_uInt16 nBitCount,
-                            const BitmapPalette& rPal );
-    virtual bool			Create( const SalBitmap& rSalBmp );
-    virtual bool			Create( const SalBitmap& rSalBmp,
-                                    SalGraphics* pGraphics );
-    virtual bool			Create( const SalBitmap& rSalBmp,
-                                    sal_uInt16 nNewBitCount );
-    virtual bool			Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
+    virtual bool                Create(
+                                    const Size& rSize,
+                                    sal_uInt16 nBitCount,
+                                    const BitmapPalette& rPal
+                                );
+
+    virtual bool                Create( const SalBitmap& rSalBmp );
+    virtual bool                Create(
+                                    const SalBitmap& rSalBmp,
+                                    SalGraphics* pGraphics
+                                );
+
+    virtual bool                Create(
+                                    const SalBitmap& rSalBmp,
+                                    sal_uInt16 nNewBitCount
+                                );
+
+    virtual bool                Create(
+                                    const ::com::sun::star::uno::Reference<
+                                        ::com::sun::star::rendering::XBitmapCanvas
+                                    > xBitmapCanvas,
                                     Size& rSize,
-                                    bool bMask = false );
+                                    bool bMask = false
+                                );
 
-    virtual void			Destroy();
+    virtual void                Destroy();
 
-    virtual Size			GetSize() const;
-    virtual sal_uInt16			GetBitCount() const;
+    virtual Size                GetSize() const;
+    virtual sal_uInt16          GetBitCount() const;
 
-    virtual BitmapBuffer*	AcquireBuffer( bool bReadOnly );
-    virtual void			ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
-    virtual bool            GetSystemData( BitmapSystemData& rData );
+    virtual BitmapBuffer*       AcquireBuffer( bool bReadOnly );
+    virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
+    virtual bool                GetSystemData( BitmapSystemData& rData );
 };
 
 // --------------
@@ -135,44 +173,73 @@ class ImplSalDDB
 {
 private:
 
-    Pixmap			maPixmap;
-    SalTwoRect		maTwoRect;
-    long			mnDepth;
+    Pixmap          maPixmap;
+    SalTwoRect      maTwoRect;
+    long            mnDepth;
     int             mnScreen;
 
                     ImplSalDDB() {}
 
-    static void	ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth,
-                          Drawable aDstDrawable, long nDstDrawableDepth,
-                          long nSrcX, long nSrcY,
-                          long nDestWidth, long nDestHeight,
-                          long nDestX, long nDestY, const GC& rGC );
+    static void     ImplDraw(
+                        Drawable aSrcDrawable,
+                        long nSrcDrawableDepth,
+                        Drawable aDstDrawable,
+                        long nDstDrawableDepth,
+                        long nSrcX,
+                        long nSrcY,
+                        long nDestWidth,
+                        long nDestHeight,
+                        long nDestX,
+                        long nDestY,
+                        const GC& rGC
+                    );
 
 public:
 
-                    ImplSalDDB( XImage* pImage,
-                                Drawable aDrawable, int nScreen,
-                                const SalTwoRect& rTwoRect );
-                    ImplSalDDB( Drawable aDrawable,
-                                int nScreen,
-                                long nDrawableDepth,
-                                long nX, long nY, long nWidth, long nHeight );
-                    ImplSalDDB( Display* pDisplay,
-                                XLIB_Window hWindow,
-                                int nScreen,
-                                XImage* pImage);
+                    ImplSalDDB(
+                        XImage* pImage,
+                        Drawable aDrawable,
+                        int nScreen,
+                        const SalTwoRect& rTwoRect
+                    );
+
+                    ImplSalDDB(
+                        Drawable aDrawable,
+                        int nScreen,
+                        long nDrawableDepth,
+                        long nX,
+                        long nY,
+                        long nWidth,
+                        long nHeight
+                    );
+
+                    ImplSalDDB(
+                        Display* pDisplay,
+                        XLIB_Window hWindow,
+                        int nScreen,
+                        XImage* pImage
+                    );
+
                     ~ImplSalDDB();
 
-    Pixmap			ImplGetPixmap() const { return maPixmap; }
-    long			ImplGetWidth() const { return maTwoRect.mnDestWidth; }
-    long			ImplGetHeight() const { return maTwoRect.mnDestHeight; }
-    long			ImplGetDepth() const { return mnDepth; }
-    sal_uIntPtr			ImplGetMemSize() const { return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); }
+    Pixmap          ImplGetPixmap() const { return maPixmap; }
+    long            ImplGetWidth() const { return maTwoRect.mnDestWidth; }
+    long            ImplGetHeight() const { return maTwoRect.mnDestHeight; }
+    long            ImplGetDepth() const { return mnDepth; }
+    sal_uIntPtr     ImplGetMemSize() const
+                    {
+                        return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 );
+                    }
     int             ImplGetScreen() const { return mnScreen; }
 
-    bool			ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const;
-    void			ImplDraw( Drawable aDrawable, long nDrawableDepth,
-                              const SalTwoRect& rTwoRect, const GC& rGC ) const;
+    bool            ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const;
+
+    void            ImplDraw(
+                        Drawable aDrawable,
+                        long nDrawableDepth,
+                        const SalTwoRect& rTwoRect,
+                        const GC& rGC
+                    ) const;
 };
 
 // ----------------------
@@ -183,62 +250,19 @@ class ImplSalBitmapCache
 {
 private:
 
-    List			maBmpList;
-    sal_uIntPtr			mnTotalSize;
+    List            maBmpList;
+    sal_uIntPtr     mnTotalSize;
 
 public:
 
                     ImplSalBitmapCache();
                     ~ImplSalBitmapCache();
 
-    void			ImplAdd( X11SalBitmap* pBmp, sal_uIntPtr nMemSize = 0UL, sal_uIntPtr nFlags = 0UL );
-    void			ImplRemove( X11SalBitmap* pBmp );
-    void			ImplClear();
+    void            ImplAdd( X11SalBitmap* pBmp, sal_uIntPtr nMemSize = 0UL, sal_uIntPtr nFlags = 0UL );
+    void            ImplRemove( X11SalBitmap* pBmp );
+    void            ImplClear();
 };
 
 #endif // _SV_SALBMP_HXX
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index a788236..0b9e69a 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
+
 #ifdef FREEBSD
 #include <sys/types.h>
 #endif
@@ -68,15 +69,15 @@ SalBitmap* X11SalInstance::CreateSalBitmap()
     return new X11SalBitmap();
 }
 
-ImplSalBitmapCache*	X11SalBitmap::mpCache = NULL;
-sal_uLong				X11SalBitmap::mnCacheInstCount = 0;
+ImplSalBitmapCache* X11SalBitmap::mpCache = NULL;
+sal_uLong           X11SalBitmap::mnCacheInstCount = 0;
 
 // -----------------------------------------------------------------------------
 
-X11SalBitmap::X11SalBitmap() :
-    mpDIB( NULL ),
-    mpDDB( NULL ),
-    mbGrey( false )
+X11SalBitmap::X11SalBitmap()
+    : mpDIB( NULL )
+    , mpDDB( NULL )
+    , mbGrey( false )
 {
 }
 
@@ -115,9 +116,19 @@ void X11SalBitmap::ImplRemovedFromCache()
 
 // -----------------------------------------------------------------------------
 
-BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal )
-{
-    DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" );
+BitmapBuffer* X11SalBitmap::ImplCreateDIB(
+    const Size& rSize,
+    sal_uInt16 nBitCount,
+    const BitmapPalette& rPal
+) {
+    DBG_ASSERT(
+           nBitCount ==  1
+        || nBitCount ==  4
+        || nBitCount ==  8
+        || nBitCount == 16
+        || nBitCount == 24
+        , "Unsupported BitCount!"
+    );
 
     BitmapBuffer* pDIB = NULL;
 
@@ -192,20 +203,23 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCou
 
 // -----------------------------------------------------------------------------
 
-BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
-                                           int nScreen,
-                                           long nDrawableDepth,
-                                           long nX, long nY,
-                                           long nWidth, long nHeight,
-                                           bool bGrey )
-{
+BitmapBuffer* X11SalBitmap::ImplCreateDIB(
+    Drawable aDrawable,
+    int nScreen,
+    long nDrawableDepth,
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight,
+    bool bGrey
+) {
     BitmapBuffer* pDIB = NULL;
 
     if( aDrawable && nWidth && nHeight && nDrawableDepth )
     {
-        SalDisplay*	pSalDisp = GetX11SalData()->GetDisplay();
-        SalXLib*	pXLib = pSalDisp->GetXLib();
-        Display*	pXDisp = pSalDisp->GetDisplay();
+        SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+        SalXLib*    pXLib = pSalDisp->GetXLib();
+        Display*    pXDisp = pSalDisp->GetDisplay();
 
         // do not die on XError here
         // alternatively one could check the coordinates for being offscreen
@@ -213,16 +227,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
         // defaults even if the rectangle is offscreen
         // so better catch the XError
         pXLib->PushXErrorLevel( true );
-        XImage*	pImage = XGetImage( pXDisp, aDrawable, nX, nY, nWidth, nHeight, AllPlanes, ZPixmap );
+        XImage* pImage = XGetImage( pXDisp, aDrawable, nX, nY, nWidth, nHeight, AllPlanes, ZPixmap );
         bool bWasError = pXLib->HasXErrorOccurred() && pXLib->GetLastXErrorRequestCode() == X_GetImage;
         pXLib->PopXErrorLevel();
 
         if( ! bWasError && pImage && pImage->data )
         {
-            const SalTwoRect		aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight };
-            BitmapBuffer			aSrcBuf;
-            sal_uLong					nDstFormat = BMP_FORMAT_BOTTOM_UP;
-            const BitmapPalette*	pDstPal = NULL;
+            const SalTwoRect        aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight };
+            BitmapBuffer            aSrcBuf;
+            sal_uLong               nDstFormat = BMP_FORMAT_BOTTOM_UP;
+            const BitmapPalette*    pDstPal = NULL;
 
             aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN;
             aSrcBuf.mnWidth = nWidth;
@@ -239,14 +253,20 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
             {
                 case( 1 ):
                 {
-                    aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL );
+                    aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order
+                                            ? BMP_FORMAT_1BIT_LSB_PAL
+                                            : BMP_FORMAT_1BIT_MSB_PAL
+                                        );
                     nDstFormat |= BMP_FORMAT_1BIT_MSB_PAL;
                 }
                 break;
 
                 case( 4 ):
                 {
-                    aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL );
+                    aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order
+                                            ? BMP_FORMAT_4BIT_LSN_PAL
+                                            : BMP_FORMAT_4BIT_MSN_PAL
+                                        );
                     nDstFormat |= BMP_FORMAT_4BIT_MSN_PAL;
                 }
                 break;
@@ -270,7 +290,6 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
                     else
                     {
                         aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_MSB_MASK;
-                        // aSrcBuf.maColorMask = ColorMask( pImage->red_mask ), SWAPSHORT( pImage->green_mask ), SWAPSHORT( pImage->blue_mask ) );
                     }
                 }
                 break;
@@ -289,10 +308,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
                 case( 32 ):
                 {
                     if( LSBFirst == pImage->byte_order )
-                        aSrcBuf.mnFormat |= (  pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA );
+                        aSrcBuf.mnFormat |= (  pSalDisp->GetVisual(nScreen).red_mask == 0xFF
+                                                ? BMP_FORMAT_32BIT_TC_RGBA
+                                                : BMP_FORMAT_32BIT_TC_BGRA
+                                            );
                     else
-                        aSrcBuf.mnFormat |= (  pSalDisp->GetVisual(nScreen).red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB );
-
+                        aSrcBuf.mnFormat |= (  pSalDisp->GetVisual(nScreen).red_mask == 0xFF
+                                                ? BMP_FORMAT_32BIT_TC_ABGR
+                                                : BMP_FORMAT_32BIT_TC_ARGB
+                                            );
                     nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
                 }
                 break;
@@ -315,7 +339,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
 
                 for( sal_uInt16 i = 0; i < 256; i++ )
                 {
-                    BitmapColor&	rBmpCol = rPal[ i ];
+                    BitmapColor&    rBmpCol = rPal[ i ];
 
                     rBmpCol.SetRed( i );
                     rBmpCol.SetGreen( i );
@@ -326,15 +350,17 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
             else if( aSrcBuf.mnBitCount <= 8 )
             {
                 const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
-                const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << nDrawableDepth) );
+                const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed()
+                                            , (sal_uLong)(1 << nDrawableDepth)
+                                            );
 
                 rPal.SetEntryCount( nCols );
                 pDstPal = &rPal;
 
                 for( sal_uInt16 i = 0; i < nCols; i++ )
                 {
-                    const SalColor	nColor( rColMap.GetColor( i ) );
-                    BitmapColor&	rBmpCol = rPal[ i ];
+                    const SalColor  nColor( rColMap.GetColor( i ) );
+                    BitmapColor&    rBmpCol = rPal[ i ];
 
                     rBmpCol.SetRed( SALCOLOR_RED( nColor ) );
                     rBmpCol.SetGreen( SALCOLOR_GREEN( nColor ) );
@@ -354,7 +380,12 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
 
 // -----------------------------------------------------------------------------
 
-XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const
+XImage* X11SalBitmap::ImplCreateXImage(
+    SalDisplay *pSalDisp,
+    int nScreen,
+    long nDepth,
+    const SalTwoRect& rTwoRect
+) const
 {
     XImage* pImage = NULL;
 
@@ -372,9 +403,9 @@ XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
 
     if( mpDIB && mpDIB->mnWidth && mpDIB->mnHeight )
     {
-        Display*	pXDisp = pSalDisp->GetDisplay();
-        long		nWidth = rTwoRect.mnDestWidth;
-        long		nHeight = rTwoRect.mnDestHeight;
+        Display*    pXDisp = pSalDisp->GetDisplay();
+        long        nWidth = rTwoRect.mnDestWidth;
+        long        nHeight = rTwoRect.mnDestHeight;
 
         if( 1 == GetBitCount() )
             nDepth = 1;
@@ -385,19 +416,25 @@ XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
 
         if( pImage )
         {
-            BitmapBuffer*	pDstBuf;
-            sal_uLong			nDstFormat = BMP_FORMAT_TOP_DOWN;
-            BitmapPalette*	pPal = NULL;
-            ColorMask*		pMask = NULL;
+            BitmapBuffer*   pDstBuf;
+            sal_uLong           nDstFormat = BMP_FORMAT_TOP_DOWN;
+            BitmapPalette*  pPal = NULL;
+            ColorMask*      pMask = NULL;
 
             switch( pImage->bits_per_pixel )
             {
                 case( 1 ):
-                    nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL );
+                    nDstFormat |=   ( LSBFirst == pImage->bitmap_bit_order
+                                        ? BMP_FORMAT_1BIT_LSB_PAL
+                                        : BMP_FORMAT_1BIT_MSB_PAL
+                                    );
                 break;
 
                 case( 4 ):
-                    nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL );
+                    nDstFormat |=   ( LSBFirst == pImage->bitmap_bit_order
+                                        ? BMP_FORMAT_4BIT_LSN_PAL
+                                        : BMP_FORMAT_4BIT_MSN_PAL
+                                    );
                 break;
 
                 case( 8 ):
@@ -437,9 +474,15 @@ XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
                 case( 32 ):
                 {
                     if( LSBFirst == pImage->byte_order )
-                        nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA );
+                        nDstFormat |=   ( pImage->red_mask == 0xFF
+                                            ? BMP_FORMAT_32BIT_TC_RGBA
+                                            : BMP_FORMAT_32BIT_TC_BGRA
+                                        );
                     else
-                        nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB );
+                        nDstFormat |=   ( pImage->red_mask == 0xFF
+                                            ? BMP_FORMAT_32BIT_TC_ABGR
+                                            : BMP_FORMAT_32BIT_TC_ARGB
+                                        );
                 }
                 break;
             }
@@ -456,7 +499,7 @@ XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
 
                 for( sal_uInt16 i = 0; i < 256; i++ )
                 {
-                    BitmapColor&	rBmpCol = (*pPal)[ i ];
+                    BitmapColor&    rBmpCol = (*pPal)[ i ];
 
                     rBmpCol.SetRed( i );
                     rBmpCol.SetGreen( i );
@@ -467,14 +510,16 @@ XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
             else if( pImage->depth <= 8 )
             {
                 const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
-                const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << pImage->depth) );
+                const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed()
+                                            , (sal_uLong)(1 << pImage->depth)
+                                            );
 
                 pPal = new BitmapPalette( nCols );
 
                 for( sal_uInt16 i = 0; i < nCols; i++ )
                 {
-                    const SalColor	nColor( rColMap.GetColor( i ) );
-                    BitmapColor&	rBmpCol = (*pPal)[ i ];
+                    const SalColor  nColor( rColMap.GetColor( i ) );
+                    BitmapColor&    rBmpCol = (*pPal)[ i ];
 
                     rBmpCol.SetRed( SALCOLOR_RED( nColor ) );
                     rBmpCol.SetGreen( SALCOLOR_GREEN( nColor ) );
@@ -506,10 +551,15 @@ XImage*	X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
 }
 
 // -----------------------------------------------------------------------------
-bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable,
-                                           int nScreen, long nDrawableDepth,
-                                           long nX, long nY, long nWidth, long nHeight )
-{
+bool X11SalBitmap::ImplCreateFromDrawable(
+    Drawable aDrawable,
+    int nScreen,
+    long nDrawableDepth,
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight
+) {
     Destroy();
 
     if( aDrawable && nWidth && nHeight && nDrawableDepth )
@@ -519,8 +569,7 @@ bool X11SalBitmap::ImplCreateFromDrawable( Drawable aDrawable,
 }
 // -----------------------------------------------------------------------------
 
-bool
-X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
+bool X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
 {
     if (hWindow != None)
     {
@@ -598,9 +647,12 @@ X11SalBitmap::SnapShot (Display* pDisplay, XLIB_Window hWindow)
     return False;
 }
 
-bool
-X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage)
-{
+bool X11SalBitmap::ImplCreateFromXImage (
+    Display* pDisplay,
+    XLIB_Window hWindow,
+    int nScreen,
+    XImage* pImage
+) {
     Destroy();
 
     if (pImage != NULL && pImage->width != 0 && pImage->height != 0 && pImage->depth != 0)
@@ -611,10 +663,12 @@ X11SalBitmap::ImplCreateFromXImage (Display* pDisplay, XLIB_Window hWindow, int
     return False;
 }
 
-ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable          aDrawable,
-                                      int               nScreen,
-                                      long              nDrawableDepth,
-                                      const SalTwoRect& rTwoRect ) const
+ImplSalDDB* X11SalBitmap::ImplGetDDB(
+    Drawable          aDrawable,
+    int               nScreen,
+    long              nDrawableDepth,
+    const SalTwoRect& rTwoRect
+) const
 {
     if( !mpDDB || !mpDDB->ImplMatches( nScreen, nDrawableDepth, rTwoRect ) )
     {
@@ -689,7 +743,7 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable          aDrawable,
             }
         }
 
-        XImage*	pImage = ImplCreateXImage( GetX11SalData()->GetDisplay(), nScreen,
+        XImage* pImage = ImplCreateXImage( GetX11SalData()->GetDisplay(), nScreen,
                                            nDrawableDepth, aTwoRect );
 
         if( pImage )
@@ -708,11 +762,13 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable          aDrawable,
 
 // -----------------------------------------------------------------------------
 
-void X11SalBitmap::ImplDraw( Drawable           aDrawable,
-                             int                nScreen,
-                             long               nDrawableDepth,
-                             const SalTwoRect&  rTwoRect,
-                             const GC&          rGC ) const
+void X11SalBitmap::ImplDraw(
+    Drawable           aDrawable,
+    int                nScreen,
+    long               nDrawableDepth,
+    const SalTwoRect&  rTwoRect,
+    const GC&          rGC
+) const
 {
     ImplGetDDB( aDrawable, nScreen, nDrawableDepth, rTwoRect );
     if( mpDDB )
@@ -782,9 +838,14 @@ bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 )
 
 // -----------------------------------------------------------------------------
 
-bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask )
-{
-    ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY );
+bool X11SalBitmap::Create(
+    const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
+    Size& rSize,
+    bool bMask
+) {
+    ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet >
+        xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY );
+
     if( xFastPropertySet.get() ) {
         sal_Int32 depth;
         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args;
@@ -794,7 +855,15 @@ bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::s
             if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
 
                 mbGrey = bMask;
-                bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() );
+                bool bSuccess = ImplCreateFromDrawable(
+                                    pixmapHandle,
+                                    0,
+                                    depth,
+                                    0,
+                                    0,
+                                    (long) rSize.Width(),
+                                    (long) rSize.Height()
+                                );
                 bool bFreePixmap = false;
                 if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap )
                     XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle );
@@ -860,10 +929,15 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool )
 {
     if( !mpDIB && mpDDB )
     {
-        mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(),
-                               mpDDB->ImplGetScreen(),
-                               mpDDB->ImplGetDepth(),
-                               0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey );
+        mpDIB = ImplCreateDIB(
+                    mpDDB->ImplGetPixmap(),
+                    mpDDB->ImplGetScreen(),
+                    mpDDB->ImplGetDepth(),
+                    0, 0,
+                    mpDDB->ImplGetWidth(),
+                    mpDDB->ImplGetHeight(),
+                    mbGrey
+                );
     }
 
     return mpDIB;
@@ -905,20 +979,20 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
 // - ImplSalDDB -
 // --------------
 
-ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect ) :
-    maPixmap	( 0 ),
-    maTwoRect	( rTwoRect ),
-    mnDepth		( pImage->depth ),
-    mnScreen    ( nScreen )
+ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const SalTwoRect& rTwoRect )
+    : maPixmap    ( 0 )
+    , maTwoRect   ( rTwoRect )
+    , mnDepth     ( pImage->depth )
+    , mnScreen    ( nScreen )
 {
-    SalDisplay*	pSalDisp = GetX11SalData()->GetDisplay();
-    Display*	pXDisp = pSalDisp->GetDisplay();
+    SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+    Display*    pXDisp = pSalDisp->GetDisplay();
 
     if( (maPixmap = XCreatePixmap( pXDisp, aDrawable, ImplGetWidth(), ImplGetHeight(), ImplGetDepth() )) )
     {
-        XGCValues	aValues;
-        GC			aGC;
-        int			nValues = GCFunction;
+        XGCValues   aValues;
+        GC          aGC;
+        int         nValues = GCFunction;
 
         aValues.function = GXcopy;
 
@@ -937,15 +1011,15 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, int nScreen, const S
 // -----------------------------------------------------------------------------------------
 // create from XImage
 
-ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage) :
-    mnScreen( nScreen )
+ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XImage* pImage)
+    : mnScreen( nScreen )
 {
     maPixmap = XCreatePixmap (pDisplay, hWindow, pImage->width, pImage->height, pImage->depth);
     if (maPixmap != 0)
     {
-        XGCValues	aValues;
-        GC			aGC;
-        int			nValues = GCFunction;
+        XGCValues   aValues;
+        GC          aGC;
+        int         nValues = GCFunction;
 
         aValues.function = GXcopy;
 
@@ -975,18 +1049,25 @@ ImplSalDDB::ImplSalDDB (Display* pDisplay, XLIB_Window hWindow, int nScreen, XIm
 
 // -----------------------------------------------------------------------------
 
-ImplSalDDB::ImplSalDDB( Drawable aDrawable, int nScreen, long nDrawableDepth, long nX, long nY, long nWidth, long nHeight ) :
-    mnDepth( nDrawableDepth ),
-    mnScreen( nScreen )
+ImplSalDDB::ImplSalDDB(
+    Drawable aDrawable,
+    int nScreen,
+    long nDrawableDepth,
+    long nX,
+    long nY,
+    long nWidth,
+    long nHeight
+)   : mnDepth( nDrawableDepth )
+    , mnScreen( nScreen )
 {
-    SalDisplay*	pSalDisp = GetX11SalData()->GetDisplay();
-    Display*	pXDisp = pSalDisp->GetDisplay();
+    SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+    Display*    pXDisp = pSalDisp->GetDisplay();
 
     if( (maPixmap = XCreatePixmap( pXDisp, aDrawable, nWidth, nHeight, nDrawableDepth )) )
     {
-        XGCValues	aValues;
-        GC			aGC;
-        int			nValues = GCFunction;
+        XGCValues   aValues;
+        GC          aGC;
+        int         nValues = GCFunction;
 
         aValues.function = GXcopy;
 
@@ -1023,18 +1104,26 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe
 
     if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen)
     {
-        if( rTwoRect.mnSrcX == maTwoRect.mnSrcX && rTwoRect.mnSrcY == maTwoRect.mnSrcY &&
-            rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight &&
-            rTwoRect.mnDestWidth == maTwoRect.mnDestWidth && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight )
+        if (  rTwoRect.mnSrcX       == maTwoRect.mnSrcX
+           && rTwoRect.mnSrcY       == maTwoRect.mnSrcY
+           && rTwoRect.mnSrcWidth   == maTwoRect.mnSrcWidth
+           && rTwoRect.mnSrcHeight  == maTwoRect.mnSrcHeight
+           && rTwoRect.mnDestWidth  == maTwoRect.mnDestWidth
+           && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight
+           )
         {
             // absolutely indentically
             bRet = sal_True;
         }
-        else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight &&
-                 maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight &&
-                 rTwoRect.mnSrcX >= maTwoRect.mnSrcX && rTwoRect.mnSrcY >= maTwoRect.mnSrcY &&
-                 ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) &&
-                 ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) )
+        else if(  rTwoRect.mnSrcWidth   == rTwoRect.mnDestWidth
+               && rTwoRect.mnSrcHeight  == rTwoRect.mnDestHeight
+               && maTwoRect.mnSrcWidth  == maTwoRect.mnDestWidth
+               && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight
+               && rTwoRect.mnSrcX       >= maTwoRect.mnSrcX
+               && rTwoRect.mnSrcY       >= maTwoRect.mnSrcY
+               && ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth  ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth  )
+               && ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight )
+               )
         {
             bRet = sal_True;
         }
@@ -1045,7 +1134,12 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe
 
 // -----------------------------------------------------------------------------
 
-void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwoRect& rTwoRect, const GC& rGC ) const
+void ImplSalDDB::ImplDraw(
+    Drawable aDrawable,
+    long nDrawableDepth,
+    const SalTwoRect& rTwoRect,
+    const GC& rGC
+) const
 {
     ImplDraw( maPixmap, mnDepth, aDrawable, nDrawableDepth,
               rTwoRect.mnSrcX - maTwoRect.mnSrcX, rTwoRect.mnSrcY - maTwoRect.mnSrcY,
@@ -1055,14 +1149,21 @@ void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwo
 
 // -----------------------------------------------------------------------------
 
-void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth,
-                           Drawable aDstDrawable, long,
-                           long nSrcX, long nSrcY,
-                           long nDestWidth, long nDestHeight,
-                           long nDestX, long nDestY, const GC& rGC )
-{
-    SalDisplay*	pSalDisp = GetX11SalData()->GetDisplay();
-    Display*	pXDisp = pSalDisp->GetDisplay();
+void ImplSalDDB::ImplDraw(
+    Drawable aSrcDrawable,
+    long nSrcDrawableDepth,
+    Drawable aDstDrawable,
+    long,
+    long nSrcX,
+    long nSrcY,
+    long nDestWidth,
+    long nDestHeight,
+    long nDestX,
+    long nDestY,
+    const GC& rGC
+) {
+    SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
+    Display*    pXDisp = pSalDisp->GetDisplay();
 
     if( 1 == nSrcDrawableDepth )
     {
@@ -1082,9 +1183,9 @@ void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth,
 
 struct ImplBmpObj
 {
-    X11SalBitmap*	mpBmp;
-    sal_uLong		mnMemSize;
-    sal_uLong		mnFlags;
+    X11SalBitmap*   mpBmp;
+    sal_uLong       mnMemSize;
+    sal_uLong       mnFlags;
 
                 ImplBmpObj( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags ) :
                     mpBmp( pBmp ), mnMemSize( nMemSize ), mnFlags( nFlags ) {}
@@ -1109,7 +1210,7 @@ ImplSalBitmapCache::~ImplSalBitmapCache()
 void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags )
 {
     ImplBmpObj* pObj;
-    bool		bFound = sal_False;
+    bool        bFound = sal_False;
 
     for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() )
         if( pObj->mpBmp == pBmp )


More information about the Libreoffice-commits mailing list