Skip to content

display.update() on mac does not update exactly the area given (2956) #1499

Open
@GalacticEmperor1

Description

@GalacticEmperor1

Issue №2956 opened by illume at 2021-12-26 17:03:26

python3 test/display_test.py -k test_update on Mac will show that it updates the whole row... not just the column changes.

Haven't checked which SDL/pygame versions this applies to, only 2.0.18 and the latest pygame. The tests in pygame/pygame#2954 can be used to test old versions probably (if the tests are copied into the old versions).

In this screenshot it should not show green going all the way across the row.
Screenshot 2021-12-26 at 18 05 06

Additionally,

  • Mac display requires an event.pump before updating the display.
  • Mac defaults to (0,0,0,0) rather than (0,0,0,255) like other systems.

These issues should be raised with SDL along with example programs.


Comments

# # MyreMylar commented at 2021-12-29 19:38:03

Fix idea for:

Mac defaults to (0,0,0,0) rather than (0,0,0,255) like other systems.

Change:
https://github.com/pygame/pygame/blob/1a78d4f6f6d134dd037ccc69c6e9cac5d5d81225/src_c/surface.c# L701

to:

Amask = 0;

The logic being that we know the user is not explicitly requesting a surface with alpha and on windows and linux they will get a SDL_PIXELFORMAT_RGB888 surface but, because of the Mac's default window surface, on mac they won't. Changing line 701 should mean all platforms get the same type of surface when doing a basic:

surface = pygame.Surface((32, 32))

This might have implications for blitting but the bit depth is the same (both are 32 bit), so I suspect that it will either perform the same or be faster. I'm not sure if this will solve all the mac weirdness, but it is a one line change so might be worth a punt to try out for those of us with macs. See if it fixes any problems and if there is any noticeable change in blitting speed.


# # JulianCRA commented at 2022-03-24 08:30:34

The issue happens on Linux (Linux Mint 20.3), also.

display

Only the 3rd and 4th tests were behaving correctly:

  • Is the WHOLE screen green?
  • Is the screen black and NOT green?

It seems that when a list of rectangles is passed as an argument, it'll update the whole width of the screen between the lowest and highest of the Y values in said list.

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