Skip to content

Commit

Permalink
Editor: Use in/decrementors in wp_tinycolor_hue_to_rgb().
Browse files Browse the repository at this point in the history
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
* WordPress/gutenberg#44551

Follow-up to [50929].

Props jrf, czapla, antonvlasenko, aristath, mamaduka.
See #57527. 
Built from https://develop.svn.wordpress.org/trunk@55140


git-svn-id: http://core.svn.wordpress.org/trunk@54673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
hellofromtonya committed Jan 25, 2023
1 parent adbfbb6 commit e9a172b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions wp-includes/block-supports/duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55139';
$wp_version = '6.2-alpha-55140';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit e9a172b

Please sign in to comment.