From 616f0bca52a481a2eeb34e2e67615c12e2440707 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Wed, 25 Jan 2023 21:41:00 +0000 Subject: [PATCH] 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 --- src/wp-includes/block-supports/duotone.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/block-supports/duotone.php b/src/wp-includes/block-supports/duotone.php index 0e04cb1631..76542d8e37 100644 --- a/src/wp-includes/block-supports/duotone.php +++ b/src/wp-includes/block-supports/duotone.php @@ -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;