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

Improve argument/name handling when parsing TilingPatterns (PR 12458 follow-up) #12526

Merged
merged 1 commit into from
Oct 24, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

  • Handle the arguments correctly in PartialEvaluator.handleColorN.
    For TilingPatterns with a base-ColorSpace, we're currently using the args when computing the color. However, as can be seen we're passing the Array as-is to the ColorSpace.getRgb method, which means that the Name is included as well.[1]
    Thankfully this hasn't, as far as I know, caused any actual bugs, but that may be more luck than anything else given how the ColorSpace code is implemented. This can be easily fixed though, simply by popping the Name-object off of the args Array.

  • Cache TilingPatterns using the Name-string, rather than the object directly.
    This is not only consistent with other caches in PartialEvaluator, but importantly it also ensures that the cache lookup always works correctly. Note that since Name-objects, similar to other primitives, uses a cache themselves a manually triggered cleanup-call could thus (theoretically) cause the LocalTilingPatternCache to not find an existing entry. While the likelihood of this happening is extremely small, it's still something that we should fix.


[1] The args Array can e.g. look like this: [0.043, 0.09, 0.188, 0.004, /P1], which means that we're passing in the Name-object to the ColorSpace method.

…follow-up)

 - Handle the arguments correctly in `PartialEvaluator.handleColorN`.
   For TilingPatterns with a base-ColorSpace, we're currently using the `args` when computing the color. However, as can be seen we're passing the Array as-is to the `ColorSpace.getRgb` method, which means that the `Name` is included as well.[1]
   Thankfully this hasn't, as far as I know, caused any actual bugs, but that may be more luck than anything else given how the `ColorSpace` code is implemented. This can be easily fixed though, simply by popping the `Name`-object off of the `args` Array.

 - Cache TilingPatterns using the `Name`-string, rather than the object directly.
   This is not only consistent with other caches in `PartialEvaluator`, but importantly it also ensures that the cache lookup always works correctly. Note that since `Name`-objects, similar to other primitives, uses a cache themselves a *manually* triggered `cleanup`-call could thus (theoretically) cause the `LocalTilingPatternCache` to not find an existing entry. While the likelihood of this happening is *extremely* small, it's still something that we should fix.

---
[1] The `args` Array can e.g. look like this: `[0.043, 0.09, 0.188, 0.004, /P1]`, which means that we're passing in the `Name`-object to the `ColorSpace` method.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/d2d99468066ebfe/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/d2d99468066ebfe/output.txt

Total script time: 25.67 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/d2d99468066ebfe/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij merged commit 180f35e into mozilla:master Oct 24, 2020
@timvandermeij
Copy link
Contributor

Thank you! I'm also a bit surprised that this didn't break anything we know of, so I guess we were lucky.

@Snuffleupagus Snuffleupagus deleted the TilingPattern-args branch October 24, 2020 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants