Skip to content

Fix multiple SVG import rendering bugs in masks and gradient strokes.#3503

Open
OnionsYu wants to merge 4 commits into
Tencent:mainfrom
OnionsYu:fix/onionsyu_import_svg
Open

Fix multiple SVG import rendering bugs in masks and gradient strokes.#3503
OnionsYu wants to merge 4 commits into
Tencent:mainfrom
OnionsYu:fix/onionsyu_import_svg

Conversation

@OnionsYu

Copy link
Copy Markdown
Contributor

本次修复了 SVG 导入过程中三处影响渲染正确性的问题:

  1. mask-type 属性未生效:之前固定使用 Luminance 计算遮罩,忽略了 SVG 标准的 mask-type 属性。现在会读取 mask-type,"alpha" 时使用 MaskType::Alpha,其余情况保持 Luminance 默认行为。

  2. 渐变描边 stroke-opacity 失效:原实现仅在纯色分支处理 stroke-opacity,导致 url() 引用的渐变描边丢失透明度。已将 stroke-opacity 解析提前到分支之前,使其同时作用于纯色和渐变描边。

  3. 隐藏 mask 引用图层与可见图层被合并:isSimpleShapeLayer 在合并简单形状图层时未区分可见性,会把不可见的 mask 引用层与同形状的可见图层合并,导致可见图层的 painter 丢失、画面消失。现在显式拒绝合并不可见图层。

@OnionsYu OnionsYu requested a review from kevingpqi123 as a code owner June 11, 2026 13:10
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.55%. Comparing base (9e5ef77) to head (1e33b13).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3503      +/-   ##
==========================================
- Coverage   80.57%   80.55%   -0.03%     
==========================================
  Files         620      620              
  Lines       67021    67024       +3     
  Branches    19885    19887       +2     
==========================================
- Hits        54002    53988      -14     
- Misses       9083     9086       +3     
- Partials     3936     3950      +14     

☔ View full report in Codecov by Harness.
📢 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.

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.

2 participants