Improve error messaging when render target cannot be created (flutter/engine#40150)

This commit is contained in:
Dan Field
2023-03-08 12:33:29 -08:00
committed by GitHub
parent 44947b8822
commit 3950fa55ca
2 changed files with 10 additions and 3 deletions

View File

@@ -266,7 +266,9 @@ std::unique_ptr<SnapshotDelegate::GpuImageResult> MakeBitmapImage(
if (image_info.width() > 16384 || image_info.height() > 16384) {
return std::make_unique<SnapshotDelegate::GpuImageResult>(
GrBackendTexture(), nullptr, nullptr,
"unable to create render target at specified size");
"unable to create bitmap render target at specified size " +
std::to_string(image_info.width()) + "x" +
std::to_string(image_info.height()));
};
sk_sp<SkSurface> surface = SkSurface::MakeRaster(image_info);
@@ -321,7 +323,9 @@ std::unique_ptr<Rasterizer::GpuImageResult> Rasterizer::MakeSkiaGpuImage(
if (!texture.isValid()) {
result = std::make_unique<SnapshotDelegate::GpuImageResult>(
GrBackendTexture(), nullptr, nullptr,
"unable to create render target at specified size");
"unable to create texture render target at specified size " +
std::to_string(image_info.width()) + "x" +
std::to_string(image_info.height()));
return;
}

View File

@@ -440,7 +440,10 @@ void main() {
canvas.drawImage(image, Offset.zero, Paint());
} on PictureRasterizationException catch (e) {
caughtException = true;
expect(e.message, contains('unable to create render target at specified size'));
expect(
e.message,
contains('unable to create bitmap render target at specified size ${image.width}x${image.height}'),
);
break;
}
// Let the event loop turn.