+
Skip to content

sw_engine: rectified softlight blending equation #3612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025
Merged

sw_engine: rectified softlight blending equation #3612

merged 1 commit into from
Jul 10, 2025

Conversation

hermet
Copy link
Member

@hermet hermet commented Jul 10, 2025

slightly adjusted the equation for adobe/figma alignment

slightly adjusted the equation for adobe/figma alignment
@hermet hermet self-assigned this Jul 10, 2025
@hermet hermet requested a review from mgrudzinska as a code owner July 10, 2025 11:05
@hermet hermet added the enhancement Improve features label Jul 10, 2025
@hermet hermet requested a review from Copilot July 10, 2025 11:06
@github-actions github-actions bot added the cpu Software render backend label Jul 10, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Aligned the soft-light blending formula with Adobe/Figma by adjusting the clamp and multiplication order.

  • Updated the formula comment to reflect the new term (2 * s * d)
  • Changed the second term to clamp after MULTIPLY(Cn(s), o.<channel>) instead of before multiplying by o.<channel>
Comments suppressed due to low confidence (1)

src/renderer/sw_engine/tvgSwCommon.h:564

  • Add unit tests covering boundary cases (e.g., s = 127, 128 and d = 0, 255) to verify the updated soft-light blend matches the expected Adobe/Figma results.
    auto c1 = MULTIPLY(255 - std::min(255, 2 * C1(s)), MULTIPLY(o.r, o.r)) + std::min(255, 2 * MULTIPLY(C1(s), o.r));

@hermet hermet merged commit 47fb2dc into main Jul 10, 2025
15 checks passed
@hermet hermet deleted the hermet/blend branch July 10, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpu Software render backend enhancement Improve features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载