Skip to content

Commit 4e36e52

Browse files
committed
fix: change source code format to ascii
Signed-off-by: onecoolx <onecoolx@gmail.com>
1 parent 152b1e8 commit 4e36e52

1 file changed

Lines changed: 40 additions & 40 deletions

File tree

ext/svg/psx_svg_player.cpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static INLINE void _anim_state_reset(psx_svg_anim_state* s)
4444
psx_array_clear(&s->overrides);
4545
psx_array_clear(&s->transforms);
4646
psx_array_clear(&s->motion_transforms);
47-
/* Keep dash buffers alive for reuse just reset size, not free. */
47+
/* Keep dash buffers alive for reuse - just reset size, not free. */
4848
s->dash_overrides.size = 0;
4949
psx_array_clear(&s->color_overrides);
5050
s->active_target_count = 0;
@@ -246,7 +246,7 @@ static INLINE const psx_svg_anim_transform_item* _anim_state_find_motion_transfo
246246
return NULL;
247247
}
248248

249-
/* ── SBO (Small Buffer Optimization) for float lists ── */
249+
/* -- SBO (Small Buffer Optimization) for float lists -- */
250250

251251
static INLINE int32_t _float_cmp_asc_fn(const void* a, const void* b)
252252
{
@@ -359,7 +359,7 @@ static INLINE void _sbo_sort_dedup(_sbo_float_list* l)
359359
l->count = w;
360360
}
361361

362-
/* ── End / Begin list helpers (SBO-backed) ── */
362+
/* -- End / Begin list helpers (SBO-backed) -- */
363363

364364
static INLINE void _anim_item_end_list_init(psx_svg_anim_item* it)
365365
{
@@ -484,7 +484,7 @@ static int32_t _anim_color_override_cmp(const void* a, const void* b)
484484

485485
#define INSERTION_SORT_THRESHOLD 16
486486

487-
/* ── Transform array sort (by target pointer) ── */
487+
/* -- Transform array sort (by target pointer) -- */
488488

489489
static int32_t _anim_transform_cmp(const void* a, const void* b)
490490
{
@@ -570,7 +570,7 @@ static INLINE void _anim_state_sort_overrides(psx_svg_anim_state* s)
570570
items[w] = items[r];
571571
}
572572
} else {
573-
/* same key overwrite w with r (last-writer-wins) */
573+
/* same key - overwrite w with r (last-writer-wins) */
574574
items[w] = items[r];
575575
}
576576
}
@@ -622,7 +622,7 @@ static INLINE void _anim_state_sort_color_overrides(psx_svg_anim_state* s)
622622
items[w] = items[r];
623623
}
624624
} else {
625-
/* same key overwrite w with r (last-writer-wins) */
625+
/* same key - overwrite w with r (last-writer-wins) */
626626
items[w] = items[r];
627627
}
628628
}
@@ -1110,7 +1110,7 @@ static INLINE bool _anim_is_active(const psx_svg_anim_item* it, float doc_t, uin
11101110
}
11111111

11121112
if (has_total && local >= total) {
1113-
/* Past active duration not active for callback purposes. */
1113+
/* Past active duration - not active for callback purposes. */
11141114
if (out_iteration) { *out_iteration = 0; }
11151115
return false;
11161116
}
@@ -1198,7 +1198,7 @@ static INLINE bool _anim_resolve_local_t(const psx_svg_anim_item* it, float doc_
11981198
}
11991199
raw_total = total;
12001200

1201-
// Apply min/max active duration constraints (SVG Tiny 1.2 §16.3.3).
1201+
// Apply min/max active duration constraints (SVG Tiny 1.2 SS16.3.3).
12021202
// min > max => both ignored.
12031203
if (has_total) {
12041204
float min_s = it->min_sec;
@@ -1323,7 +1323,7 @@ static INLINE uint32_t _anim_lerp_color(uint32_t c0, uint32_t c1, float t)
13231323
return ((uint32_t)ri << 16) | ((uint32_t)gi << 8) | (uint32_t)bi;
13241324
}
13251325

1326-
/* ── stroke-dasharray animation helpers ── */
1326+
/* -- stroke-dasharray animation helpers -- */
13271327

13281328
static INLINE void _anim_state_set_dash(psx_svg_anim_state* s, const psx_svg_node* target,
13291329
const float* dashes, uint32_t count)
@@ -1349,7 +1349,7 @@ static INLINE void _anim_state_set_dash(psx_svg_anim_state* s, const psx_svg_nod
13491349
}
13501350
}
13511351

