Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageLoaderSVG: Improve error reporting #69048

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

akien-mga
Copy link
Member

Helps with #68822, which will now report:

WARNING: ImageLoaderSVG: Canvas dimensions of 1045714×1032197 (with scale 1.00) and exceed the max supported dimensions of 16384×16384. The canvas will be cropped.
     at: create_image_from_string (modules/svg/image_loader_svg.cpp:94)
ERROR: ImageLoaderSVG: Couldn't draw ThorVG pictures on canvas.
   at: create_image_from_string (modules/svg/image_loader_svg.cpp:122)
ERROR: Error loading image: res://testingSVG_fromInkscape_0.svg
   at: load_image (core/io/image_loader.cpp:101)
ERROR: Error importing 'res://testingSVG_fromInkscape_0.svg'.
   at: _reimport_file (editor/editor_file_system.cpp:1909)
ERROR: Condition "!importer.is_valid()" is true. Continuing.
   at: reimport_files (editor/editor_file_system.cpp:2123)

It still doesn't mention that the canvas actually doesn't contain drawable elements, but I don't know how to check that with the thorvg API to provide more details. At least it mentions that the drawing step failed.

It also warns about the image getting cropped, which should be an indicator for users that they'll not get the intended result.

There's still a failed reimport loop but that's tracked in #62271, so I think we can consider that this closes #68822.

@akien-mga akien-mga force-pushed the thorvg-better-errors branch from cb3f477 to 0c76887 Compare November 23, 2022 12:26
@akien-mga akien-mga force-pushed the thorvg-better-errors branch from 0c76887 to d3b8faa Compare November 23, 2022 12:27
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The major structure of the code looks good. I wasn’t able to go into deep review.

@akien-mga akien-mga merged commit cfb5ce7 into godotengine:master Nov 23, 2022
@akien-mga akien-mga deleted the thorvg-better-errors branch November 23, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specific SVG file with bundled PNG image fails to be imported
3 participants