feat(sdk/view): 视图框架批次① — z序绘制物注册表(meow_ui_draw.c: 自动注册+auto_z(深度*步长+层内seq)+set_z(999)置顶+MEOW_Z_AUTO_MAX=127) + meow_view骨架(meow_ui_view.c/.h: 嵌套容器+六生命周期+page_push/pop/replace包装activity栈+sub_push/pop预留桩) + 收敛live_btn走invalidate + hello迁移(d_paint_region/d_redraw删除→meow_ui_invalidate, chrome set_z(999), demo文本注册CUSTOM z=128) (agent-176, 定案见SDK_VIEW_FRAMEWORK_DESIGN.md §E①)

meow_ui.a d814d0ed→7e20f10e; hello 0a1c96a5→2ce09466
宿主验证: test_p1p2p3_repro P1c/P2/P3 ALL PASS; test_meow_ui_widgets ALL PASS 无回归; mipsel -Wall -Wextra 0 warning
This commit is contained in:
MeowOS committed 2026-08-31 02:38:32 +08:00
1 parent fbc412e96a
commit 08c70aa14c
13 files changed
+872 -96

No files matched your search

+19 -15
View File
@@ -18,12 +18,13 @@
* -o test_p1p2p3_repro test_p1p2p3_repro.c test_host_stub.c \
* meow_ui_gfx.c meow_ui_sys.c meow_ui_theme.c meow_ui_vol.c meow_ui_log.c \
* meow_ui_widget.c meow_ui_input.c meow_ui_activity.c meow_ui_dialog.c meow_ui_ime.c \
* meow_ui_img.c meow_ui_config.c meow_ui_notify.c meow_notify_ipc.c stb_image.c \
* meow_ui_img.c meow_ui_config.c meow_ui_notify.c meow_notify_ipc.c meow_ui_draw.c \
* meow_ui_view.c stb_image.c \
* -I. -I../hello_app -I../meow_launcherd -pthread -lm
* 运行:MEOW_UI_DUMP=/tmp/repro.ppm ./test_p1p2p3_repro (optional,dump 最终屏幕)
*
* 修复前(无 P1/P2/P3 修法)预期输出:RESULT: 4 FAIL(S);
* 修复后:RESULT: ALL PASS。
* 覆盖(批次① z 序下沉后):P1c 显式 z 置顶(set_z(g_fab,999)+invalidate(r_prc) 不抹 FAB——
* 显式 z 不依赖绘制先后)+ P2/P3 与迁移前一致。预期 RESULT: ALL PASS。
*/
#include "meow_ui.h"
#include "meow_ui_internal.h"
@@ -74,13 +75,15 @@ int main(void)
int fails = 0;
/* ================= P1:局部重绘不盖浮层(FAB) =================
* 场景:scroll=0 时圆形进度(413..453,605..645) 与 FAB(406..462,616..672) 重叠。
* demo_paint 先画内容后画 chrome → 场景正确 FAB 在上。随后「局部重绘进度条」:
/* ================= P1 / P1c:局部重绘不盖浮层(FAB,须显式置顶) =================
* 场景:scroll=0 时圆形进度 r_prc(413..453,605..645) 与 FAB(406..462,616..672) 重叠。
* demo_paint 整帧后 FAB 在上(demo_init set_z(g_fab,999) 显式置顶)。随后「局部重绘进度条」:
* 旧(清底+只画进度条+flush 其矩形)→ FAB 重叠区被清掉;
* 新(清底+重画重叠区内所有控件=hello d_redraw/d_paint_region)→ FAB 保持。 */
* 新(SDK meow_ui_invalidate:清底 + 按 z 重画重叠区完整 z 栈)→ FAB 保持。
* P1c:set_z(g_fab,999) 后 invalidate(r_prc),断言 FAB 重叠点(434,622) 仍=demo_paint 后值
* (显式 z 不依赖绘制先后——置顶在重绘前显式给出,下层重绘不抹上层)。 */
demo_paint();
int fx = r_fab.x + 28, fy = r_fab.y + 6; /* FAB 内、远离 "+" 文本处 */
int fx = r_fab.x + 28, fy = r_fab.y + 6; /* FAB 内、远离 "+" 文本处 → (434,622) */
int s0r, s0g, s0b; rd_px(fx, fy, &s0r, &s0g, &s0b);
printf("P1 scene (demo_paint) FAB-overlap "); pr_px("scene", fx, fy);
if (is_bg(s0r, s0g, s0b))
@@ -98,15 +101,16 @@ int main(void)
if (is_bg(obr, obg, obb)) printf(" [BUG-CONFIRMED] old path erased FAB overlap (bg)\n");
else printf(" [note] old path did NOT erase FAB here (color %02X%02X%02X)\n", obr, obg, obb);
/* 新式局部重绘(真实 hello d_redraw → d_paint_region,重画重叠栈)*/
/* P1c:显式置顶 + SDK 局部重画(invalidate 按 z 重画重叠栈) */
demo_paint(); /* 还原场景 */
meow_widget_set_z(g_fab, 999); /* 重新显式置顶(P1c 要求) */
meow_progress_set(g_dprc, 30);
d_redraw(g_dprc, r_prc); /* hello 的局部重绘入口 */
meow_ui_invalidate(r_prc.x, r_prc.y, r_prc.w, r_prc.h);
int nbr, nbg, nbb; rd_px(fx, fy, &nbr, &nbg, &nbb);
printf("P1 new-partial (d_redraw stack) "); pr_px("new", fx, fy);
printf("P1c set_z(999)+invalidate(r_prc) "); pr_px("p1c", fx, fy);
if (near(s0r, nbr) && near(s0g, nbg) && near(s0b, nbb))
printf(" P1-PASS FAB preserved over live progress redraw\n");
else { printf(" P1-FAIL FAB not preserved (scene %02X%02X%02X vs new %02X%02X%02X)\n",
printf(" P1-PASS explicit z:FAB preserved over live progress redraw\n");
else { printf(" P1-FAIL FAB not preserved (scene %02X%02X%02X vs p1c %02X%02X%02X)\n",
s0r, s0g, s0b, nbr, nbg, nbb); fails++; }
/* ================= P2:列表焦点按本次触摸绑定/释放 =================
@@ -128,7 +132,7 @@ int main(void)
printf("P3 list rect = (%d,%d,%d,%d)\n", r_list.x, r_list.y, r_list.w, r_list.h);
/* 顶部泄漏:选中行0 + scroll=20 → 行0 ry=top-20,填充越顶泄漏 */
meow_list_set_selected(g_dlc, 0); meow_list_set_scroll(g_dlc, 20);
d_redraw(g_dlc, r_list);
meow_ui_invalidate(r_list.x, r_list.y, r_list.w, r_list.h);
int ux = r_list.x + 10, uy = r_list.y - 5; /* 列表顶上方 5px(标题间隙) */
int ur, ug, ub; rd_px(ux, uy, &ur, &ug, &ub);
printf("P3 top-leak "); pr_px("above-top", ux, uy);
@@ -136,7 +140,7 @@ int main(void)
else { printf(" P3-top-FAIL leaked into title gap\n"); fails++; }
/* 底部泄漏:选中行4 + scroll=20 → 行4 ry=590..630 越底泄漏 */
meow_list_set_selected(g_dlc, 4); meow_list_set_scroll(g_dlc, 20);
d_redraw(g_dlc, r_list);
meow_ui_invalidate(r_list.x, r_list.y, r_list.w, r_list.h);
int dx = r_list.x + 10, dy_ = r_list.y + r_list.h + 5; /* 列表底下方 5px */
int dr, dg, db; rd_px(dx, dy_, &dr, &dg, &db);
printf("P3 bot-leak "); pr_px("below-bottom", dx, dy_);