@@ -418,7 +418,6 @@ static void blend_solid(plutovg_surface_t* surface, plutovg_operator_t op, const
418
418
}
419
419
}
420
420
421
- #define MIN (a , b ) ((a) < (b) ? (a) : (b))
422
421
#define BUFFER_SIZE 1024
423
422
static void blend_linear_gradient (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const gradient_data_t * gradient )
424
423
{
@@ -445,7 +444,7 @@ static void blend_linear_gradient(plutovg_surface_t* surface, plutovg_operator_t
445
444
int x = spans -> x ;
446
445
while (length )
447
446
{
448
- int l = MIN (length , BUFFER_SIZE );
447
+ int l = plutovg_min (length , BUFFER_SIZE );
449
448
fetch_linear_gradient (buffer , & v , gradient , spans -> y , x , l );
450
449
uint32_t * target = (uint32_t * )(surface -> data + spans -> y * surface -> stride ) + x ;
451
450
func (target , l , buffer , spans -> coverage );
@@ -479,7 +478,7 @@ static void blend_radial_gradient(plutovg_surface_t* surface, plutovg_operator_t
479
478
int x = spans -> x ;
480
479
while (length )
481
480
{
482
- int l = MIN (length , BUFFER_SIZE );
481
+ int l = plutovg_min (length , BUFFER_SIZE );
483
482
fetch_radial_gradient (buffer , & v , gradient , spans -> y , x , l );
484
483
uint32_t * target = (uint32_t * )(surface -> data + spans -> y * surface -> stride ) + x ;
485
484
func (target , l , buffer , spans -> coverage );
@@ -491,7 +490,6 @@ static void blend_radial_gradient(plutovg_surface_t* surface, plutovg_operator_t
491
490
}
492
491
}
493
492
494
- #define CLAMP (v , lo , hi ) ((v) < (lo) ? (lo) : (hi) < (v) ? (hi) : (v))
495
493
#define FIXED_SCALE (1 << 16)
496
494
static void blend_transformed_argb (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const texture_data_t * texture )
497
495
{
@@ -520,13 +518,13 @@ static void blend_transformed_argb(plutovg_surface_t* surface, plutovg_operator_
520
518
const int coverage = (spans -> coverage * texture -> const_alpha ) >> 8 ;
521
519
while (length )
522
520
{
523
- int l = MIN (length , BUFFER_SIZE );
521
+ int l = plutovg_min (length , BUFFER_SIZE );
524
522
const uint32_t * end = buffer + l ;
525
523
uint32_t * b = buffer ;
526
524
while (b < end )
527
525
{
528
- int px = CLAMP (x >> 16 , 0 , image_width - 1 );
529
- int py = CLAMP (y >> 16 , 0 , image_height - 1 );
526
+ int px = plutovg_clamp (x >> 16 , 0 , image_width - 1 );
527
+ int py = plutovg_clamp (y >> 16 , 0 , image_height - 1 );
530
528
* b = ((const uint32_t * )(texture -> data + py * texture -> stride ))[px ];
531
529
532
530
x += fdx ;
@@ -614,7 +612,7 @@ static void blend_untransformed_tiled_argb(plutovg_surface_t* surface, plutovg_o
614
612
const int coverage = (spans -> coverage * texture -> const_alpha ) >> 8 ;
615
613
while (length )
616
614
{
617
- int l = MIN (image_width - sx , length );
615
+ int l = plutovg_min (image_width - sx , length );
618
616
if (BUFFER_SIZE < l )
619
617
l = BUFFER_SIZE ;
620
618
const uint32_t * src = (const uint32_t * )(texture -> data + sy * texture -> stride ) + sx ;
@@ -658,7 +656,7 @@ static void blend_transformed_tiled_argb(plutovg_surface_t* surface, plutovg_ope
658
656
int length = spans -> len ;
659
657
while (length )
660
658
{
661
- int l = MIN (length , BUFFER_SIZE );
659
+ int l = plutovg_min (length , BUFFER_SIZE );
662
660
const uint32_t * end = buffer + l ;
663
661
uint32_t * b = buffer ;
664
662
int px16 = x % (image_width << 16 );
@@ -696,13 +694,13 @@ static void blend_transformed_tiled_argb(plutovg_surface_t* surface, plutovg_ope
696
694
697
695
void plutovg_blend (plutovg_t * pluto , const plutovg_rle_t * rle )
698
696
{
699
- plutovg_paint_t * source = pluto -> state -> source ;
697
+ plutovg_paint_t * source = & pluto -> state -> paint ;
700
698
if (source -> type == plutovg_paint_type_color )
701
- plutovg_blend_color (pluto , rle , source -> color );
699
+ plutovg_blend_color (pluto , rle , & source -> color );
702
700
else if (source -> type == plutovg_paint_type_gradient )
703
- plutovg_blend_gradient (pluto , rle , source -> gradient );
701
+ plutovg_blend_gradient (pluto , rle , & source -> gradient );
704
702
else
705
- plutovg_blend_texture (pluto , rle , source -> texture );
703
+ plutovg_blend_texture (pluto , rle , & source -> texture );
706
704
}
707
705
708
706
void plutovg_blend_color (plutovg_t * pluto , const plutovg_rle_t * rle , const plutovg_color_t * color )
0 commit comments