From 3950fa55ca5638f6474b9b0a1bc12a20dd18a042 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 8 Mar 2023 12:33:29 -0800 Subject: [PATCH] Improve error messaging when render target cannot be created (flutter/engine#40150) --- engine/src/flutter/shell/common/rasterizer.cc | 8 ++++++-- engine/src/flutter/testing/dart/canvas_test.dart | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/common/rasterizer.cc b/engine/src/flutter/shell/common/rasterizer.cc index ebd2ff29ee..92bfe890a1 100644 --- a/engine/src/flutter/shell/common/rasterizer.cc +++ b/engine/src/flutter/shell/common/rasterizer.cc @@ -266,7 +266,9 @@ std::unique_ptr MakeBitmapImage( if (image_info.width() > 16384 || image_info.height() > 16384) { return std::make_unique( 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 surface = SkSurface::MakeRaster(image_info); @@ -321,7 +323,9 @@ std::unique_ptr Rasterizer::MakeSkiaGpuImage( if (!texture.isValid()) { result = std::make_unique( 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; } diff --git a/engine/src/flutter/testing/dart/canvas_test.dart b/engine/src/flutter/testing/dart/canvas_test.dart index e7b276fddd..c230382017 100644 --- a/engine/src/flutter/testing/dart/canvas_test.dart +++ b/engine/src/flutter/testing/dart/canvas_test.dart @@ -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.