Kaydet (Commit) 600f22fa authored tarafından Caolán McNamara's avatar Caolán McNamara

use same logic in both Creates

Change-Id: I49dab360c5f93e40f5a6e91fbe721935d795472c
üst 2574757c
......@@ -121,7 +121,7 @@ BitmapBuffer* ImplCreateDIB(
pDIB->maPalette.SetEntryCount( nColors );
}
size_t size = pDIB->mnScanlineSize * pDIB->mnHeight;
const size_t size = pDIB->mnScanlineSize * pDIB->mnHeight;
if (size > SAL_MAX_INT32)
{
delete pDIB;
......@@ -176,10 +176,18 @@ bool SvpSalBitmap::Create(const SalBitmap& rBmp)
{
// TODO: reference counting...
mpDIB = new BitmapBuffer( *rSalBmp.mpDIB );
const size_t size = mpDIB->mnScanlineSize * mpDIB->mnHeight;
if (size > SAL_MAX_INT32)
{
delete mpDIB;
mpDIB = nullptr;
return false;
}
// TODO: get rid of this when BitmapBuffer gets copy constructor
try
{
size_t size = mpDIB->mnScanlineSize * mpDIB->mnHeight;
mpDIB->mpBits = new sal_uInt8[size];
std::memcpy(mpDIB->mpBits, rSalBmp.mpDIB->mpBits, size);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment