mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 965914 - Don't crash when we can't allocate a new surface in CloneAligned. r=Bas
This commit is contained in:
parent
5200455be2
commit
1e4341fcaa
@ -235,7 +235,9 @@ CloneAligned(DataSourceSurface* aSource)
|
||||
{
|
||||
RefPtr<DataSourceSurface> copy =
|
||||
Factory::CreateDataSourceSurface(aSource->GetSize(), aSource->GetFormat());
|
||||
CopyRect(aSource, copy, IntRect(IntPoint(), aSource->GetSize()), IntPoint());
|
||||
if (copy) {
|
||||
CopyRect(aSource, copy, IntRect(IntPoint(), aSource->GetSize()), IntPoint());
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@ -730,6 +732,13 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex,
|
||||
RefPtr<DataSourceSurface> result =
|
||||
GetDataSurfaceInRect(surface, surfaceRect, aRect, aEdgeMode);
|
||||
|
||||
if (result &&
|
||||
(result->Stride() != GetAlignedStride<16>(result->Stride()) ||
|
||||
reinterpret_cast<uintptr_t>(result->GetData()) % 16 != 0)) {
|
||||
// Align unaligned surface.
|
||||
result = CloneAligned(result);
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
#ifdef DEBUG_DUMP_SURFACES
|
||||
printf(" -- no input --</section>\n\n");
|
||||
@ -737,12 +746,6 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (result->Stride() != GetAlignedStride<16>(result->Stride()) ||
|
||||
reinterpret_cast<uintptr_t>(result->GetData()) % 16 != 0) {
|
||||
// Align unaligned surface.
|
||||
result = CloneAligned(result);
|
||||
}
|
||||
|
||||
SurfaceFormat currentFormat = result->GetFormat();
|
||||
if (DesiredFormat(currentFormat, aFormatHint) == SurfaceFormat::B8G8R8A8 &&
|
||||
currentFormat != SurfaceFormat::B8G8R8A8) {
|
||||
|
Loading…
Reference in New Issue
Block a user