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

Images not drawn by software rendering #1542

Closed
SamBent opened this issue Aug 5, 2019 · 1 comment
Closed

Images not drawn by software rendering #1542

SamBent opened this issue Aug 5, 2019 · 1 comment
Assignees
Labels
Bug Product bug (most likely) .NET Framework tell-mode Issues and PR's that require notice to .NET Core Shiproom
Milestone

Comments

@SamBent
Copy link
Contributor

SamBent commented Aug 5, 2019

(Port of fix in the .NETFx servicing pipeline)
Software rendering fails to draw images (or only partially draws them) when the image position and scaling are too large.

Software rendering does image-processing using integer arithmetic, representing points as "16.16" fixed-point numbers (16 bits of integer, 16 bits of fraction). Thus it cannot deal with quantities whose magnitude exceeds 2^15=32768. The translation components of the device-to-texture mapping can exceed this limit if the position and scaling of the image are large enough. For example, the mapping for a 10x10 Image element, sourced to a 500x500 bitmap and positioned 700 pixels from the edge of the enclosing window, has scaling factor 500/10 = 50 and a desired translation of -50*700 = -35000 -- too big.

In this case the renderer uses the closest available number, -32768, causing it to sample the source bitmap too far to the right. This produces a result equivalent to painting the image at the maximum "working" offset then clipping by the actual position of the Image. In other words, as the Image moves to the right, the picture stops moving when the maximum offset is reached, and instead gets clipped on its left side until it eventually disappears altogether.

Fix:
Use an adjusted mapping, relative to an "origin" point. When mapping from device to texture, subtract the origin (in regular "int" coords), then apply the adjusted 16.16 mapping. The adjusted mapping's translation components depend on the distance from the origin, rather than from the window-edge, so choosing an origin point that's close to the Image position will avoid the overflow.

@SamBent SamBent added this to the 3.0 milestone Aug 5, 2019
@SamBent SamBent self-assigned this Aug 5, 2019
@SamBent SamBent added area-netfx Bug Product bug (most likely) tell-mode Issues and PR's that require notice to .NET Core Shiproom labels Aug 5, 2019
@SamBent
Copy link
Contributor Author

SamBent commented Aug 7, 2019

@ghost ghost locked as resolved and limited conversation to collaborators Apr 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Product bug (most likely) .NET Framework tell-mode Issues and PR's that require notice to .NET Core Shiproom
Projects
None yet
Development

No branches or pull requests

3 participants