Re: [csswg-drafts] [css-color-4] Evaluate static gamut mapping algorithms for oklab/oklch spaces (#10579)

> 9) and 10) seem to reuse `end` to store the intersection. This should probably not be done, assuming `end` is the current RGB point and not a copy. Once we've got the intersection, we want to use that RGB point (not the intersection) to update the anchor, but only after we've used the old anchor. If we overwrite the RGB point with the intersection, we'll end up not having the anchor update properly. Depending on the language, this could be handled a number of ways, `end` is a copy of the data, you could pass in a reference to an array that will be filled with the intersection, you could allocate and return a new array as well, etc. I think this should be written in a way that does not lead people to believe they could overwrite the original data.

Ah yes, it should not clobber `end` because it is called in a loop. Like [here in color.js](https://github.com/color-js/apps/blob/2c7346dd00855f7b82eb4c7527355a09b84beeb3/gamut-mapping/methods.js#L493-L498). Good catch, fixed.

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10579#issuecomment-3796991809 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 25 January 2026 17:32:06 UTC