Bug 1598582: Create a DataSourceSurface in RecordedSourceSurfaceCreation::PlayEvent. r=jrmuizel

This is instead of using the reference DrawTarget to create it, because that
will sometimes fail for large surfaces.

Differential Revision: https://phabricator.services.mozilla.com/D55148

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bob Owen 2019-12-05 15:07:06 +00:00
Родитель 9fa23d568b
Коммит 599d8c4b43
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -882,7 +882,7 @@ class RecordedSourceSurfaceCreation
int32_t mStride;
IntSize mSize;
SurfaceFormat mFormat;
bool mDataOwned;
mutable bool mDataOwned;
template <class S>
MOZ_IMPLICIT RecordedSourceSurfaceCreation(S& aStream);
@ -2798,9 +2798,13 @@ inline bool RecordedSourceSurfaceCreation::PlayEvent(
return false;
}
RefPtr<SourceSurface> src =
aTranslator->GetReferenceDrawTarget()->CreateSourceSurfaceFromData(
mData, mSize, mSize.width * BytesPerPixel(mFormat), mFormat);
RefPtr<SourceSurface> src = Factory::CreateWrappingDataSourceSurface(
mData, mSize.width * BytesPerPixel(mFormat), mSize, mFormat,
[](void* aClosure) { delete[] static_cast<uint8_t*>(aClosure); }, mData);
if (src) {
mDataOwned = false;
}
aTranslator->AddSourceSurface(mRefPtr, src);
return true;
}