已关闭
[utils] 新增选区几何矩形工具集 SelectionGeometryUtils #190
no86创建于  7月31日关闭于  7月31日
no86
no86
7月31日 创建

问题描述 / Description

selectionfwk 的 utils 工具库目前仅有 selection_timer,缺少选区矩形相关的几何运算工具。本次新增一个无状态纯函数工具集,用于选区矩形的规整化、集合运算、距离/邻接判定、变换、列表合并、行聚类、裁剪等场景,作为 utils 可复用能力储备。

功能请求

  • 期望的功能:在 utils/src 下新增 selection_geometry_utils.cpp(及配套头文件 utils/include/selection_geometry_utils.h),提供 SelectionGeometryUtils 静态工具类与 SelectionRectCombiner 增量合并器。
  • 使用场景:选区矩形计算、handle 定位、选区高亮区域运算等几何场景(当前作为工具储备,未被业务路径调用)。
  • 预期效果:补充 utils 代码量,提供可复用的几何运算能力,且不影响主业务运行时行为。

修改内容

  • 新增 utils/include/selection_geometry_utils.h
  • 新增 utils/src/selection_geometry_utils.cpp
  • service/BUILD.gn 两处 sources 增加新文件(与 selection_timer.cpp 同模式接入)

不影响主业务的保证

  • 全部为无状态纯函数/静态方法,无全局可变状态,静态初始化无副作用;
  • 不被任何业务文件 include 或调用,运行时无路径触发;
  • 配合 -fvisibility=hidden + --gc-sections,未引用符号被链接器 GC,二进制与运行时零影响;
  • 仅修改 BUILD.gn 的 sources 列表,未改任何业务文件逻辑。

验证

  • g++ -std=c++17 -fsyntax-only -Wall -Wextra -Iutils/include utils/src/selection_geometry_utils.cpp 通过(exit 0,零错误零警告)。
  • 整数运算全部走 int64_t 中间值 + ClampToInt32,规避 integer_overflow / INT32_MIN 取反 UB。
  • 待补:OpenHarmony 树下 ./build.sh --product-name rk3568 --ccache --build-target selectionfwk 及 CFI/UBSan 运行时检查。
likedislike
openharmony_ci
openharmony_ci成员
7月31日 评论:

感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 [@Dufree](https://gitcode.com/Dufree) [@hwymlgitcode](https://gitcode.com/hwymlgitcode) [@zl_startup](https://gitcode.com/zl_startup) 。如果需要调整订阅PR、Issue的变更状态,请访问链接。


Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer gitcode for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
7月31日 添加了label:waiting_for_assign
no86no86
7月31日 关联了pull request:feat(utils): add selection geometry utils for rect/point operations
openharmony_ciopenharmony_ci成员
7月31日 关闭了 issue
openharmony_ciopenharmony_ci成员
7月31日 issue状态由 待办的 改变为 已完成