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

Simplify CriticalCopyPixels in BitmapSource by removing duplicate type checks #9395

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Contributor

@h3xds1nz h3xds1nz commented Jul 13, 2024

Description

Removes redundant type checks second-time around when copying pixels in CriticalCopyPixels. There's a small performance improvement, however, the main goal here is decreasing code size, and also code simplification that has been made possible with the introduction of GetArrayDataReference few releases ago.

Since Unsafe.AddByteOffset won't do an index-out-of-bounds check for us, we do it ourselves to keep the same behaviour as previously, throwing IndexOutOfRangeException on when offset exceeds the array length.

Customer Impact

Smaller code-size of PresentationCore.

Regression

No.

Testing

Local build.

Risk

Low.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners July 13, 2024 13:01
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Jul 13, 2024
@h3xds1nz h3xds1nz changed the title [BitmapSource.cs] Simplify CriticalCopyPixels by removing duplicate type checks Simplify CriticalCopyPixels in BitmapSource by removing duplicate type checks Sep 1, 2024
@h3xds1nz h3xds1nz force-pushed the bitmap-src-simplify-pinning branch from 01ead7b to ff111c1 Compare October 7, 2024 15:57
@h3xds1nz
Copy link
Contributor Author

h3xds1nz commented Oct 7, 2024

Resolved merge conflicts 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant