Skip to content

Commit 331d695

Browse files
Update lunasvg from 2.3.1 to 2.3.5 (#2842)
1 parent 07d0cf7 commit 331d695

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4897
-4834
lines changed

vendor/lunasvg/3rdparty/plutovg/plutovg-blend.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ static void blend_solid(plutovg_surface_t* surface, plutovg_operator_t op, const
418418
}
419419
}
420420

421-
#define MIN(a, b) ((a) < (b) ? (a) : (b))
422421
#define BUFFER_SIZE 1024
423422
static void blend_linear_gradient(plutovg_surface_t* surface, plutovg_operator_t op, const plutovg_rle_t* rle, const gradient_data_t* gradient)
424423
{
@@ -445,7 +444,7 @@ static void blend_linear_gradient(plutovg_surface_t* surface, plutovg_operator_t
445444
int x = spans->x;
446445
while(length)
447446
{
448-
int l = MIN(length, BUFFER_SIZE);
447+
int l = plutovg_min(length, BUFFER_SIZE);
449448
fetch_linear_gradient(buffer, &v, gradient, spans->y, x, l);
450449
uint32_t* target = (uint32_t*)(surface->data + spans->y * surface->stride) + x;
451450
func(target, l, buffer, spans->coverage);
@@ -479,7 +478,7 @@ static void blend_radial_gradient(plutovg_surface_t* surface, plutovg_operator_t
479478
int x = spans->x;
480479
while(length)
481480
{
482-
int l = MIN(length, BUFFER_SIZE);
481+
int l = plutovg_min(length, BUFFER_SIZE);
483482
fetch_radial_gradient(buffer, &v, gradient, spans->y, x, l);
484483
uint32_t* target = (uint32_t*)(surface->data + spans->y * surface->stride) + x;
485484
func(target, l, buffer, spans->coverage);
@@ -491,7 +490,6 @@ static void blend_radial_gradient(plutovg_surface_t* surface, plutovg_operator_t
491490
}
492491
}
493492

494-
#define CLAMP(v, lo, hi) ((v) < (lo) ? (lo) : (hi) < (v) ? (hi) : (v))
495493
#define FIXED_SCALE (1 << 16)
496494
static void blend_transformed_argb(plutovg_surface_t* surface, plutovg_operator_t op, const plutovg_rle_t* rle, const texture_data_t* texture)
497495
{
@@ -520,13 +518,13 @@ static void blend_transformed_argb(plutovg_surface_t* surface, plutovg_operator_
520518
const int coverage = (spans->coverage * texture->const_alpha) >> 8;
521519
while(length)
522520
{
523-
int l = MIN(length, BUFFER_SIZE);
521+
int l = plutovg_min(length, BUFFER_SIZE);
524522
const uint32_t* end = buffer + l;
525523
uint32_t* b = buffer;
526524
while(b < end)
527525
{
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);
530528
*b = ((const uint32_t*)(texture->data + py * texture->stride))[px];
531529

532530
x += fdx;
@@ -614,7 +612,7 @@ static void blend_untransformed_tiled_argb(plutovg_surface_t* surface, plutovg_o
614612
const int coverage = (spans->coverage * texture->const_alpha) >> 8;
615613
while(length)
616614
{
617-
int l = MIN(image_width - sx, length);
615+
int l = plutovg_min(image_width - sx, length);
618616
if(BUFFER_SIZE < l)
619617
l = BUFFER_SIZE;
620618
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
658656
int length = spans->len;
659657
while(length)
660658
{
661-
int l = MIN(length, BUFFER_SIZE);
659+
int l = plutovg_min(length, BUFFER_SIZE);
662660
const uint32_t* end = buffer + l;
663661
uint32_t* b = buffer;
664662
int px16 = x % (image_width << 16);
@@ -696,13 +694,13 @@ static void blend_transformed_tiled_argb(plutovg_surface_t* surface, plutovg_ope
696694

697695
void plutovg_blend(plutovg_t* pluto, const plutovg_rle_t* rle)
698696
{
699-
plutovg_paint_t* source = pluto->state->source;
697+
plutovg_paint_t* source = &pluto->state->paint;
700698
if(source->type == plutovg_paint_type_color)
701-
plutovg_blend_color(pluto, rle, source->color);
699+
plutovg_blend_color(pluto, rle, &source->color);
702700
else if(source->type == plutovg_paint_type_gradient)
703-
plutovg_blend_gradient(pluto, rle, source->gradient);
701+
plutovg_blend_gradient(pluto, rle, &source->gradient);
704702
else
705-
plutovg_blend_texture(pluto, rle, source->texture);
703+
plutovg_blend_texture(pluto, rle, &source->texture);
706704
}
707705

708706
void plutovg_blend_color(plutovg_t* pluto, const plutovg_rle_t* rle, const plutovg_color_t* color)

0 commit comments

Comments
 (0)