@@ -751,11 +751,7 @@ PHP_FUNCTION(imagepalettetotruecolor)
751
751
752
752
im = php_gd_libgdimageptr_from_zval_p (IM );
753
753
754
- if (gdImagePaletteToTrueColor (im ) == 0 ) {
755
- RETURN_FALSE ;
756
- }
757
-
758
- RETURN_TRUE ;
754
+ RETURN_BOOL (gdImagePaletteToTrueColor (im ) != 0 );
759
755
}
760
756
/* }}} */
761
757
@@ -3424,22 +3420,14 @@ static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS)
3424
3420
{
3425
3421
PHP_GD_SINGLE_RES
3426
3422
3427
- if (gdImageNegate (im_src ) == 1 ) {
3428
- RETURN_TRUE ;
3429
- }
3430
-
3431
- RETURN_FALSE ;
3423
+ RETURN_BOOL (gdImageNegate (im_src ) == 1 );
3432
3424
}
3433
3425
3434
3426
static void php_image_filter_grayscale (INTERNAL_FUNCTION_PARAMETERS )
3435
3427
{
3436
3428
PHP_GD_SINGLE_RES
3437
3429
3438
- if (gdImageGrayScale (im_src ) == 1 ) {
3439
- RETURN_TRUE ;
3440
- }
3441
-
3442
- RETURN_FALSE ;
3430
+ RETURN_BOOL (gdImageGrayScale (im_src ) == 1 );
3443
3431
}
3444
3432
3445
3433
static void php_image_filter_brightness (INTERNAL_FUNCTION_PARAMETERS )
@@ -3456,11 +3444,7 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS)
3456
3444
3457
3445
im_src = php_gd_libgdimageptr_from_zval_p (SIM );
3458
3446
3459
- if (gdImageBrightness (im_src , (int )brightness ) == 1 ) {
3460
- RETURN_TRUE ;
3461
- }
3462
-
3463
- RETURN_FALSE ;
3447
+ RETURN_BOOL (gdImageBrightness (im_src , (int )brightness ) == 1 );
3464
3448
}
3465
3449
3466
3450
static void php_image_filter_contrast (INTERNAL_FUNCTION_PARAMETERS )
@@ -3477,11 +3461,7 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS)
3477
3461
3478
3462
im_src = php_gd_libgdimageptr_from_zval_p (SIM );
3479
3463
3480
- if (gdImageContrast (im_src , (int )contrast ) == 1 ) {
3481
- RETURN_TRUE ;
3482
- }
3483
-
3484
- RETURN_FALSE ;
3464
+ RETURN_BOOL (gdImageContrast (im_src , (int )contrast ) == 1 );
3485
3465
}
3486
3466
3487
3467
static void php_image_filter_colorize (INTERNAL_FUNCTION_PARAMETERS )
@@ -3503,66 +3483,42 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
3503
3483
3504
3484
im_src = php_gd_libgdimageptr_from_zval_p (SIM );
3505
3485
3506
- if (gdImageColor (im_src , (int ) r , (int ) g , (int ) b , (int ) a ) == 1 ) {
3507
- RETURN_TRUE ;
3508
- }
3509
-
3510
- RETURN_FALSE ;
3486
+ RETURN_BOOL (gdImageColor (im_src , (int ) r , (int ) g , (int ) b , (int ) a ) == 1 );
3511
3487
}
3512
3488
3513
3489
static void php_image_filter_edgedetect (INTERNAL_FUNCTION_PARAMETERS )
3514
3490
{
3515
3491
PHP_GD_SINGLE_RES
3516
3492
3517
- if (gdImageEdgeDetectQuick (im_src ) == 1 ) {
3518
- RETURN_TRUE ;
3519
- }
3520
-
3521
- RETURN_FALSE ;
3493
+ RETURN_BOOL (gdImageEdgeDetectQuick (im_src ) == 1 );
3522
3494
}
3523
3495
3524
3496
static void php_image_filter_emboss (INTERNAL_FUNCTION_PARAMETERS )
3525
3497
{
3526
3498
PHP_GD_SINGLE_RES
3527
3499
3528
- if (gdImageEmboss (im_src ) == 1 ) {
3529
- RETURN_TRUE ;
3530
- }
3531
-
3532
- RETURN_FALSE ;
3500
+ RETURN_BOOL (gdImageEmboss (im_src ) == 1 );
3533
3501
}
3534
3502
3535
3503
static void php_image_filter_gaussian_blur (INTERNAL_FUNCTION_PARAMETERS )
3536
3504
{
3537
3505
PHP_GD_SINGLE_RES
3538
3506
3539
- if (gdImageGaussianBlur (im_src ) == 1 ) {
3540
- RETURN_TRUE ;
3541
- }
3542
-
3543
- RETURN_FALSE ;
3507
+ RETURN_BOOL (gdImageGaussianBlur (im_src ) == 1 );
3544
3508
}
3545
3509
3546
3510
static void php_image_filter_selective_blur (INTERNAL_FUNCTION_PARAMETERS )
3547
3511
{
3548
3512
PHP_GD_SINGLE_RES
3549
3513
3550
- if (gdImageSelectiveBlur (im_src ) == 1 ) {
3551
- RETURN_TRUE ;
3552
- }
3553
-
3554
- RETURN_FALSE ;
3514
+ RETURN_BOOL (gdImageSelectiveBlur (im_src ) == 1 );
3555
3515
}
3556
3516
3557
3517
static void php_image_filter_mean_removal (INTERNAL_FUNCTION_PARAMETERS )
3558
3518
{
3559
3519
PHP_GD_SINGLE_RES
3560
3520
3561
- if (gdImageMeanRemoval (im_src ) == 1 ) {
3562
- RETURN_TRUE ;
3563
- }
3564
-
3565
- RETURN_FALSE ;
3521
+ RETURN_BOOL (gdImageMeanRemoval (im_src ) == 1 );
3566
3522
}
3567
3523
3568
3524
static void php_image_filter_smooth (INTERNAL_FUNCTION_PARAMETERS )
@@ -3580,11 +3536,7 @@ static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS)
3580
3536
3581
3537
im_src = php_gd_libgdimageptr_from_zval_p (SIM );
3582
3538
3583
- if (gdImageSmooth (im_src , (float )weight )== 1 ) {
3584
- RETURN_TRUE ;
3585
- }
3586
-
3587
- RETURN_FALSE ;
3539
+ RETURN_BOOL (gdImageSmooth (im_src , (float )weight ) == 1 );
3588
3540
}
3589
3541
3590
3542
static void php_image_filter_pixelate (INTERNAL_FUNCTION_PARAMETERS )
@@ -3604,11 +3556,7 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS)
3604
3556
3605
3557
im = php_gd_libgdimageptr_from_zval_p (IM );
3606
3558
3607
- if (gdImagePixelate (im , (int ) blocksize , (const unsigned int ) mode )) {
3608
- RETURN_TRUE ;
3609
- }
3610
-
3611
- RETURN_FALSE ;
3559
+ RETURN_BOOL (gdImagePixelate (im , (int ) blocksize , (const unsigned int ) mode ));;
3612
3560
}
3613
3561
3614
3562
static void php_image_filter_scatter (INTERNAL_FUNCTION_PARAMETERS )
@@ -3707,7 +3655,6 @@ PHP_FUNCTION(imageconvolution)
3707
3655
zval * var = NULL , * var2 = NULL ;
3708
3656
gdImagePtr im_src = NULL ;
3709
3657
double div , offset ;
3710
- int res ;
3711
3658
float matrix [3 ][3 ] = {{0 ,0 ,0 }, {0 ,0 ,0 }, {0 ,0 ,0 }};
3712
3659
3713
3660
ZEND_PARSE_PARAMETERS_START (4 , 4 )
@@ -3758,13 +3705,7 @@ PHP_FUNCTION(imageconvolution)
3758
3705
RETURN_THROWS ();
3759
3706
}
3760
3707
3761
- res = gdImageConvolution (im_src , matrix , div_float , (float ) offset );
3762
-
3763
- if (res ) {
3764
- RETURN_TRUE ;
3765
- } else {
3766
- RETURN_FALSE ;
3767
- }
3708
+ RETURN_BOOL (gdImageConvolution (im_src , matrix , div_float , (float ) offset ));
3768
3709
}
3769
3710
/* }}} */
3770
3711
/* End section: Filters */
0 commit comments