Editor: Use in/decrementors in wp_tinycolor_hue_to_rgb().

Replaces `+=` and `-=` with `++$t` and `--$t` (in/decrementors) within the `wp_tinycolor_hue_to_rgb()`. 

Why? For performance: in/decrementors are more performant than an assignment with a calculation.

References:
* https://www.php.net/manual/en/language.operators.increment.php
* https://github.com/WordPress/gutenberg/pull/44551

Follow-up to [50929].

Props jrf, czapla, antonvlasenko, aristath, mamaduka.
See #57527. 

git-svn-id: https://develop.svn.wordpress.org/trunk@55140 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2023-01-25 21:41:00 +00:00
parent 0c8c4f89a3
commit 616f0bca52

View File

@ -130,10 +130,10 @@ function wp_tinycolor_rgb_to_rgb( $rgb_color ) {
*/
function wp_tinycolor_hue_to_rgb( $p, $q, $t ) {
if ( $t < 0 ) {
$t += 1;
++$t;
}
if ( $t > 1 ) {
$t -= 1;
--$t;
}
if ( $t < 1 / 6 ) {
return $p + ( $q - $p ) * 6 * $t;