зеркало из https://github.com/mozilla/gecko-dev.git
Bug 949360 - Check for Image AllocateBuffer() failures. r=nical
This commit is contained in:
Родитель
ef518dc511
Коммит
8b72ea8324
|
@ -490,14 +490,17 @@ PlanarYCbCrImage::CopyData(const Data& aData)
|
|||
mData = aData;
|
||||
|
||||
// update buffer size
|
||||
mBufferSize = mData.mCbCrStride * mData.mCbCrSize.height * 2 +
|
||||
size_t size = mData.mCbCrStride * mData.mCbCrSize.height * 2 +
|
||||
mData.mYStride * mData.mYSize.height;
|
||||
|
||||
// get new buffer
|
||||
mBuffer = AllocateBuffer(mBufferSize);
|
||||
mBuffer = AllocateBuffer(size);
|
||||
if (!mBuffer)
|
||||
return;
|
||||
|
||||
// update buffer size
|
||||
mBufferSize = size;
|
||||
|
||||
mData.mYChannel = mBuffer;
|
||||
mData.mCbChannel = mData.mYChannel + mData.mYStride * mData.mYSize.height;
|
||||
mData.mCrChannel = mData.mCbChannel + mData.mCbCrStride * mData.mCbCrSize.height;
|
||||
|
@ -536,11 +539,12 @@ PlanarYCbCrImage::SetDataNoCopy(const Data &aData)
|
|||
uint8_t*
|
||||
PlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize)
|
||||
{
|
||||
// update buffer size
|
||||
mBufferSize = aSize;
|
||||
|
||||
// get new buffer
|
||||
mBuffer = AllocateBuffer(mBufferSize);
|
||||
mBuffer = AllocateBuffer(aSize);
|
||||
if (mBuffer) {
|
||||
// update buffer size
|
||||
mBufferSize = aSize;
|
||||
}
|
||||
return mBuffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,14 +126,16 @@ SharedPlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize)
|
|||
{
|
||||
NS_ABORT_IF_FALSE(!mTextureClient->IsAllocated(), "This image already has allocated data");
|
||||
size_t size = YCbCrImageDataSerializer::ComputeMinBufferSize(aSize);
|
||||
|
||||
// get new buffer _without_ setting mBuffer.
|
||||
if (!mTextureClient->Allocate(size)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// update buffer size
|
||||
mBufferSize = size;
|
||||
|
||||
// get new buffer _without_ setting mBuffer.
|
||||
bool status = mTextureClient->Allocate(mBufferSize);
|
||||
MOZ_ASSERT(status);
|
||||
YCbCrImageDataSerializer serializer(mTextureClient->GetBuffer());
|
||||
|
||||
return serializer.GetData();
|
||||
}
|
||||
|
||||
|
@ -248,17 +250,19 @@ DeprecatedSharedPlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize)
|
|||
{
|
||||
NS_ABORT_IF_FALSE(!mAllocated, "This image already has allocated data");
|
||||
size_t size = YCbCrImageDataSerializer::ComputeMinBufferSize(aSize);
|
||||
|
||||
// get new buffer _without_ setting mBuffer.
|
||||
if (!AllocateBuffer(size)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// update buffer size
|
||||
mBufferSize = size;
|
||||
|
||||
// get new buffer _without_ setting mBuffer.
|
||||
AllocateBuffer(mBufferSize);
|
||||
YCbCrImageDataSerializer serializer(mShmem.get<uint8_t>());
|
||||
|
||||
return serializer.GetData();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DeprecatedSharedPlanarYCbCrImage::SetDataNoCopy(const Data &aData)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче