Skip to content

pygame._sdl2.sdl2.error: Parameter 'dst' is invalid when calling Renderer.to_surface() if logical_size is 80,1 (or 1,80) #3244

Open
@ImNotMeAnymore

Description

@ImNotMeAnymore

Environment:
OS: Pop_OS 22.04 LTS
pygame-ce version: 2.5.2
python version: 3.12.2

Current behavior:
Making a pygame._sdl2.video.Renderer object and changing it's logical size to 1,80 or 80,1 and then trying to use .to_surface() on said object will raise:

File "video.pyx", line 1253, in pygame._sdl2.video.Renderer.to_surface
pygame._sdl2.sdl2.error: Parameter 'dst' is invalid

The window needs to be larger than logical_size

Expected behavior:
This is closely related to #3245 so it heavily depends on how that is solved, but I think it should either:
a) if 1,80(or 80,1) is an invalid value raise an error when setting it, not when calling to_surface (no other than 80 seems to cause trouble outside of the issue mentioned above)
b) make it work like any other value (needs above issue to be solved)
c) make to_surface() raise a more comprehensive error, 'dst' is invalid says nothing, especially if logical_size was changed someplace else

Test code

from pygame import Window
from pygame._sdl2.video import Renderer

win = Window(size=(100,100))
ren = Renderer(win)
ren.logical_size = 80,1

"[Any amount of code]"

ren.to_surface()

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExperimentalExperimental codebugNot working as intended

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions