Skip to content

Commit

Permalink
Remove SDL v1.2.10 checks in display.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Starbuck5 committed Jun 15, 2024
1 parent 14908e1 commit ebb65f2
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions src_c/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,6 @@ pg_vidinfo_getattr(PyObject *self, char *name)
{
pg_VideoInfo *info = &((pgVidInfoObject *)self)->info;

int current_w = -1;
int current_h = -1;

SDL_version versioninfo;
SDL_VERSION(&versioninfo);

if (versioninfo.major > 1 ||
(versioninfo.minor >= 2 && versioninfo.patch >= 10)) {
current_w = info->current_w;
current_h = info->current_h;
}

if (!strcmp(name, "hw"))
return PyLong_FromLong(info->hw_available);
else if (!strcmp(name, "wm"))
Expand Down Expand Up @@ -330,9 +318,9 @@ pg_vidinfo_getattr(PyObject *self, char *name)
return Py_BuildValue("(iiii)", info->vfmt->Rloss, info->vfmt->Gloss,
info->vfmt->Bloss, info->vfmt->Aloss);
else if (!strcmp(name, "current_h"))
return PyLong_FromLong(current_h);
return PyLong_FromLong(info->current_h);
else if (!strcmp(name, "current_w"))
return PyLong_FromLong(current_w);
return PyLong_FromLong(info->current_w);
else if (!strcmp(name, "pixel_format")) {
const char *pixel_format_name =
SDL_GetPixelFormatName(info->vfmt->format);
Expand All @@ -348,23 +336,12 @@ pg_vidinfo_getattr(PyObject *self, char *name)
PyObject *
pg_vidinfo_str(PyObject *self)
{
int current_w = -1;
int current_h = -1;
pg_VideoInfo *info = &((pgVidInfoObject *)self)->info;
const char *pixel_format_name = SDL_GetPixelFormatName(info->vfmt->format);
if (!strncmp(pixel_format_name, "SDL_", 4)) {
pixel_format_name += 4;
}

SDL_version versioninfo;
SDL_VERSION(&versioninfo);

if (versioninfo.major > 1 ||
(versioninfo.minor >= 2 && versioninfo.patch >= 10)) {
current_w = info->current_w;
current_h = info->current_h;
}

return PyUnicode_FromFormat(
"<VideoInfo(hw = %u, wm = %u,video_mem = %u\n"
" blit_hw = %u, blit_hw_CC = %u, blit_hw_A = %u,\n"
Expand All @@ -383,7 +360,7 @@ pg_vidinfo_str(PyObject *self)
info->vfmt->Gmask, info->vfmt->Bmask, info->vfmt->Amask,
info->vfmt->Rshift, info->vfmt->Gshift, info->vfmt->Bshift,
info->vfmt->Ashift, info->vfmt->Rloss, info->vfmt->Gloss,
info->vfmt->Bloss, info->vfmt->Aloss, current_w, current_h,
info->vfmt->Bloss, info->vfmt->Aloss, info->current_w, info->current_h,
pixel_format_name);
}

Expand Down

0 comments on commit ebb65f2

Please sign in to comment.