mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1759527 - Ensure ImageBitmapRenderingContext checks for null surfaces. r=gfx-reviewers,jnicol
This could happen when the content process cannot access the underlying surface directly for example. Differential Revision: https://phabricator.services.mozilla.com/D141098
This commit is contained in:
parent
8e7cc7be44
commit
02150a3b67
@ -102,6 +102,9 @@ ImageBitmapRenderingContext::InitializeWithDrawTarget(
|
||||
already_AddRefed<gfx::DataSourceSurface>
|
||||
ImageBitmapRenderingContext::MatchWithIntrinsicSize() {
|
||||
RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<gfx::DataSourceSurface> temp = gfx::Factory::CreateDataSourceSurface(
|
||||
gfx::IntSize(mWidth, mHeight), surface->GetFormat());
|
||||
if (!temp) {
|
||||
@ -195,6 +198,10 @@ ImageBitmapRenderingContext::GetSurfaceSnapshot(
|
||||
}
|
||||
|
||||
RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (surface->GetSize() != gfx::IntSize(mWidth, mHeight)) {
|
||||
return MatchWithIntrinsicSize();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user