Skip to content

Fix Qt GPUDrawable surface not updating on resize and improve PAGX code quality#3386

Merged
shlzxjp merged 14 commits intomainfrom
bugfix/markffan_qt_surface
Apr 29, 2026
Merged

Fix Qt GPUDrawable surface not updating on resize and improve PAGX code quality#3386
shlzxjp merged 14 commits intomainfrom
bugfix/markffan_qt_surface

Conversation

@CodeJhF
Copy link
Copy Markdown
Collaborator

@CodeJhF CodeJhF commented Apr 16, 2026

修复 Qt 平台 GPUDrawable 在显示区域尺寸变化时 surface 没有同步更新的问题,并改进 PAGX 相关代码质量。

问题原因

在 PR #3344 适配 tgfx Window 接口迁移时,updateSize() 更新了 _width/_height,但没有清除缓存的 surface。导致渲染时使用旧尺寸的 surface,而缩放计算基于新尺寸,造成内容变形(如正方形变成长方形)。

修复方案

  1. 修复 surface 更新问题:将 freeSurface() 调用从 Qt GPUDrawable::updateSize() 移至 PAGXRenderer::updateSize(),与 PAGSurface::updateSize() 保持相同的调用契约(先 freeSurface()updateSize()),确保跨平台行为一致。

  2. 改进命名清晰度:将 pagxContentLayer 重命名为 pagxRootLayer,因为它实际存储的是一个变换容器层(其子节点才是 LayerBuilder 构建的真正内容层),并添加注释说明其用途。

其他变更

  • 更新 tgfx 依赖版本以修复 viewer crash 问题
  • 补充上一个 PR 遗漏的翻译文件

@CodeJhF CodeJhF force-pushed the bugfix/markffan_qt_surface branch from ca5851c to 8a4cb68 Compare April 17, 2026 02:52
@CodeJhF CodeJhF force-pushed the bugfix/markffan_qt_surface branch from c50fdd9 to 2dc5cc7 Compare April 17, 2026 07:18
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.41%. Comparing base (96a6e0a) to head (6e5fbf8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3386      +/-   ##
==========================================
- Coverage   78.41%   78.41%   -0.01%     
==========================================
  Files         532      532              
  Lines       41448    41448              
  Branches    12486    12486              
==========================================
- Hits        32502    32501       -1     
+ Misses       6391     6389       -2     
- Partials     2555     2558       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread test/baseline/version.json Outdated
Comment thread viewer/assets/translation/Chinese.ts
Comment thread src/platform/qt/GPUDrawable.cpp Outdated
Comment thread src/platform/qt/GPUDrawable.cpp Outdated
Comment thread viewer/src/rendering/pagx/PAGXViewModel.cpp Outdated
Comment thread viewer/src/rendering/pagx/PAGXViewModel.cpp Outdated
Comment thread src/platform/qt/GPUDrawable.cpp Outdated
@CodeJhF CodeJhF changed the title Fix Qt GPUDrawable surface not updating when size changes Fix Qt GPUDrawable surface not updating on resize and improve PAGX code quality Apr 21, 2026
@CodeJhF CodeJhF force-pushed the bugfix/markffan_qt_surface branch from 95d112b to 942c34e Compare April 21, 2026 14:08
shlzxjp
shlzxjp previously approved these changes Apr 29, 2026
@shlzxjp shlzxjp merged commit 9555f23 into main Apr 29, 2026
9 checks passed
@shlzxjp shlzxjp deleted the bugfix/markffan_qt_surface branch April 29, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants