Skip to content

Broken rendering using Direct2D on monitors above 100% scaling #18277

Open
@styris-ame

Description

@styris-ame

Describe the bug

On my fullscreen app, there are clear rendering artifacts when using Direct2D on a display with a scaling factor above 100%. See the following videos for demonstration:

Direct2D:
https://github.com/user-attachments/assets/9daf2d32-f45e-4804-8dff-405928d318b2

Skia:
https://github.com/user-attachments/assets/5f07290b-8c3e-4449-ae30-1ba2b313882e

The animation is quite simple. It's just a ScaleTransform on a Grid with a TransformOperationsTransition. With Direct2D, it appears to have some weird overlapping rendering issues of some sort.

Even with the animation removed, there is still an artifact where the content gets partially cut off on the left side:
https://github.com/user-attachments/assets/a7aa9b96-24f8-4367-baac-f7c2c8f07f17

Also note that ClipToBounds does not work properly with Direct2D, as seen on video with the Content border.

To Reproduce

  1. Download this project: BrokenDirect2DScaling.zip
  2. Set display scale in windows to 125% or beyond (Tested on 1920x1080 display)
  3. Open solution and run Direct2D configuration

Expected behavior

Content renders properly

Avalonia version

11.2.4

OS

Windows

Additional context

The AngleEgl rendering mode results in a blank window, therefore Vulkan or Software is used instead. Both Software and Vulkan result in the same rendering artifacts.

Using Skia is not really an option for me unfortunately, as there is noticeably more lag when using software rendering which is a common setup for my use case (pre-driver environment).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions