Skip to content

Clean up code around the painting loop#10917

Merged
JeremyKuhne merged 2 commits intodotnet:mainfrom
JeremyKuhne:paintclean
Feb 21, 2024
Merged

Clean up code around the painting loop#10917
JeremyKuhne merged 2 commits intodotnet:mainfrom
JeremyKuhne:paintclean

Conversation

@JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Feb 20, 2024

Various cleanup with painting.

  • Add a SuspendLayoutScope to simplify scoping and validation
  • Don't update layout for the parent if you don't change size (SetBoundsCore)
  • Fix remaining info messages in Control
  • Don't paint transparent background twice in PaintBackground
  • Cache checking image transparency in PaintBackground
  • Suppress all relevant warnings in NotSupported.cs to avoid the 10000 warnings that pop when you accidentally open it

Stops caching high contrast setting. By caching and starting the SystemEvents window this was causing a nested paint on the main form during startup if you you had a background image. The call is not so expensive to need creating a window look for changes.

This also moves a few bitmap related APIs to Core to allow for Direct2D related scenarios.

Microsoft Reviewers: Open in CodeFlow

Various cleanup with painting.

- Add a SuspendLayoutScope to simplify scoping and validation
- Don't update layout for the parent if you don't change size (SetBoundsCore)
- Fix remaining info messages in Control
- Don't paint transparent background twice in PaintBackground
- Cache checking image transparency in PaintBackground
- Suppress all relevant warnings in NotSupported.cs to avoid the 10000 warnings that pop when you accidentally open it

Stops caching high contrast setting. By caching and starting the SystemEvents window this was causing a nested paint on the main form during startup if you you had a background image. The call is not so expensive to need creating a window look for changes.

This also moves a few bitmap related APIs to Core to allow for Direct2D related scenarios.
@codecov
Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: 74 lines in your changes are missing coverage. Please review.

Comparison is base (f8e6d3b) 73.14861% compared to head (a5feefd) 73.15202%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10917         +/-   ##
===================================================
+ Coverage   73.14861%   73.15202%   +0.00340%     
===================================================
  Files           3087        3090          +3     
  Lines         633673      633582         -91     
  Branches       47397       47395          -2     
===================================================
- Hits          463523      463478         -45     
+ Misses        166636      166584         -52     
- Partials        3514        3520          +6     
Flag Coverage Δ
Debug 73.15202% <83.29571%> (+0.00340%) ⬆️
integration 18.20848% <47.30679%> (-0.01923%) ⬇️
production 46.60121% <82.66979%> (-0.00147%) ⬇️
test 94.99443% <100.00000%> (+0.00003%) ⬆️
unit 43.53724% <82.43560%> (+0.00137%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@lonitra lonitra left a comment

Choose a reason for hiding this comment

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

👍

@JeremyKuhne JeremyKuhne merged commit 905aac1 into dotnet:main Feb 21, 2024
@JeremyKuhne JeremyKuhne deleted the paintclean branch February 21, 2024 01:11
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0 Preview2 milestone Feb 21, 2024
KlausLoeffelmann pushed a commit to KlausLoeffelmann/winforms that referenced this pull request Mar 5, 2024
Various cleanup with painting.

- Add a SuspendLayoutScope to simplify scoping and validation
- Don't update layout for the parent if you don't change size (SetBoundsCore)
- Fix remaining info messages in Control
- Don't paint transparent background twice in PaintBackground
- Cache checking image transparency in PaintBackground
- Suppress all relevant warnings in NotSupported.cs to avoid the 10000 warnings that pop when you accidentally open it

Stops caching high contrast setting. By caching and starting the SystemEvents window this was causing a nested paint on the main form during startup if you you had a background image. The call is not so expensive to need creating a window look for changes.

This also moves a few bitmap related APIs to Core to allow for Direct2D related scenarios.
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants