Improve argument/name handling when parsing TilingPatterns (PR 12458 follow-up) #12526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theColorSpace.getRgb
method, which means that theName
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 theName
-object off of theargs
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 sinceName
-objects, similar to other primitives, uses a cache themselves a manually triggeredcleanup
-call could thus (theoretically) cause theLocalTilingPatternCache
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 theName
-object to theColorSpace
method.