-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Optimize Matrix.Elements #47932
Optimize Matrix.Elements #47932
Conversation
Just pin the array. There is no need to allocate native memory and copy.
Tagging subscribers to this area: @safern, @tannergooding Issue DetailsJust pin the array. There is no need to allocate native memory and copy.
|
src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs
Show resolved
Hide resolved
src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs
Outdated
Show resolved
Hide resolved
copy.X += (int)graphics.Transform.OffsetX; | ||
copy.Y += (int)graphics.Transform.OffsetY; | ||
|
||
using Matrix transform = graphics.Transform; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, a property that allocates and returns a new finalizable object on every access... awesome ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a proposal up to help address this, um, suboptimal pattern: #47940
Just pin the array. There is no need to allocate native memory and copy.