From dc9042d5644d0a1edeb91130dc7daf80beeb89e2 Mon Sep 17 00:00:00 2001 From: Damiano <97639432+damusss@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:11:07 +0200 Subject: [PATCH] Fix docs and remove redundant C code --- docs/reST/ref/surface.rst | 5 ++++- src_c/surface.c | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/reST/ref/surface.rst b/docs/reST/ref/surface.rst index 30144fa00f..859acf075e 100644 --- a/docs/reST/ref/surface.rst +++ b/docs/reST/ref/surface.rst @@ -326,7 +326,10 @@ Scrolling is contained by the Surface clip area. It is safe to have dx and dy values that exceed the surface size. - The scroll flag can be ``0`` (normal behavior) or: + The scroll flag can be: + * ``0`` (default): the pixels are shifted but previous pixels are + not modified. + * ``pygame.SCROLL_ERASE``: the space created by the shifting pixels is filled with black or transparency. diff --git a/src_c/surface.c b/src_c/surface.c index 12d7940b16..fea4ad88be 100644 --- a/src_c/surface.c +++ b/src_c/surface.c @@ -2529,9 +2529,7 @@ surf_scroll(PyObject *self, PyObject *args, PyObject *keywds) } if (scroll(surf, dx, dy, x, y, w, h, repeat, erase) < 0) { - if (!pgSurface_Unlock((pgSurfaceObject *)self)) { - return NULL; - } + pgSurface_Unlock((pgSurfaceObject *)self); return NULL; }