[Libreoffice-commits] .: 3 commits - hwpfilter/source sot/source vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Mar 5 01:37:26 PST 2012


 hwpfilter/source/hbox.cxx    |   30 +++++++++++++++++++----
 sot/source/sdstor/stgdir.hxx |    1 
 vcl/source/gdi/outdev2.cxx   |   54 +++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 76 insertions(+), 9 deletions(-)

New commits:
commit 78157d7634c0a75ceac4b614d3ca5b1763c6604a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 5 09:36:40 2012 +0000

    WaE: calling delete on the wrong thing

diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index 3f9ea3d..df334ac 100644
--- a/hwpfilter/source/hbox.cxx
+++ b/hwpfilter/source/hbox.cxx
@@ -338,12 +338,18 @@ TxtBox::~TxtBox(void)
     {
         std::list < HWPPara* >::iterator it = plists[ii].begin();
         for (; it != plists[ii].end(); ++it)
-            delete &it;
+        {
+            HWPPara* pPara = *it;
+            delete pPara;
+        }
     }
 
     std::list < HWPPara* >::iterator it = caption.begin();
     for (; it != caption.end(); ++it)
-        delete &it;
+    {
+        HWPPara* pPara = *it;
+        delete pPara;
+    }
 
     delete[]plists;
 }
@@ -372,7 +378,10 @@ Picture::~Picture(void)
 
     std::list < HWPPara* >::iterator it = caption.begin();
     for (; it != caption.end(); ++it)
-        delete &it;
+    {
+        HWPPara* pPara = *it;
+        delete pPara;
+    }
 }
 
 
@@ -394,7 +403,10 @@ Hidden::~Hidden(void)
 {
     std::list < HWPPara* >::iterator it = plist.begin();
     for (; it != plist.end(); ++it)
-        delete &it;
+    {
+        HWPPara* pPara = *it;
+        delete pPara;
+    }
 }
 
 
@@ -403,7 +415,10 @@ HeaderFooter::~HeaderFooter(void)
 {
     std::list < HWPPara* >::iterator it = plist.begin();
     for (; it != plist.end(); ++it)
-        delete &it;
+    {
+        HWPPara* pPara = *it;
+        delete pPara;
+    }
 }
 
 
@@ -412,7 +427,10 @@ Footnote::~Footnote(void)
 {
     std::list < HWPPara* >::iterator it = plist.begin();
     for (; it != plist.end(); ++it)
-        delete &it;
+    {
+        HWPPara* pPara = *it;
+        delete pPara;
+    }
 }
 
 
commit 96cf4e158fcc89adab81232ba63f11f97276853d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 5 09:29:23 2012 +0000

    unused inline

diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
index f260d42..8aaa359 100644
--- a/sot/source/sdstor/stgdir.hxx
+++ b/sot/source/sdstor/stgdir.hxx
@@ -125,7 +125,6 @@ public:
     StgIterator( StgDirEntry& rStg ) : StgAvlIterator( rStg.pDown ) {}
     StgDirEntry* First() { return (StgDirEntry*) StgAvlIterator::First(); }
     StgDirEntry* Next()  { return (StgDirEntry*) StgAvlIterator::Next();  }
-    StgDirEntry* Last()  { return (StgDirEntry*) StgAvlIterator::Last();  }
     StgDirEntry* Prev()  { return (StgDirEntry*) StgAvlIterator::Prev();  }
 };
 
commit 159b5088ee303f7adf6a4c0e5e72b32c37f9f910
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 5 09:13:55 2012 +0000

    Resolves: fdo#31306 some icons don't get grayed when disabled
    
    some of our menu icons are not RGBA, but our fade-out code only
    handled images with an alpha channel, so we need to extend it
    for bitmaps with alpha channel icons

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 6d8987e..d6553ab 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1162,6 +1162,44 @@ void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize,
     }
 }
 
+namespace
+{
+    BitmapEx makeDisabledBitmap(const Bitmap &rBitmap)
+    {
+        const Size aTotalSize( rBitmap.GetSizePixel() );
+        Bitmap aGrey( aTotalSize, 8, &Bitmap::GetGreyPalette( 256 ) );
+        AlphaMask aGreyAlphaMask( aTotalSize );
+        BitmapReadAccess*  pBmp = const_cast<Bitmap&>(rBitmap).AcquireReadAccess();
+        BitmapWriteAccess* pGrey = aGrey.AcquireWriteAccess();
+        BitmapWriteAccess* pGreyAlphaMask = aGreyAlphaMask.AcquireWriteAccess();
+
+        if( pBmp && pGrey && pGreyAlphaMask )
+        {
+            BitmapColor aGreyVal( 0 );
+            BitmapColor aGreyAlphaMaskVal( 0 );
+            const int nLeft = 0, nRight = aTotalSize.Width();
+            const int nTop = 0, nBottom = nTop + aTotalSize.Height();
+
+            for( int nY = nTop; nY < nBottom; ++nY )
+            {
+                for( int nX = nLeft; nX < nRight; ++nX )
+                {
+                    aGreyVal.SetIndex( pBmp->GetLuminance( nY, nX ) );
+                    pGrey->SetPixel( nY, nX, aGreyVal );
+
+                    aGreyAlphaMaskVal.SetIndex( static_cast< sal_uInt8 >( 128ul ) );
+                    pGreyAlphaMask->SetPixel( nY, nX, aGreyAlphaMaskVal );
+                }
+            }
+        }
+
+        const_cast<Bitmap&>(rBitmap).ReleaseAccess( pBmp );
+        aGrey.ReleaseAccess( pGrey );
+        aGreyAlphaMask.ReleaseAccess( pGreyAlphaMask );
+        return BitmapEx( aGrey, aGreyAlphaMask );
+    }
+}
+
 // ------------------------------------------------------------------
 
 void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, sal_uInt16 nStyle )
@@ -1174,7 +1212,13 @@ void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, sal_uInt16
     switch( rImage.mpImplData->meType )
     {
         case IMAGETYPE_BITMAP:
-            DrawBitmap( rPos, *static_cast< Bitmap* >( rImage.mpImplData->mpData ) );
+        {
+            const Bitmap &rBitmap = *static_cast< Bitmap* >( rImage.mpImplData->mpData );
+            if( nStyle & IMAGE_DRAW_DISABLE )
+                DrawBitmapEx( rPos, makeDisabledBitmap(rBitmap) );
+            else
+                DrawBitmap( rPos, rBitmap );
+        }
         break;
 
         case IMAGETYPE_IMAGE:
@@ -1210,7 +1254,13 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
         switch( rImage.mpImplData->meType )
         {
             case IMAGETYPE_BITMAP:
-                DrawBitmap( rPos, rSize, *static_cast< Bitmap* >( rImage.mpImplData->mpData ) );
+            {
+                const Bitmap &rBitmap = *static_cast< Bitmap* >( rImage.mpImplData->mpData );
+                if( nStyle & IMAGE_DRAW_DISABLE )
+                    DrawBitmapEx( rPos, rSize, makeDisabledBitmap(rBitmap) );
+                else
+                    DrawBitmap( rPos, rSize, rBitmap );
+            }
             break;
 
             case IMAGETYPE_IMAGE:


More information about the Libreoffice-commits mailing list