You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/05/28 12:00:27 UTC

svn commit: r1486842 - in /openoffice/trunk/main/vcl: inc/win/salbmp.h win/source/gdi/salbmp.cxx

Author: alg
Date: Tue May 28 10:00:27 2013
New Revision: 1486842

URL: http://svn.apache.org/r1486842
Log:
i122350 Corrected buffering when alpha changed

Modified:
    openoffice/trunk/main/vcl/inc/win/salbmp.h
    openoffice/trunk/main/vcl/win/source/gdi/salbmp.cxx

Modified: openoffice/trunk/main/vcl/inc/win/salbmp.h
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/inc/win/salbmp.h?rev=1486842&r1=1486841&r2=1486842&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/inc/win/salbmp.h (original)
+++ openoffice/trunk/main/vcl/inc/win/salbmp.h Tue May 28 10:00:27 2013
@@ -43,7 +43,7 @@ typedef boost::shared_ptr< Gdiplus::Bitm
 class WinSalBitmap : public SalBitmap
 {
 private:
-    friend class GdiPlusBuffer; // allow buffer to remove maGdiPlusBitmap eventually
+    friend class GdiPlusBuffer; // allow buffer to remove maGdiPlusBitmap and mpAssociatedAlpha eventually
 
 	Size				maSize;
 	HGLOBAL 			mhDIB;
@@ -51,8 +51,14 @@ private:
 
     // the buffered evtl. used Gdiplus::Bitmap instance. It is managed by
     // GdiPlusBuffer. To make this safe, it is only handed out as shared
-    // pointer; the GdiPlusBuffer may delete the local instance
+    // pointer; the GdiPlusBuffer may delete the local instance.
+    //
+    // mpAssociatedAlpha holds the last WinSalBitmap used to construct an
+    // evtl. buffered GdiPlusBmp. This is needed since the GdiPlusBmp is a single
+    // instance and remembered only on the content-WinSalBitmap, not on the
+    // alpha-WinSalBitmap.
     GdiPlusBmpPtr       maGdiPlusBitmap;
+    const WinSalBitmap* mpAssociatedAlpha;
 
     sal_uInt16			mnBitCount;
 

Modified: openoffice/trunk/main/vcl/win/source/gdi/salbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/win/source/gdi/salbmp.cxx?rev=1486842&r1=1486841&r2=1486842&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/win/source/gdi/salbmp.cxx (original)
+++ openoffice/trunk/main/vcl/win/source/gdi/salbmp.cxx Tue May 28 10:00:27 2013
@@ -161,6 +161,7 @@ public:
                 if(pSource->maGdiPlusBitmap.get())
                 {
                     pSource->maGdiPlusBitmap.reset();
+                    pSource->mpAssociatedAlpha = 0;
                 }
             }
         }
@@ -186,6 +187,7 @@ WinSalBitmap::WinSalBitmap() 
     mhDIB(0),
     mhDDB(0),
     maGdiPlusBitmap(),
+    mpAssociatedAlpha(0),
     mnBitCount(0)
 {
 }
@@ -219,6 +221,16 @@ void WinSalBitmap::Destroy()
 
 GdiPlusBmpPtr WinSalBitmap::ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource) const 
 { 
+    WinSalBitmap* pThat = const_cast< WinSalBitmap* >(this);
+
+    if(maGdiPlusBitmap.get() && pAlphaSource != mpAssociatedAlpha)
+    {
+        // #122350# if associated alpha with which the GDIPlus was constructed has changed
+        // it is necessary to remove it from buffer, reset reference to it and reconstruct
+        pThat->maGdiPlusBitmap.reset();
+        aGdiPlusBuffer.remEntry(const_cast< WinSalBitmap& >(*this));
+    }
+
     if(maGdiPlusBitmap.get())
     {
         aGdiPlusBuffer.touchEntry(const_cast< WinSalBitmap& >(*this));
@@ -227,15 +239,15 @@ GdiPlusBmpPtr WinSalBitmap::ImplGetGdiPl
     {
         if(maSize.Width() > 0 && maSize.Height() > 0)
         {
-            WinSalBitmap* pThat = const_cast< WinSalBitmap* >(this);
-
             if(pAlphaSource)
             {
                 pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap(*pAlphaSource));
+                pThat->mpAssociatedAlpha = pAlphaSource;
             }
             else
             {
                 pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap());
+                pThat->mpAssociatedAlpha = 0;
             }
 
             if(maGdiPlusBitmap.get())