+
Skip to content

sw_engine: improved blending quality #3617

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 15, 2025
Merged

sw_engine: improved blending quality #3617

merged 1 commit into from
Jul 15, 2025

Conversation

hermet
Copy link
Member

@hermet hermet commented Jul 15, 2025

enhanced anti-aliasing in image blending by properly applying unpremultiply/premultiply computations during blending operations.

enhanced anti-aliasing in image blending by properly
applying unpremultiply/premultiply computations during
blending operations.
@hermet hermet self-assigned this Jul 15, 2025
@hermet hermet requested a review from mgrudzinska as a code owner July 15, 2025 03:19
@hermet hermet added the enhancement Improve features label Jul 15, 2025
@hermet hermet requested a review from Copilot July 15, 2025 03:19
@github-actions github-actions bot added the cpu Software render backend label Jul 15, 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

This PR enhances image blending by applying proper unpremultiply steps before blending and simplifies the rasterClear API.

  • Always unpremultiply source pixels before invoking the blender in polygon, scaled, direct, and matted blending paths
  • Removed the color parameter from rasterClear, defaulting to a zero clear value
  • Optimized BLEND_PRE with an early exit when alpha is 255

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/renderer/sw_engine/tvgSwRenderer.cpp Updated calls to rasterClear to match the new signature
src/renderer/sw_engine/tvgSwRasterTexmap.h Added rasterUnpremultiply before blending in polygon loops
src/renderer/sw_engine/tvgSwRaster.cpp Applied rasterUnpremultiply in all blending pipelines
src/renderer/sw_engine/tvgSwCommon.h Removed default clear value from rasterClear and optimized BLEND_PRE
Comments suppressed due to low confidence (1)

src/renderer/sw_engine/tvgSwRenderer.cpp:669

  • Removing the dynamic clear color here changes behavior: previously we cleared to either white or black based on blending state. You should preserve that logic by passing the appropriate color to rasterClear (or extend the new API) to maintain visual consistency.
    rasterClear(cmp, bbox.x(), bbox.y(), bbox.w(), bbox.h());

@hermet hermet removed the request for review from mgrudzinska July 15, 2025 03:21
@hermet hermet merged commit 43a0827 into main Jul 15, 2025
15 checks passed
@hermet hermet deleted the hermet/blending2 branch July 15, 2025 03:24
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浏览器服务,不要输入任何密码和下载