summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-05-28 10:00:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-15 16:35:13 +0100
commit8aa86a712e8d6a97d32b70b5c1f88d2d484cafb2 (patch)
tree388b57cb91d29c33a7ea10b23d17ff747b5ec9db /vcl
parentdba2d0e1e674ddb29c0d0552723c87fd676e041f (diff)
Related: #i122350# Corrected buffering when alpha changed
(cherry picked from commit 66710ce4a2fd0c4e0f1b376d7c5da35d0ab2056f) Change-Id: I8c39cb0610210f55218fc0bd9e40e8e2a595cc06
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/win/salbmp.h10
-rw-r--r--vcl/win/source/gdi/salbmp.cxx16
2 files changed, 22 insertions, 4 deletions
diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index 4a9d721aa8fc..bedfbaed0948 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 15b4698ab67c..ac7162d00e88 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())