Skip to content

Conversation

JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Mar 11, 2025

If the initialization is in the core shared assembly this will allow targetted access to GDI+ functionality without pulling in the entire set of imports.

This will enable WPF to drop the full reference to System.Drawing.Common for OLE scenarios.

Microsoft Reviewers: Open in CodeFlow

If the initialization is in the core shared assembly this will allow targetted access to GDI+ functionality without pulling in the entire set of imports.

This will enable WPF to drop the full reference to System.Drawing.Common for OLE scenarios.
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 61.27734%. Comparing base (f712de3) to head (7ad4ac3).
Report is 8 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13114         +/-   ##
===================================================
- Coverage   61.28089%   61.27734%   -0.00355%     
===================================================
  Files           1541        1541                 
  Lines         158281      158282          +1     
  Branches       14743       14743                 
===================================================
- Hits           96996       96991          -5     
- Misses         60588       60594          +6     
  Partials         697         697                 
Flag Coverage Δ
Debug 61.27734% <90.00000%> (-0.00355%) ⬇️
integration 10.73761% <43.33333%> (-0.00011%) ⬇️
production 39.14041% <90.00000%> (-0.00560%) ⬇️
test 95.67280% <ø> (ø)
unit 36.56207% <90.00000%> (-0.00557%) ⬇️

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

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

Was just at my machine, so I thought I take a look.
Looks good to me.

2 questions, although I think I know the answers:

  • Is performance impacted since it will be initialized from WPFs side even if they do not need it?
  • Could the namespace-move have any backwards compatibility effect?

@JeremyKuhne
Copy link
Member Author

JeremyKuhne commented Mar 11, 2025

@KlausLoeffelmann

Is performance impacted since it will be initialized from WPFs side even if they do not need it?

They do need it initialized, they currently always load System.Drawing.Common when you use the clipboard. Sharing the initializer means we don't have two separate classes managing the process state for this. Performance will be better if they don't have to load the entirety of System.Drawing.Common and create temporary wrapping objects for their scenarios.

Could the namespace-move have any backwards compatibility effect?

Namespaces haven't changed and all of this is internal.

This allows testing for IPointer<GpBitmap> etc. instead of Bitmap etc. and implementing rudimentary GDI+ interop there. They do things like using Bitmap to create HBITMAP from a stream of bitmap data. Same sort of thing for HENHMETAFILE. There is also one case where they try and get description metadata from an image. All things that can be done with a few duplicated imports on their side and a few lines of code.

@Tanya-Solyanik
Copy link
Contributor

they currently always load System.Drawing.Common when you use the clipboard.

Is this something we want to fix?

@JeremyKuhne
Copy link
Member Author

Is this something we want to fix?

This is an attempt to not load it. There will still be a dependency on GDI+, which I think might be able to be migrated to WIC long term, but not entirely sure due to the metafile support. (Or possibly everything other than metafiles)

@JeremyKuhne JeremyKuhne merged commit f478823 into dotnet:main Mar 11, 2025
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview3 milestone Mar 11, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2025
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.

3 participants