Repository navigation
fix(shot): align image border with rounded alpha outline - #951
Conversation
Draw shadow and border from alpha contour for rounded screenshots. 圆角截图按透明轮廓绘制投影和描边,避免出现直角阴影与边框。 Log: 修复圆角截图投影与描边 PMS: TASK-393987 Influence: 圆角截图的投影和保存边框与圆角轮廓保持一致。
Add a bottom-left hint panel that describes moving the pointer or the capture area by one pixel with W/A/S/D, arrow keys and Ctrl/Shift. 在截图界面左下角新增像素级微调快捷键提示:未框选时提示移动鼠标指针, 框选完成后提示移动/扩大/缩小选区,固定比例时扩大/缩小两行置灰, 面板与光标或选区重叠时自动隐藏。 Log: 新增截图像素级微调快捷键提示面板 PMS: TASK-393987 Influence: 截图界面左下角常驻快捷键提示,帮助用户发现像素级微调能力; 固定比例激活时扩大/缩小快捷键置灰不可用。
Use Alt+A for AI screenshot so that the A key is free to move the cursor and the capture area left by one pixel, and update tooltips. AI截图快捷键由 A 改为 Alt+A,释放 A 键用于像素级向左微调, 并同步更新截图工具栏与滚动截图工具栏的 tooltip。 Log: AI截图快捷键改为Alt+A PMS: TASK-393987 Influence: 截图模式下按 Alt+A 触发AI截图;AI截图按钮 tooltip 显示为 "AI截图 (Alt+A)";A 键恢复为像素级向左微调。
|
Sorry @dengzhongyuan365-dev, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 2 days and 23 hours by commenting |
Reviewer's GuideThe PR fixes rounded screenshot output by deriving shadows and borders from alpha contours, while also adding a context-aware pixel-adjustment shortcut overlay and changing the AI screenshot shortcut to Alt+A. Sequence diagram for alpha-contour screenshot renderingsequenceDiagram
participant Caller
participant ShadowBorderProcess
participant QPainter
Caller->>ShadowBorderProcess: getPixmapAddBorder(pix)
ShadowBorderProcess->>ShadowBorderProcess: detect alpha transparency
alt rounded or transparent screenshot
ShadowBorderProcess->>ShadowBorderProcess: drawShadow(painter, rect, color, radius, shapeImage, shaped)
ShadowBorderProcess->>QPainter: draw shadow from alpha silhouette
ShadowBorderProcess->>ShadowBorderProcess: drawShapeBorder(painter, imageRect, color, shapeImage)
ShadowBorderProcess->>QPainter: fill alpha-contour border ring
else opaque screenshot
ShadowBorderProcess->>ShadowBorderProcess: drawShadow(painter, rect, color, radius, shapeImage, shaped)
ShadowBorderProcess->>QPainter: draw rectangular shadow and border
end
ShadowBorderProcess-->>Caller: bordered pixmap with matching outline
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 将 letterKeys 数组提升为类级别 static const 成员;reinterpret_cast 处添加格式断言确保安全性 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 考虑将 Sketch 设计尺寸提取为配置文件或常量类;移除重复的 qCWarning 日志行 3. 代码性能 ✅评价: 良好 ✅ 通过 潜在问题:
建议: drawShapeBorder 可考虑使用 QImage 的形态学操作替代 QRegion 膨胀;updateFineAdjustTips 可增加脏标记避免重复布局计算 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无安全漏洞,代码不涉及用户输入处理、网络通信、文件路径操作等安全敏感场景。建议保持现有的防御性编程实践。 💡 改进建议代码示例// 优化1: drawShapeBorder 使用 QImage 形态学操作替代 QRegion
void ShadowBorderProcess::drawShapeBorder(QPainter *p, const QRect &imageRect,
const QColor &color, const QImage &source)
{
if (source.isNull()) return;
// 使用 QImage 膨胀替代 QRegion,性能更优
QImage mask = source.createAlphaMask(Qt::ThresholdDither).toImage();
QImage dilated = mask.copy();
// 3x3 膨胀 - 使用 QImage 像素操作
for (int y = 0; y < mask.height(); ++y) {
for (int x = 0; x < mask.width(); ++x) {
if (mask.pixelIndex(x, y)) {
for (int dy = -1; dy <= 1; ++dy)
for (int dx = -1; dx <= 1; ++dx) {
int nx = qBound(0, x+dx, mask.width()-1);
int ny2 = qBound(0, y+dy, mask.height()-1);
dilated.setPixel(nx, ny2, 1);
}
}
}
}
// ring = dilated - mask
// ... fill ring with border color
}
// 优化2: updateFineAdjustTips 增加脏标记
void MainWindow::updateFineAdjustTips()
{
if (m_fineAdjustTips == nullptr) return;
// 缓存上次状态,避免不必要的布局计算
static bool lastVisible = false;
static Mode lastMode = FineAdjustTips::CursorMode;
// ... 仅在状态变化时调用 dockToBottomLeft
}本报告由 AI 代码审查工具自动生成 |
Redesign the magnifier to match the Sketch spec and expose cursor color data. 按设计稿重做像素放大镜浮窗,并支持读取光标像素色值。 Log: 新增像素放大镜及取色浮窗 PMS: TASK-393987 Influence: 选区调整时显示符合设计稿的放大镜,为复制色值提供基础能力。
Display the pixel magnifier during selection and border resizing. 在框选和调整选区边框时显示像素放大镜,调整结束后隐藏。 Log: 优化放大镜显示时机与位置 PMS: TASK-393987 Influence: 放大镜跟随光标显示,避免浮窗超出屏幕,并在选区确认后自动隐藏。
Allow mouse and Ctrl shortcuts to resize the capture area after annotations start. 标注模式下支持鼠标和快捷键调整截图选区大小,并保持已有标注位置不变。 Log: 支持标注模式下调整截图选区 PMS: TASK-393987 Influence: 用户进入标注后可继续调整选区,已有标注保持屏幕绝对位置。
Copy the current magnifier pixel color as HEX and exit the capture flow. 放大镜显示时按 Ctrl+C 复制当前像素色值并退出截图。 Log: 支持快捷键复制像素色值 PMS: TASK-393987 Influence: 用户可直接复制带 # 的小写 HEX 色值,复制成功后退出截图。
Reset stale resize/rotate state, restore painter state in sequence painting, and stop the selection border from stealing drag events. 修复序号标注:绘制序号会污染后续图形的画笔状态导致其它标注被填充、 复用上一个图形的缩放态导致选中拖动跳变,以及拖动时选区边框抢鼠标 事件导致标注只在起点和终点显示。 Log: 修复序号标注绘制与拖动异常 PMS: TASK-393987 Influence: 序号标注不再影响其它标注的填充样式;选中序号后可连续跟手 拖动,位置不再跳变。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
1 similar comment
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Draw shadow and border from alpha contour for rounded screenshots.
圆角截图按透明轮廓绘制投影和描边,避免出现直角阴影与边框。
Log: 修复圆角截图投影与描边
PMS: TASK-393987
Influence: 圆角截图的投影和保存边框与圆角轮廓保持一致。
Summary by Sourcery
Align rounded screenshot effects with their alpha contours while improving screenshot selection adjustment, magnifier tooling, and annotation-mode interactions.
New Features:
Bug Fixes:
Enhancements:
Build: