[Libreoffice-commits] core.git: vcl/inc vcl/win
Armin Le Grand
alg at apache.org
Sat Jun 15 08:36:08 PDT 2013
vcl/inc/win/salbmp.h | 10 ++++++++--
vcl/win/source/gdi/salbmp.cxx | 16 ++++++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
New commits:
commit 8aa86a712e8d6a97d32b70b5c1f88d2d484cafb2
Author: Armin Le Grand <alg at apache.org>
Date: Tue May 28 10:00:27 2013 +0000
Related: #i122350# Corrected buffering when alpha changed
(cherry picked from commit 66710ce4a2fd0c4e0f1b376d7c5da35d0ab2056f)
Change-Id: I8c39cb0610210f55218fc0bd9e40e8e2a595cc06
diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index 4a9d721..bedfbae 100644
--- a/vcl/inc/win/salbmp.h
+++ b/vcl/inc/win/salbmp.h
@@ -39,7 +39,7 @@ typedef boost::shared_ptr< Gdiplus::Bitmap > GdiPlusBmpPtr;
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;
@@ -47,8 +47,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;
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx
index 15b4698..ac7162d 100644
--- a/vcl/win/source/gdi/salbmp.cxx
+++ b/vcl/win/source/gdi/salbmp.cxx
@@ -182,6 +182,7 @@ public:
if(pSource->maGdiPlusBitmap.get())
{
pSource->maGdiPlusBitmap.reset();
+ pSource->mpAssociatedAlpha = 0;
}
}
}
@@ -207,6 +208,7 @@ WinSalBitmap::WinSalBitmap()
mhDIB(0),
mhDDB(0),
maGdiPlusBitmap(),
+ mpAssociatedAlpha(0),
mnBitCount(0)
{
}
@@ -240,6 +242,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));
@@ -248,15 +260,15 @@ GdiPlusBmpPtr WinSalBitmap::ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSourc
{
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())
More information about the Libreoffice-commits
mailing list