Bug 1812932 - Add size outvar to GetImageBuffer. r=gfx-reviewers,bradwerth

Differential Revision: https://phabricator.services.mozilla.com/D171764
This commit is contained in:
Kelsey Gilbert
2023-03-21 18:05:09 +00:00
parent ed0d540ee1
commit ecd474bc06
10 changed files with 42 additions and 24 deletions

View File

@@ -1170,8 +1170,10 @@ RefPtr<gfx::DataSourceSurface> ClientWebGLContext::BackBufferSnapshot() {
return surf;
}
UniquePtr<uint8_t[]> ClientWebGLContext::GetImageBuffer(int32_t* out_format) {
UniquePtr<uint8_t[]> ClientWebGLContext::GetImageBuffer(
int32_t* out_format, gfx::IntSize* out_imageSize) {
*out_format = 0;
*out_imageSize = {};
// Use GetSurfaceSnapshot() to make sure that appropriate y-flip gets applied
gfxAlphaType any;
@@ -1181,6 +1183,7 @@ UniquePtr<uint8_t[]> ClientWebGLContext::GetImageBuffer(int32_t* out_format) {
RefPtr<gfx::DataSourceSurface> dataSurface = snapshot->GetDataSurface();
const auto& premultAlpha = mNotLost->info.options.premultipliedAlpha;
*out_imageSize = dataSurface->GetSize();
return gfxUtils::GetImageBuffer(dataSurface, premultAlpha, out_format);
}