状态栏正确闭环(agent-142): 系统进程统一渲染+App不画+覆盖叠加+数据唯一+MD3图标式+主题换图标

- meow_ui_sys_set_system_mode: launcher置1才渲染, App默认0→不画状态栏; app_overlay_statusbar在launch_app循环~1s叠加28px顶条(不SIGSTOP App)
- 数据源唯一(launcher g_sys→meow_ui_sys_feed; wifi_level/batt/vol/bri/clock), 根治"launcher有亮度App没有"
- 右侧=MD3图标+变量值(statusbar_right_str文本退役→图标簇, 复用sb_icons.h/MEOW_SB_ICON_*/meow_gfx_blit_icon); 颜色随meow_theme
- ui.style换图标集(meow_ui_style/set_style读ui.style md3/miuix, MIUIx暂MD3占位)
- hello最小改动(redraw非全屏只清inset=28之下, 不冲系统顶条); 开放点: App不SIGSTOP/inset28/MIUIx占位/set_statusbar系统模式门
- meow_ui.a=3da5af7b launcher=a2b1c096 hello=67075741 0warning; 宿主test_sb_statusbar ALL PASS + render PPM目检(左时钟右亮度/WiFi/蓝牙/音量/电量)
- 遗留: 真机验证(无双画/数据一致/顶条叠加/inset/ui.style); 运行时fullscreen沉浸叠画待M3; MIUIx图标占位
This commit is contained in:
MeowOS committed 2026-08-30 19:32:40 +08:00
1 parent 2a6c4e97c5
commit 7300fc0a13
14 files changed
+731 -44

No files matched your search

+62 -1
View File
@@ -11,6 +11,7 @@
#include "meow_ui.h"
#include "meow_ui_internal.h"
#include "meow_ui_sys.h"
#include "sb_icons.h"
#include "../meow_launcherd/meow_font.h"
#include <stdio.h>
@@ -181,6 +182,66 @@ void meow_gfx_mark_full(void) { dirty_full(); }
* 从而 launcher 与 app 统一渲染栈(同一离屏 + 同一 present)。 */
unsigned char *meow_ui_back_buf(void) { return g_back_buf; }
/* ================= 状态栏 MD3 图标 blit(写进本 SDK back_buf) =================
* 复用 launcher sb_icons.h(Material Symbols rounded,32x32 单通道 alpha)作为状态栏
* 右侧图标簇(「同一个状态栏」图标式,见 meow_ui_sys_statusbar_render)。
* idx = sb_icons[] 索引(SB_I_*,见 meow_ui_internal.h)
* x = 图标槽左缘(槽宽 SB_ICON_SIZE=32)
* y = 图标槽顶(仅作参考;实际按 ink 垂直中心对齐 cy)
* ink_h = 目标 ink 高(>0 等比缩放;0 = 保持位图自然 ink 尺寸——WiFi 强弱档用)
* fg = 24-bit RGB 前景(主题 on_surface / on_surface_variant,日/夜由主题表提供)
* cy = ink 垂直中心线(= 状态栏文字中心,28px 栏约 14)
* 先求位图 ink 边界(阈值 32,忽略近透明抗锯齿),按 ink 在槽内水平居中、垂直中心对齐 cy;
* 像素按 alpha 软边混合进 back_buf(自 g_fb/g_line/g_xres/g_yres,与 launcher sb_blit_icon 同源算法)。 */
void meow_gfx_blit_icon(int idx, int x, int y, int ink_h, uint32_t fg, int cy)
{
(void)y;
if (!g_init_ok || !g_fb) return;
if (idx < 0 || idx >= (int)(sizeof sb_icons / sizeof sb_icons[0])) return;
const unsigned char *src = sb_icons[idx].data;
uint16_t col = rgb565(fg);
/* 1) ink 边界(含空图兜底) */
int minx = SB_ICON_SIZE, miny = SB_ICON_SIZE, maxx = -1, maxy = -1;
for (int i = 0; i < SB_ICON_SIZE * SB_ICON_SIZE; i++) {
if (src[i] >= 32) {
int xx = i % SB_ICON_SIZE, yy = i / SB_ICON_SIZE;
if (xx < minx) minx = xx; if (xx > maxx) maxx = xx;
if (yy < miny) miny = yy; if (yy > maxy) maxy = yy;
}
}
if (maxx < minx || maxy < miny) { minx = miny = 0; maxx = maxy = SB_ICON_SIZE - 1; }
int ink_w = maxx - minx + 1, ink_h_n = maxy - miny + 1;
int t_h = (ink_h > 0) ? ink_h : ink_h_n;
int t_w = ink_w * t_h / ink_h_n; if (t_w < 1) t_w = 1;
if (t_w > SB_ICON_SIZE * 2) t_w = SB_ICON_SIZE * 2; /* 防御:等比极端上限 */
/* 2) 目标框左上:水平居中于 32px 槽;垂直中心 = cy */
int x0 = x + (SB_ICON_SIZE - t_w) / 2;
int y0 = cy - t_h / 2;
/* 3) 最近邻采样映射:目标 (dx,dy) ← 源 ink */
for (int dy = 0; dy < t_h; dy++) {
int ty = y0 + dy;
if (ty < 0 || ty >= g_yres) continue;
int sy = miny + (dy * ink_h_n) / t_h;
uint16_t *row = (uint16_t *)(g_fb + (size_t)ty * g_line);
for (int dx = 0; dx < t_w; dx++) {
int tx = x0 + dx;
if (tx < 0 || tx >= g_xres) continue;
int sx = minx + (dx * ink_w) / t_w;
int a = src[sy * SB_ICON_SIZE + sx];
if (a < 8) continue; /* 透明像素跳过 */
uint16_t bg = row[tx];
if (a >= 240) { row[tx] = col; continue; }
int a4 = a >> 4; /* 0..15 */
int r = ((col >> 11) * a4 + ((bg >> 11) & 0x1F) * (16 - a4)) >> 4;
int g = (((col >> 5) & 0x3F) * a4 + ((bg >> 5) & 0x3F) * (16 - a4)) >> 4;
int b = ((col & 0x1F) * a4 + (bg & 0x1F) * (16 - a4)) >> 4;
row[tx] = (uint16_t)((r << 11) | (g << 5) | b);
}
}
/* 整条顶栏作为脏区标出(图标在顶条内,present 只重画顶条即可) */
dirty_add(x, 0, SB_ICON_SIZE, MUI_SBAR_H);
}
/* ================= 像素写入 ================= */
static void px_write_rgb565(int x, int y, uint16_t c16)
{
@@ -663,7 +724,7 @@ static void present(void)
* 顶条被 app 内容触及 / 上收动画未到位(逐帧推进)。展开态仍走
* meow_ui_sys_statusbar_render()(meow_ui_sys.c 不改,留给后续代理);
* 上收折叠态(collapse_h>=MUI_SBAR_H)由基座只画提示线(内容上移出屏)。 */
if (meow_ui_sys_statusbar_active() &&
if (meow_ui_sys_render_enabled() && meow_ui_sys_statusbar_active() &&
(meow_ui_sys_statusbar_force() || statusbar_touched() ||
statusbar_collapse_in_transition())) {
statusbar_collapse_step();