1352-
/* Append new entry try to reuse ghost entry's dashes buffer. */
1352+
/* Append new entry - try to reuse ghost entry's dashes buffer. */
13531353
{
13541354
uint32_t idx = s->dash_overrides.size;
13551355
psx_array_append(&s->dash_overrides, NULL);
@@ -1363,7 +1363,7 @@ static INLINE void _anim_state_set_dash(psx_svg_anim_state* s, const psx_svg_nod
13631363
dst->count = count;
13641364

13651365
if (idx < s->dash_high_water && old_dashes) {
1366-
/* Ghost entry exists with a buffer check if reusable. */
1366+
/* Ghost entry exists with a buffer - check if reusable. */
13671367
if (old_count == count) {
13681368
/* Same size: reuse buffer, just overwrite values. */
13691369
dst->dashes = old_dashes;
@@ -1373,7 +1373,7 @@ static INLINE void _anim_state_set_dash(psx_svg_anim_state* s, const psx_svg_nod
13731373
dst->dashes = (float*)mem_malloc(count * sizeof(float));
13741374
}
13751375
} else {
1376-
/* No ghost or ghost had NULL dashes allocate fresh. */
1376+
/* No ghost or ghost had NULL dashes - allocate fresh. */
13771377
dst->dashes = (float*)mem_malloc(count * sizeof(float));
13781378
}
13791379

@@ -1400,7 +1400,7 @@ static INLINE uint32_t _attr_as_float_array(const psx_svg_attr* a, const float**
14001400
*out_data = (const float*)&list->data[0];
14011401
return list->length;
14021402
}
1403-
/* Single fval caller must use address of fval field. */
1403+
/* Single fval - caller must use address of fval field. */
14041404
*out_data = &a->value.fval;
14051405
return 1;
14061406
}
@@ -3137,7 +3137,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
31373137
cmd = ch;
31383138
pos++;
31393139
} else if (ch == 'Z' || ch == 'z') {
3140-
/* closePath add line segment back to most recent M point */
3140+
/* closePath - add line segment back to most recent M point */
31413141
pos++;
31423142
if (cur_x != start_x || cur_y != start_y) {
31433143
if (!_motion_path_push(out, start_x, start_y)) {
@@ -3152,20 +3152,20 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
31523152
cmd = 0;
31533153
continue;
31543154
} else if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
3155-
/* Unrecognized command skip it and continue */
3155+
/* Unrecognized command - skip it and continue */
31563156
cmd = 0;
31573157
pos++;
31583158
continue;
31593159
}
31603160
/* else: implicit repeat of previous command (number follows directly) */
31613161

31623162
if (cmd == 0) {
3163-
/* No active command and not a number start skip */
3163+
/* No active command and not a number start - skip */
31643164
if (!((ch >= '0' && ch <= '9') || ch == '-' || ch == '+' || ch == '.')) {
31653165
pos++;
31663166
continue;
31673167
}
3168-
/* Stray number with no command context skip it */
3168+
/* Stray number with no command context - skip it */
31693169
{
31703170
float dummy = 0.0f;
31713171
uint32_t npos = _motion_path_parse_float(path_str, pos, len, &dummy);
@@ -3178,7 +3178,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
31783178
continue;
31793179
}
31803180

3181-
/* H/h: horizontal lineTo parse one float (x), keep current y */
3181+
/* H/h: horizontal lineTo - parse one float (x), keep current y */
31823182
if (cmd == 'H' || cmd == 'h') {
31833183
pos = _motion_path_skip_ws(path_str, pos, len);
31843184
float x = 0.0f;
@@ -3203,7 +3203,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
32033203
continue;
32043204
}
32053205

3206-
/* V/v: vertical lineTo parse one float (y), keep current x */
3206+
/* V/v: vertical lineTo - parse one float (y), keep current x */
32073207
if (cmd == 'V' || cmd == 'v') {
32083208
pos = _motion_path_skip_ws(path_str, pos, len);
32093209
float y = 0.0f;
@@ -3228,7 +3228,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
32283228
continue;
32293229
}
32303230

3231-
/* Q/q: quadratic Bezier parse 4 floats (cx, cy, ex, ey) */
3231+
/* Q/q: quadratic Bezier - parse 4 floats (cx, cy, ex, ey) */
32323232
if (cmd == 'Q' || cmd == 'q') {
32333233
float cx = 0.0f, cy = 0.0f, ex = 0.0f, ey = 0.0f;
32343234
pos = _motion_path_skip_ws(path_str, pos, len);
@@ -3271,7 +3271,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
32713271
continue;
32723272
}
32733273

3274-
/* T/t: smooth quadratic Bezier parse 2 floats (ex, ey) */
3274+
/* T/t: smooth quadratic Bezier - parse 2 floats (ex, ey) */
32753275
if (cmd == 'T' || cmd == 't') {
32763276
float ex = 0.0f, ey = 0.0f;
32773277
pos = _motion_path_skip_ws(path_str, pos, len);
@@ -3312,7 +3312,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
33123312
continue;
33133313
}
33143314

3315-
/* C/c: cubic Bezier parse 6 floats (c1x, c1y, c2x, c2y, ex, ey) */
3315+
/* C/c: cubic Bezier - parse 6 floats (c1x, c1y, c2x, c2y, ex, ey) */
33163316
if (cmd == 'C' || cmd == 'c') {
33173317
float c1x = 0.0f, c1y = 0.0f, c2x = 0.0f, c2y = 0.0f, ex = 0.0f, ey = 0.0f;
33183318
pos = _motion_path_skip_ws(path_str, pos, len);
@@ -3367,7 +3367,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
33673367
continue;
33683368
}
33693369

3370-
/* S/s: smooth cubic Bezier parse 4 floats (c2x, c2y, ex, ey) */
3370+
/* S/s: smooth cubic Bezier - parse 4 floats (c2x, c2y, ex, ey) */
33713371
if (cmd == 'S' || cmd == 's') {
33723372
float c2x = 0.0f, c2y = 0.0f, ex = 0.0f, ey = 0.0f;
33733373
pos = _motion_path_skip_ws(path_str, pos, len);
@@ -3420,7 +3420,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
34203420
continue;
34213421
}
34223422

3423-
/* A/a: elliptical arc parse 7 params (rx, ry, rotation, large_arc, sweep, ex, ey) */
3423+
/* A/a: elliptical arc - parse 7 params (rx, ry, rotation, large_arc, sweep, ex, ey) */
34243424
if (cmd == 'A' || cmd == 'a') {
34253425
float arx = 0.0f, ary = 0.0f, xrot = 0.0f;
34263426
float fla = 0.0f, fsw = 0.0f;
@@ -3486,7 +3486,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
34863486
float y = 0.0f;
34873487
uint32_t npos = _motion_path_parse_float(path_str, pos, len, &x);
34883488
if (npos == pos) {
3489-
/* No number found command has no more coordinates */
3489+
/* No number found - command has no more coordinates */
34903490
cmd = 0;
34913491
continue;
34923492
}
@@ -3495,7 +3495,7 @@ static bool _motion_path_parse(const char* path_str, uint32_t len,
34953495
pos = _motion_path_skip_ws(path_str, pos, len);
34963496
npos = _motion_path_parse_float(path_str, pos, len, &y);
34973497
if (npos == pos) {
3498-
/* Only one number malformed, skip */
3498+
/* Only one number - malformed, skip */
34993499
cmd = 0;
35003500
continue;
35013501
}
@@ -3629,7 +3629,7 @@ static void _motion_arc_position(const _motion_path_points* pts,
36293629
return;
36303630
}
36313631

3632-
/* Single point or zero total length return first point */
3632+
/* Single point or zero total length -> return first point */
36333633
if (pts->count == 1 || tbl->total_length <= 0.0f) {
36343634
*out_x = pts->xy[0];
36353635
*out_y = pts->xy[1];
@@ -4109,7 +4109,7 @@ static void _collect_anims(psx_svg_player* p, const psx_svg_node* node)
41094109

41104110
/* Pre-compute max active end time for fast culling */
41114111
{
4112-
/* If event-based begin, we can't predict use safe fallback */
4112+
/* If event-based begin, we can't predict - use safe fallback */
41134113
if (item.begin_event || item.syncbase_ref_id) {
41144114
item.max_active_end_sec = 1e30f;
41154115
} else {
@@ -4160,7 +4160,7 @@ static void _collect_anims(psx_svg_player* p, const psx_svg_node* node)
41604160
}
41614161

41624162
/*
4163-
* Syncbase dependency resolution uses sorted ID lookup table
4163+
* Syncbase dependency resolution - uses sorted ID lookup table
41644164
* for O(log n) binary search instead of O(n) strcmp scan.
41654165
*/
41664166
typedef struct {
@@ -4282,7 +4282,7 @@ static void _resolve_syncbase_deps(psx_svg_player* p)
42824282
continue;
42834283
}
42844284

4285-
// Find the referenced animation by id O(log n) binary search
4285+
// Find the referenced animation by id - O(log n) binary search
42864286
const psx_svg_anim_item* ref = _find_anim_by_id(p, id_table, table_count, it->syncbase_ref_id);
42874287

42884288
if (!ref) {
@@ -4293,12 +4293,12 @@ static void _resolve_syncbase_deps(psx_svg_player* p)
42934293

42944294
// Check if ref itself has an unresolved syncbase dependency
42954295
if (ref->syncbase_ref_id && !ref->syncbase_resolved && !ref->syncbase_circular) {
4296-
// Ref not yet resolved try again in next pass
4296+
// Ref not yet resolved - try again in next pass
42974297
continue;
42984298
}
42994299

43004300
if (ref->syncbase_circular) {
4301-
// Ref is circular we are too
4301+
// Ref is circular - we are too
43024302
it->syncbase_circular = true;
43034303
continue;
43044304
}
@@ -4333,7 +4333,7 @@ static void _resolve_syncbase_deps(psx_svg_player* p)
43334333
}
43344334

43354335
if (!any_resolved) {
4336-
break; // No progress remaining are circular
4336+
break; // No progress - remaining are circular
43374337
}
43384338
}
43394339

@@ -4657,12 +4657,12 @@ static void _anim_fire_callbacks(psx_svg_player* p)
46574657
const char* anim_id = it->anim_node ? it->anim_node->content(NULL) : NULL;
46584658

46594659
if (active && !it->was_active) {
4660-
/* Transition inactive active: fire BEGIN. */
4660+
/* Transition inactive -> active: fire BEGIN. */
46614661
p->cb(PSX_SVG_ANIM_EVENT_BEGIN, anim_id, p->cb_user);
46624662
}
46634663

46644664
if (!active && it->was_active) {
4665-
/* Transition active inactive: fire END. */
4665+
/* Transition active -> inactive: fire END. */
46664666
p->cb(PSX_SVG_ANIM_EVENT_END, anim_id, p->cb_user);
46674667
}
46684668

@@ -4786,19 +4786,19 @@ static void _apply_animations_at_time(psx_svg_player* p)
47864786

47874787
if (!(it->tag == SVG_TAG_ANIMATE || it->tag == SVG_TAG_SET || it->tag == SVG_TAG_ANIMATE_COLOR
47884788
|| it->tag == SVG_TAG_ANIMATE_TRANSFORM || it->tag == SVG_TAG_ANIMATE_MOTION)) {
4789-
/* Unsupported tag not evaluated. */
4789+
/* Unsupported tag - not evaluated. */
47904790
it->eval_active = false;
47914791
it->eval_iteration = 0;
47924792
continue;
47934793
}
47944794
if (!_is_supported_anim_attr(it->target_attr)) {
4795-
/* Unsupported attr not evaluated. */
4795+
/* Unsupported attr - not evaluated. */
47964796
it->eval_active = false;
47974797
it->eval_iteration = 0;
47984798
continue;
47994799
}
48004800

4801-
/* Fast cull skip animations past their active window (fill=remove only) */
4801+
/* Fast cull - skip animations past their active window (fill=remove only) */
48024802
if (it->fill_mode != SVG_ANIMATION_FREEZE && p->time_sec > it->max_active_end_sec) {
48034803
it->eval_active = false;
48044804
it->eval_iteration = 0;
@@ -5015,7 +5015,7 @@ void PICAPI psx_svg_player_trigger(psx_svg_player* p, const char* target_id, con
50155015
}
50165016
} else if (filter_id) {
50175017
// Backward compatible: no id prefix in begin token, but caller
5018-
// supplied a target_id match against target/anim node ids.
5018+
// supplied a target_id - match against target/anim node ids.
50195019
const char* tid = it->target_node ? it->target_node->content(NULL) : NULL;
50205020
const char* aid = it->anim_node ? it->anim_node->content(NULL) : NULL;
50215021
if ((!tid || strcmp(tid, filter_id) != 0) && (!aid || strcmp(aid, filter_id) != 0)) {
@@ -5044,7 +5044,7 @@ void PICAPI psx_svg_player_trigger(psx_svg_player* p, const char* target_id, con
50445044
any = true;
50455045
}
50465046

5047-
// Pass 2: match end events only if animation is currently active.
5047+
// Pass 2: match end events - only if animation is currently active.
50485048
for (uint32_t i = 0; i < n; i++) {
50495049
psx_svg_anim_item* it = psx_array_get(&p->anims, i, psx_svg_anim_item);
50505050
if (!it || !it->end_event) {

0 commit comments

Comments
 (0)