Closed filipnavara closed 4 years ago
Should fix the CorrectColorDepthExtracted
test failing on Mono PRs. I didn't try it locally yet. The test itself is slightly broken because it expects rounded values (resulting from alpha pre-multiplication) instead of the actual values in the .ico file.
/cc @akoeplinger
I tried this locally on OSX and it doesn't fix the issue for me:
System.Drawing.Tests.IconTests.CorrectColorDepthExtracted [FAIL]
Assert.Equal() Failure
Expected: 2275337522
Actual: 2270394650
Stack Trace:
/_/src/System.Drawing.Common/tests/IconTests.cs(864,0): at System.Drawing.Tests.IconTests.CorrectColorDepthExtracted()
/Users/alexander/dev/mono/netcore/System.Private.CoreLib/src/System.Reflection/RuntimeMethodInfo.cs(339,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Hmm, that is still the wrong premultiplied value.
/azp run
Now it should pass all the tests except for this one:
System.Drawing.Tests.IconTests.CorrectColorDepthExtracted [FAIL]
Assert.Equal() Failure
Expected: 2275337522
Actual: 2275337265
It is consequence of rounding error in ARGB32 -> PARGB32 -> ARGB32 conversion and naive implementation of Bitmap(Bitmap bitmap)
constructor. The best fix is on CoreFX side to switch to GdipCloneBitmapArea
API which is lossless since it avoids creating GpGraphics
object and drawing using Cairo.
Cherry-picked to release/6.0
Contributes to #446.
Fixes the following issues: