+
Skip to content

sw_engine: improved the dropshadow effect support #3618

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 2 commits into from
Jul 16, 2025
Merged

Conversation

hermet
Copy link
Member

@hermet hermet commented Jul 15, 2025

  • shadow rendering was skipped when the blur value was 0. it now correctly renders shadows without blur.

  • this also fixes the distance offset scalability.

issue: #3602

@hermet hermet self-assigned this Jul 15, 2025
@hermet hermet requested a review from mgrudzinska as a code owner July 15, 2025 11:22
@hermet hermet added the enhancement Improve features label Jul 15, 2025
@hermet hermet requested review from Copilot and removed request for mgrudzinska July 15, 2025 11:22
@github-actions github-actions bot added the cpu Software render backend label Jul 15, 2025
@hermet hermet force-pushed the hermet/dropshadow branch from d6ddf3d to 52630bb Compare July 15, 2025 11:23
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 drop shadow support by correctly rendering shadows when blur (sigma) is zero and ensuring the shadow offset scales with the render transform.

  • Introduces a direct shadow rendering path (_dropShadowDirect) used when sigma == 0.
  • Refactors pointer shifting into a new _shift helper for both blurred and direct shadows.
  • Applies the scale factor to the shadow distance offset.
Comments suppressed due to low confidence (2)

src/renderer/sw_engine/tvgSwPostEffect.cpp:269

  • [nitpick] The helper name _shift is quite generic. Consider renaming it to something more descriptive like _shiftRegion or _applyOffsetShift to clarify its purpose.
static void _shift(uint32_t** dst, uint32_t** src, int dstride, int sstride, int wmax, int hmax, const RenderRegion& bbox, const SwPoint& offset, int32_t* ow, int32_t* oh)

src/renderer/sw_engine/tvgSwPostEffect.cpp:421

  • The new direct-shadow code path for sigma == 0 should be covered by unit tests to verify correct rendering without blur and ensure no regressions in future changes.
    if (params->sigma == 0.0f)  {

- shadow rendering was skipped when the blur value was 0.
  it now correctly renders shadows without blur.

- this also fixes the distance offset scalability.

issue: #3602
@hermet hermet force-pushed the hermet/dropshadow branch from 52630bb to e7cc6e2 Compare July 16, 2025 01:49
@github-actions github-actions bot added the renderer Core rendering label Jul 16, 2025
The direct raster version has been restored with a proper fix
for the out-of-range bug.

see history: 78753ee
@hermet hermet force-pushed the hermet/dropshadow branch from 8c16289 to 090a118 Compare July 16, 2025 04:25
@hermet hermet merged commit 15aafbf into main Jul 16, 2025
15 checks passed
@hermet hermet deleted the hermet/dropshadow branch July 16, 2025 04:39
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 renderer Core rendering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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