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

Change PDFImage to use ColorSpace.parseAsync #19570

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Feb 27, 2025

Given that the ColorSpace parsing happens in the constructor we cannot just await it, which required a slightly more complicated solution (without having to attempt a full re-write of this class).

In particular the final parsing in the constructor will now wait for the ColorSpace parsing before completing, and the already asynchronous createImageData-method (which all images need to use) will ensure that all images are completely initialized.

Smaller diff with https://github.com/mozilla/pdf.js/pull/19570/files?w=1

Given that the `ColorSpace` parsing happens in the constructor we cannot just await it, which required a slightly more complicated solution (without having to attempt a full re-write of this class).

In particular the final parsing in the constructor will now wait for the `ColorSpace` parsing before completing, and the already asynchronous `createImageData`-method (which all images need to use) will ensure that all images are completely initialized.
@Snuffleupagus Snuffleupagus force-pushed the PDFImage-ColorSpace-parseAsync branch from cdc7570 to 0f3d384 Compare February 27, 2025 16:42
@Snuffleupagus Snuffleupagus removed the request for review from calixteman February 27, 2025 17:27
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.

1 participant