@@ -364,17 +364,17 @@ static void composition_destination_out(uint32_t* dest, int length, const uint32
364
364
}
365
365
}
366
366
367
- typedef void (* composition_function_solid_t )(uint32_t * dest , int length , uint32_t color , uint32_t const_alpha );
367
+ typedef void (* composition_solid_function_t )(uint32_t * dest , int length , uint32_t color , uint32_t const_alpha );
368
368
typedef void (* composition_function_t )(uint32_t * dest , int length , const uint32_t * src , uint32_t const_alpha );
369
369
370
- static const composition_function_solid_t function_for_mode_solid [] = {
370
+ static const composition_solid_function_t composition_solid_map [] = {
371
371
composition_solid_source ,
372
372
composition_solid_source_over ,
373
373
composition_solid_destination_in ,
374
374
composition_solid_destination_out
375
375
};
376
376
377
- static const composition_function_t function_for_mode [] = {
377
+ static const composition_function_t composition_map [] = {
378
378
composition_source ,
379
379
composition_source_over ,
380
380
composition_destination_in ,
@@ -383,9 +383,9 @@ static const composition_function_t function_for_mode[] = {
383
383
384
384
static void blend_solid (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , uint32_t solid )
385
385
{
386
- composition_function_solid_t func = function_for_mode_solid [op ];
386
+ composition_solid_function_t func = composition_solid_map [op ];
387
387
int count = rle -> spans .size ;
388
- const plutovg_span_t * spans = rle -> spans .data ;
388
+ const plutovg_span_t * spans = rle -> spans .data ;
389
389
while (count -- )
390
390
{
391
391
uint32_t * target = (uint32_t * )(surface -> data + spans -> y * surface -> stride ) + spans -> x ;
@@ -398,7 +398,7 @@ static void blend_solid(plutovg_surface_t* surface, plutovg_operator_t op, const
398
398
#define BUFFER_SIZE 1024
399
399
static void blend_linear_gradient (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const gradient_data_t * gradient )
400
400
{
401
- composition_function_t func = function_for_mode [op ];
401
+ composition_function_t func = composition_map [op ];
402
402
unsigned int buffer [BUFFER_SIZE ];
403
403
404
404
linear_gradient_values_t v ;
@@ -435,7 +435,7 @@ static void blend_linear_gradient(plutovg_surface_t* surface, plutovg_operator_t
435
435
436
436
static void blend_radial_gradient (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const gradient_data_t * gradient )
437
437
{
438
- composition_function_t func = function_for_mode [op ];
438
+ composition_function_t func = composition_map [op ];
439
439
unsigned int buffer [BUFFER_SIZE ];
440
440
441
441
radial_gradient_values_t v ;
@@ -474,7 +474,7 @@ static void blend_radial_gradient(plutovg_surface_t* surface, plutovg_operator_t
474
474
#define FIXED_SCALE (1 << 16)
475
475
static void blend_transformed_argb (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const texture_data_t * texture )
476
476
{
477
- composition_function_t func = function_for_mode [op ];
477
+ composition_function_t func = composition_map [op ];
478
478
uint32_t buffer [BUFFER_SIZE ];
479
479
480
480
int image_width = texture -> width ;
@@ -524,7 +524,7 @@ static void blend_transformed_argb(plutovg_surface_t* surface, plutovg_operator_
524
524
525
525
static void blend_untransformed_argb (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const texture_data_t * texture )
526
526
{
527
- composition_function_t func = function_for_mode [op ];
527
+ composition_function_t func = composition_map [op ];
528
528
529
529
const int image_width = texture -> width ;
530
530
const int image_height = texture -> height ;
@@ -564,7 +564,7 @@ static void blend_untransformed_argb(plutovg_surface_t* surface, plutovg_operato
564
564
565
565
static void blend_untransformed_tiled_argb (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const texture_data_t * texture )
566
566
{
567
- composition_function_t func = function_for_mode [op ];
567
+ composition_function_t func = composition_map [op ];
568
568
569
569
int image_width = texture -> width ;
570
570
int image_height = texture -> height ;
@@ -610,7 +610,7 @@ static void blend_untransformed_tiled_argb(plutovg_surface_t* surface, plutovg_o
610
610
611
611
static void blend_transformed_tiled_argb (plutovg_surface_t * surface , plutovg_operator_t op , const plutovg_rle_t * rle , const texture_data_t * texture )
612
612
{
613
- composition_function_t func = function_for_mode [op ];
613
+ composition_function_t func = composition_map [op ];
614
614
uint32_t buffer [BUFFER_SIZE ];
615
615
616
616
int image_width = texture -> width ;
@@ -723,18 +723,14 @@ void plutovg_blend_gradient(plutovg_t* pluto, const plutovg_rle_t* rle, const pl
723
723
724
724
int dist , idist , pos = 0 ;
725
725
int i ;
726
- int alpha = 0 ;
727
726
int nstop = gradient -> stops .size ;
728
727
const plutovg_gradient_stop_t * curr , * next , * start ;
729
728
uint32_t curr_color , next_color ;
730
729
double delta , t , incr , fpos ;
731
730
double opacity = state -> opacity * gradient -> opacity ;
732
731
733
- if (opacity != 1.0 ) alpha = 1 ;
734
-
735
732
start = gradient -> stops .data ;
736
733
curr = start ;
737
- if (curr -> color .a != 0.0 ) alpha = 1 ;
738
734
curr_color = premultiply_color (& curr -> color , opacity );
739
735
incr = 1.0 / COLOR_TABLE_SIZE ;
740
736
fpos = 1.5 * incr ;
@@ -753,7 +749,6 @@ void plutovg_blend_gradient(plutovg_t* pluto, const plutovg_rle_t* rle, const pl
753
749
curr = (start + i );
754
750
next = (start + i + 1 );
755
751
delta = 1.0 / (next -> offset - curr -> offset );
756
- if (next -> color .a != 0.0 ) alpha = 1 ;
757
752
next_color = premultiply_color (& next -> color , opacity );
758
753
while (fpos < next -> offset && pos < COLOR_TABLE_SIZE )
759
754
{
@@ -768,10 +763,10 @@ void plutovg_blend_gradient(plutovg_t* pluto, const plutovg_rle_t* rle, const pl
768
763
curr_color = next_color ;
769
764
}
770
765
771
- for (;pos < COLOR_TABLE_SIZE ;++ pos ) data .colortable [pos ] = curr_color ;
772
- data .colortable [COLOR_TABLE_SIZE - 1 ] = curr_color ;
773
- data .spread = gradient -> spread ;
766
+ for (;pos < COLOR_TABLE_SIZE ;++ pos )
767
+ data .colortable [pos ] = curr_color ;
774
768
769
+ data .spread = gradient -> spread ;
775
770
data .matrix = gradient -> matrix ;
776
771
plutovg_matrix_multiply (& data .matrix , & data .matrix , & state -> matrix );
777
772
plutovg_matrix_invert (& data .matrix );
@@ -796,7 +791,7 @@ void plutovg_blend_texture(plutovg_t* pluto, const plutovg_rle_t* rle, const plu
796
791
plutovg_matrix_multiply (& data .matrix , & data .matrix , & state -> matrix );
797
792
plutovg_matrix_invert (& data .matrix );
798
793
799
- const plutovg_matrix_t * matrix = & texture -> matrix ;
794
+ const plutovg_matrix_t * matrix = & data . matrix ;
800
795
int translating = (matrix -> m00 == 1.0 && matrix -> m10 == 0.0 && matrix -> m01 == 0.0 && matrix -> m11 == 1.0 );
801
796
if (translating )
802
797
{
0 commit comments