fix(lyric): 全局播放页进度条/按钮带局部重绘回退默认色修复 — 取色主题抽共用(np_grad_row/np_page_bg_row/np_theme_widgets),1s局部重绘也接取色(带底色渐变/进度条fill=accent/track=fg_dim/四钮accent);SDK W_PROGRESS改读opts.bg/fg向后兼容;宿主R1-R3 PASS,0warning;需重编meow_ui.a+四App重链
This commit is contained in:
1 parent
8971f6067b
commit
a82f3f9dfa
5 files changed
+180
-30
No files matched your search
@@ -2069,31 +2069,35 @@ void meow_widget_draw(meow_widget *w)
|
||||
break;
|
||||
}
|
||||
case W_PROGRESS: {
|
||||
/* 批5b:轨道/填充可由 opts 覆盖(opts.bg=轨道、opts.fg=填充);opts 未设则回主题默认
|
||||
* (surfaceVariant/primary)——兼容既有调用(如 hello demo、现在播放页取色后回退默认)。 */
|
||||
uint32_t track = widget_bg(w, th, th->surfaceVariant);
|
||||
uint32_t fill = widget_fg(w, th, th->primary);
|
||||
if (w->variant == 1) { /* 圆形(几何 = 整圆像素外接框;由此解回圆心/半径) */
|
||||
int thk = MEOW_PROGRESS_ARC_THK;
|
||||
int m = MEOW_PROGRESS_ARC_MARGIN;
|
||||
int ccx = w->x + w->w / 2, ccy = w->y + w->h / 2;
|
||||
int rr = w->w / 2 - m; /* 与 create 一致:回到调用方传入的半径 r */
|
||||
if (rr <= 0) break;
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, 0, 360, th->surfaceVariant);
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, 0, 360, track);
|
||||
if (w->value < 0) { /* 不定:按时间推进一段弧(App 在 on_tick 里重绘驱动) */
|
||||
int start = (int)((meow_ui_time_ms() / 30) % 360);
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, start - 90, 90, th->primary);
|
||||
meow_gfx_ring_arc(ccx, ccy, rr, thk, start - 90, 90, fill);
|
||||
} else if (w->value > 0) {
|
||||
int sweep = w->value * 360 / 100;
|
||||
if (sweep > 0) meow_gfx_ring_arc(ccx, ccy, rr, thk, -90, sweep, th->primary);
|
||||
if (sweep > 0) meow_gfx_ring_arc(ccx, ccy, rr, thk, -90, sweep, fill);
|
||||
}
|
||||
} else { /* 线性 */
|
||||
int thk = w->h > 0 ? w->h : 4;
|
||||
int yy = w->y + w->h / 2 - thk / 2;
|
||||
meow_ui_fill_rect(w->x, yy, w->w, thk, th->surfaceVariant);
|
||||
meow_ui_fill_rect(w->x, yy, w->w, thk, track);
|
||||
if (w->value < 0) { /* 不定:移动块 */
|
||||
int fw = w->w / 3;
|
||||
int pos = (int)((meow_ui_time_ms() / 12) % (w->w + fw)) - fw;
|
||||
meow_ui_fill_rect(w->x + pos, yy, fw, thk, th->primary);
|
||||
meow_ui_fill_rect(w->x + pos, yy, fw, thk, fill);
|
||||
} else if (w->value > 0) {
|
||||
int fw = w->value * w->w / 100;
|
||||
if (fw > 0) meow_ui_fill_rect(w->x, yy, fw, thk, th->primary);
|
||||
if (fw > 0) meow_ui_fill_rect(w->x, yy, fw, thk, fill);
|
||||
}
|
||||
}
|
||||
if (disabled) meow_ui_fill_rect_alpha(w->x, w->y, w->w, w->h, th->onSurface, 90);
|
||||
|
||||
Reference in new issue
Block a user