Bug 1989127. r=ahale a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D265372
This commit is contained in:
committed by
dmeehan@mozilla.com
parent
ac301ae584
commit
bfac3b3d31
@@ -404,7 +404,7 @@ bool TexUnpackBlob::ConvertIfNeeded(
|
||||
|
||||
const auto& unpacking = mDesc.unpacking;
|
||||
|
||||
if (!rowLength || !rowCount) return true;
|
||||
if (!rowLength || !rowCount || srcStride <= 0 || dstStride <= 0) return true;
|
||||
|
||||
const auto srcIsPremult = (mDesc.srcAlphaType == gfxAlphaType::Premult);
|
||||
auto dstIsPremult = unpacking.premultiplyAlpha;
|
||||
@@ -997,9 +997,20 @@ bool TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec,
|
||||
const auto& data = sdb.data();
|
||||
MOZ_ASSERT(data.type() == layers::MemoryOrShmem::TShmem);
|
||||
const auto& shmem = data.get_Shmem();
|
||||
surf = gfx::Factory::CreateWrappingDataSourceSurface(
|
||||
shmem.get<uint8_t>(), layers::ImageDataSerializer::GetRGBStride(rgb),
|
||||
size_t shmemSize = shmem.Size<uint8_t>();
|
||||
int32_t stride = layers::ImageDataSerializer::GetRGBStride(rgb);
|
||||
if (stride <= 0) {
|
||||
gfxCriticalError() << "TexUnpackSurface failed to get rgb stride";
|
||||
return false;
|
||||
}
|
||||
size_t bufSize = layers::ImageDataSerializer::ComputeRGBBufferSize(
|
||||
rgb.size(), rgb.format());
|
||||
if (!bufSize || bufSize > shmemSize) {
|
||||
gfxCriticalError() << "TexUnpackSurface failed to get rgb buffer size";
|
||||
return false;
|
||||
}
|
||||
surf = gfx::Factory::CreateWrappingDataSourceSurface(
|
||||
shmem.get<uint8_t>(), stride, rgb.size(), rgb.format());
|
||||
} else if (SDIsNullRemoteDecoder(sd)) {
|
||||
const auto& sdrd = sd.get_SurfaceDescriptorGPUVideo()
|
||||
.get_SurfaceDescriptorRemoteDecoder();
|
||||
@@ -1106,12 +1117,10 @@ bool TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec,
|
||||
// -
|
||||
|
||||
const auto dstFormat = FormatForPackingInfo(dstPI);
|
||||
const auto dstBpp = BytesPerPixel(dstPI);
|
||||
const size_t dstBpp = BytesPerPixel(dstPI);
|
||||
const size_t dstUsedBytesPerRow = dstBpp * surf->GetSize().width;
|
||||
auto dstStride = dstUsedBytesPerRow;
|
||||
if (dstFormat == srcFormat) {
|
||||
dstStride = srcStride; // Try to match.
|
||||
}
|
||||
size_t dstStride = dstFormat == srcFormat ? srcStride // Try To match
|
||||
: dstUsedBytesPerRow;
|
||||
|
||||
// -
|
||||
|
||||
|
||||
Reference in New Issue
Block a user