Skip to content

Commit 9b251f5

Browse files
authored
Merge pull request #2835 from Starbuck5/use-hascolorkey-in-pgsurface-blit
Use HasColorKey instead of GetColorKey in pgSurface_Blit
2 parents 965b474 + f129dbb commit 9b251f5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src_c/surface.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3822,7 +3822,6 @@ pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj,
38223822
int result, suboffsetx = 0, suboffsety = 0;
38233823
SDL_Rect orig_clip, sub_clip;
38243824
Uint8 alpha;
3825-
Uint32 key;
38263825

38273826
/* passthrough blits to the real surface */
38283827
if (((pgSurfaceObject *)dstobj)->subsurface) {
@@ -3860,7 +3859,7 @@ pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj,
38603859
pgSurface_Prep(srcobj);
38613860

38623861
if ((blend_flags != 0 && blend_flags != PYGAME_BLEND_ALPHA_SDL2) ||
3863-
((SDL_GetColorKey(src, &key) == 0 || _PgSurface_SrcAlpha(src) == 1) &&
3862+
((SDL_HasColorKey(src) || _PgSurface_SrcAlpha(src) == 1) &&
38643863
/* This simplification is possible because a source subsurface
38653864
is converted to its owner with a clip rect and a dst
38663865
subsurface cannot be blitted to its owner because the
@@ -3916,8 +3915,7 @@ pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj,
39163915
/* Py_END_ALLOW_THREADS */
39173916
}
39183917
else if (blend_flags != PYGAME_BLEND_ALPHA_SDL2 &&
3919-
!(pg_EnvShouldBlendAlphaSDL2()) &&
3920-
SDL_GetColorKey(src, &key) != 0 &&
3918+
!(pg_EnvShouldBlendAlphaSDL2()) && !SDL_HasColorKey(src) &&
39213919
(PG_SURF_BytesPerPixel(dst) == 4 ||
39223920
PG_SURF_BytesPerPixel(dst) == 2) &&
39233921
_PgSurface_SrcAlpha(src) &&

0 commit comments

Comments
 (0)