Adjust StyleBoxFlat antialiasing to account for 2D stretch scale

This prevents the antialiasing feather from becoming too wide
at viewport sizes higher than the default, which can lead to blurry visuals.

This is adjusted to account for the 2D scale factor returned on the root
Window, so it takes both the `canvas_items` scaling and
`content_scale_factor` into account.
This commit is contained in:
Hugo Locurcio
2024-06-10 20:33:17 +02:00
parent 47bc374edf
commit b43c47d6dd
2 changed files with 30 additions and 9 deletions

View File

@ -108,7 +108,7 @@
<return type="Transform2D" />
<description>
Returns the automatically computed 2D stretch transform, taking the [Viewport]'s stretch settings into account. The final value is multiplied by [member Window.content_scale_factor], but only for the root viewport. If this method is called on a [SubViewport] (e.g., in a scene tree with [SubViewportContainer] and [SubViewport]), the scale factor of the root window will not be applied. Using [method Transform2D.get_scale] on the returned value, this can be used to compensate for scaling when zooming a [Camera2D] node, or to scale down a [TextureRect] to be pixel-perfect regardless of the automatically computed scale factor.
[b]Note:[/b] Due to how pixel scaling works, the transform's X scale value may differ slightly from the Y scale, even when [member Window.content_scale_aspect] is set to a mode that preserves pixel aspect ratio. If [member Window.content_scale_aspect] is [constant Window.CONTENT_SCALE_ASPECT_IGNORE], the X value may differ [i]significantly[/i] from Y due to differences between the original aspect ratio and the window aspect ratio.
[b]Note:[/b] Due to how pixel scaling works, the returned transform's X and Y scale may differ slightly, even when [member Window.content_scale_aspect] is set to a mode that preserves the pixels' aspect ratio. If [member Window.content_scale_aspect] is [constant Window.CONTENT_SCALE_ASPECT_IGNORE], the X and Y scale may differ [i]significantly[/i].
</description>
</method>
<method name="get_texture" qualifiers="const">