Skip to content
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

Remove most usages of WIndowsGraphicsWrapper #3532

Merged
merged 5 commits into from Jul 7, 2020

Conversation

JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Jul 2, 2020

  • Refactor DpiHelper a bit, adding new API to avoid DC creation (using new GetDpiForSystem())
  • Add PaintEvent HDC wrapper to favor getting the natvie HDC if the Graphics wrapper hasn't been created
  • Extend DeviceContextHdcScope to support WindowsGraphicsWrapper migration
  • Change HDC property on PaintEventArgs
  • Add DrawLine to HDC extensions (from WindowsGraphics)
  • Graphics.DpiX is no different than normal device DPI, removed from CheckableControlBaseAdapter.cs
  • Remove Graphics from CheckBoxPopupAdapter.PaintPopupLayout
  • Add SetBkMode scope

Remove WindowsGraphics/Wrapper from a number of methods.

Microsoft Reviewers: Open in CodeFlow

- Refactor DpiHelper a bit, adding new API to avoid DC creation (using new GetDpiForSystem())
- Add PaintEvent HDC wrapper to favor getting the natvie HDC if the Graphics wrapper hasn't been created
- Extend DeviceContextHdcScope to support WindowsGraphicsWrapper migration
- Change HDC property on PaintEventArgs
- Add DrawLine to HDC extensions (from WindowsGraphics)
- Graphics.DpiX is no different than normal device DPI, removed from CheckableControlBaseAdapter.cs
- Remove Graphics from CheckBoxPopupAdapter.PaintPopupLayout
- Add SetBkMode scope

Remove WindowsGraphics/Wrapper from a number of  methods.
@JeremyKuhne JeremyKuhne requested a review from a team as a code owner July 2, 2020 04:41
@ghost ghost assigned JeremyKuhne Jul 2, 2020
@RussKie
Copy link
Member

RussKie commented Jul 2, 2020

A lot of tests failing

      System.InvalidOperationException : Object is currently in use elsewhere.
      Stack Trace:
           at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
           at System.Drawing.Graphics.get_TextRenderingHint()
        F:\workspace\_work\1\s\src\System.Windows.Forms\src\misc\GDI\WindowsFont.cs(383,0): at System.Windows.Forms.Internal.WindowsFont.WindowsFontQualityFromTextRenderingHint(Graphics g)
        F:\workspace\_work\1\s\src\System.Windows.Forms\src\System\Windows\Forms\TextRenderer.cs(23,0): at System.Windows.Forms.TextRenderer.DrawText(IDeviceContext dc, String text, Font font, Point pt, Color foreColor)
        F:\workspace\_work\1\s\src\System.Windows.Forms\tests\UnitTests\System\Windows\Forms\TextRendererTests.cs(43,0): at System.Windows.Forms.Tests.TextRendererTests.TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColor_Success(TextRenderingHint textRenderingHint, String text, Font font, Point pt, Color foreColor)
    System.Windows.Forms.Tests.TextRendererTests.TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColor_Success(textRenderingHint: SystemDefault, text: "", font: null, pt: {X=0,Y=0}, foreColor: Color [Red]) [FAIL]

Remove lazy initialization of the scope and make it readonly so cast operators don't copy the struct
Fix line split in DrawThemeBackground
@RussKie
Copy link
Member

RussKie commented Jul 6, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov
Copy link

codecov bot commented Jul 6, 2020

Codecov Report

Merging #3532 into master will decrease coverage by 31.44626%.
The diff coverage is 25.88727%.

@@                 Coverage Diff                  @@
##              master       #3532          +/-   ##
====================================================
- Coverage   67.03175%   35.58549%   -31.44627%     
====================================================
  Files           1352         900         -452     
  Lines         505814      252943      -252871     
  Branches       40899       36729        -4170     
====================================================
- Hits          339056       90011      -249045     
+ Misses        161191      158080        -3111     
+ Partials        5567        4852         -715     
Flag Coverage Δ
#Debug 35.58549% <25.88727%> (-31.44627%) ⬇️
#production 35.58549% <25.88727%> (-0.01069%) ⬇️
#test ?

@RussKie RussKie marked this pull request as draft July 7, 2020 01:41
@RussKie RussKie marked this pull request as ready for review July 7, 2020 02:01
@RussKie RussKie merged commit e45b38a into dotnet:master Jul 7, 2020
@ghost ghost added this to the 5.0 Preview8 milestone Jul 7, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Jan 31, 2022
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.

None yet

3 participants