Skip to content

fix: draw smoothing round rect corner#48769

Merged
codebytere merged 1 commit intoelectron:mainfrom
cucbin:fix/48581
Nov 5, 2025
Merged

fix: draw smoothing round rect corner#48769
codebytere merged 1 commit intoelectron:mainfrom
cucbin:fix/48581

Conversation

@cucbin
Copy link
Copy Markdown
Contributor

@cucbin cucbin commented Nov 4, 2025

Description of Change

Closes #48581

If my understanding is correct, the parameters of this method:

void DrawCorner(SkPath& path,
float radius,
float smoothness1,
float smoothness2,
const SkPoint& corner,
unsigned int quarter_rotations) {

smoothness1: Smoothness of the entry angle - controls the smoothness of the curve transitioning from the previous edge to the arc;
smoothness2: Smoothness of the exit angle - controls the smoothness of the curve transitioning from the arc to the next edge.

Taking the top left corner as:
  • smoothness1 = left_top_smoothness ← from the left side
  • smoothness2 = top_left_smoothness ← going to the top edge
Taking the top right corner as:
  • smoothness1 = top_right_smoothness ← from the top edge
  • smoothness2 = right_top_smoothness ← going to the right side
        top_left_smoothness (smoothness2)
    ←------------------------→
   ↑ ┌────────────o~~~~~~~~╮
   │ │                     ║
   │ │                     ║ ← right_top_smoothness (smoothness2)
   │ o                     o
   │ ║                     ║
   │ ║                     ║
   ↓ ║                     ║
left_top_smoothness      right_bottom_smoothness
   (smoothness1)            (smoothness1)

// Top left corner
DrawCorner(path, top_left_radius, left_top_smoothness, top_left_smoothness,
SkPoint::Make(x, y), 0);
// Top right corner
DrawCorner(path, top_right_radius, top_right_smoothness, right_top_smoothness,
SkPoint::Make(x + width, y), 1);

Therefore, the fourth corner should take from the bottom edge to the left.

  • smoothness1 = bottom_left_smoothness ← from the bottom edge
  • smoothness2 = left_bottom_smoothness ← going to the lefe side

Checklist

Release Notes

Notes: Fixed draw smoothing round corner issue

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Nov 4, 2025
Copy link
Copy Markdown
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

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

@cucbin could you please write a PR body? What was the underlying issue and how does this fix it? In general we expect a PR body for all PRs, as it makes gathering context and performing effective review more frictionless for maintainers.

@jkleinsc jkleinsc requested a review from clavin November 4, 2025 22:07
@jkleinsc jkleinsc added the semver/patch backwards-compatible bug fixes label Nov 4, 2025
Copy link
Copy Markdown
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

  • Nice find @cucbin. I have verified that this resolves #48581 and it doesn't regress the work done in #46751

@jkleinsc jkleinsc added target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. labels Nov 4, 2025
Copy link
Copy Markdown
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

Nice writeup too. Thanks @cucbin

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Nov 5, 2025
@codebytere codebytere merged commit 513a6ee into electron:main Nov 5, 2025
74 checks passed
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Nov 5, 2025

Release Notes Persisted

Fixed draw smoothing round corner issue

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Nov 5, 2025

I have automatically backported this PR to "38-x-y", please check out #48780

@trop trop bot added the in-flight/38-x-y label Nov 5, 2025
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Nov 5, 2025

I have automatically backported this PR to "39-x-y", please check out #48781

@trop trop bot removed the target/38-x-y PR should also be added to the "38-x-y" branch. label Nov 5, 2025
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Nov 5, 2025

I have automatically backported this PR to "40-x-y", please check out #48782

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Nov 5, 2025

I have automatically backported this PR to "37-x-y", please check out #48783

@trop trop bot added in-flight/39-x-y in-flight/40-x-y in-flight/37-x-y and removed target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. labels Nov 5, 2025
@trop trop bot added merged/40-x-y PR was merged to the "40-x-y" branch. and removed target/37-x-y PR should also be added to the "37-x-y" branch. in-flight/40-x-y labels Nov 5, 2025
nilayarya pushed a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-flight/37-x-y in-flight/38-x-y in-flight/39-x-y merged/40-x-y PR was merged to the "40-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-electron-corner-smoothing causes shape deformation

4 participants