summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-06-19 16:49:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-07-15 16:15:17 +0100
commit0ca0202a0994c0b7c99c366fd5cafd8a655df203 (patch)
tree216ae67a2efefa657415446e7f7852a51bc18f88 /vcl
parentcrashrep: loplugin:unreffun (diff)
downloadcore-0ca0202a0994c0b7c99c366fd5cafd8a655df203.tar.gz
core-0ca0202a0994c0b7c99c366fd5cafd8a655df203.zip
Resolves: #i125111# limit mem footprint for GraphicObjects...
in 32Bit environments Conflicts: svtools/inc/svtools/grfmgr.hxx svtools/source/graphic/grfmgr.cxx svtools/source/graphic/grfmgr2.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/graphic/ndgrf.cxx "commit 62b0eaf37c08dd27244e77b8bc90c691b000ebd6 Related: fdo#50697 reset the cache timeout on GetGraphic so the graphic gets swapped out Xms after the last use and not Xms after initial creation regardless of if it got used a moment earlier." corrected place for stl sort function for linux (cherry picked from commit a48414a396f7de4e00510e82e3744c097ce3d5d6) Conflicts: svtools/source/graphic/grfmgr2.cxx Change-Id: I79158b7d42629f8dec2bc5565540701bcd3ef6f4 6f21c7fd4d2681446fc1a6d9607366a1e69165a1
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/source/gdi/salbmp.cxx54
1 files changed, 31 insertions, 23 deletions
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx
index 445839e5b2b9..2bccbd797560 100644
--- a/vcl/win/source/gdi/salbmp.cxx
+++ b/vcl/win/source/gdi/salbmp.cxx
@@ -453,35 +453,43 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
if(pRetval)
{
- sal_uInt8* pSrcRGB(pRGB->mpBits);
- sal_uInt8* pSrcA(pA->mpBits);
- const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
- const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
- const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
- const Gdiplus::Rect aAllRect(0, 0, nW, nH);
- Gdiplus::BitmapData aGdiPlusBitmapData;
- pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData);
-
- // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and
- // A from alpha, so inner loop is needed (who invented BitmapEx..?)
- for(sal_uInt32 y(0); y < nH; y++)
+ if ( pRetval->GetLastStatus() == Gdiplus::Ok ) // 2nd place to secure with new Gdiplus::Bitmap
{
- const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
- sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
+ sal_uInt8* pSrcRGB(pRGB->mpBits);
+ sal_uInt8* pSrcA(pA->mpBits);
+ const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
+ const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
+ const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+ const Gdiplus::Rect aAllRect(0, 0, nW, nH);
+ Gdiplus::BitmapData aGdiPlusBitmapData;
+ pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData);
- for(sal_uInt32 x(0); x < nW; x++)
+ // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and
+ // A from alpha, so inner loop is needed (who invented BitmapEx..?)
+ for(sal_uInt32 y(0); y < nH; y++)
{
- *targetPixels++ = *pSrcRGB++;
- *targetPixels++ = *pSrcRGB++;
- *targetPixels++ = *pSrcRGB++;
- *targetPixels++ = 0xff - *pSrcA++;
+ const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+ sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
+
+ for(sal_uInt32 x(0); x < nW; x++)
+ {
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = 0xff - *pSrcA++;
+ }
+
+ pSrcRGB += nExtraRGB;
+ pSrcA += nExtraA;
}
- pSrcRGB += nExtraRGB;
- pSrcA += nExtraA;
+ pRetval->UnlockBits(&aGdiPlusBitmapData);
+ }
+ else
+ {
+ delete pRetval;
+ pRetval = NULL;
}
-
- pRetval->UnlockBits(&aGdiPlusBitmapData);
}
}