@@ -1590,32 +1590,34 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
15901590static SDL_Surface *
15911591pg_DisplayFormat (SDL_Surface * surface )
15921592{
1593- SDL_Surface * displaysurf ;
1594- if (!pg_GetDefaultWindowSurface ()) {
1595- SDL_SetError ("No video mode has been set" );
1593+ if (!pg_GetDefaultConvertFormat ()) {
1594+ SDL_SetError ("No convert format has been set, try display.set_mode()"
1595+ // " or Window.get_surface()"
1596+ // (uncomment when Window API is published)
1597+ );
15961598 return NULL ;
15971599 }
1598- displaysurf = pgSurface_AsSurface (pg_GetDefaultWindowSurface ());
1599- return PG_ConvertSurface (surface , displaysurf -> format );
1600+ return PG_ConvertSurface (surface , pg_GetDefaultConvertFormat ());
16001601}
16011602
16021603static SDL_Surface *
16031604pg_DisplayFormatAlpha (SDL_Surface * surface )
16041605{
1605- SDL_Surface * displaysurf ;
16061606 SDL_PixelFormat * dformat ;
16071607 Uint32 pfe ;
16081608 Uint32 amask = 0xff000000 ;
16091609 Uint32 rmask = 0x00ff0000 ;
16101610 Uint32 gmask = 0x0000ff00 ;
16111611 Uint32 bmask = 0x000000ff ;
16121612
1613- if (!pg_GetDefaultWindowSurface ()) {
1614- SDL_SetError ("No video mode has been set" );
1613+ if (!pg_GetDefaultConvertFormat ()) {
1614+ SDL_SetError ("No convert format has been set, try display.set_mode()"
1615+ // " or Window.get_surface()"
1616+ // (uncomment when Window API is published)
1617+ );
16151618 return NULL ;
16161619 }
1617- displaysurf = pgSurface_AsSurface (pg_GetDefaultWindowSurface ());
1618- dformat = displaysurf -> format ;
1620+ dformat = pg_GetDefaultConvertFormat ();
16191621
16201622 switch (dformat -> BytesPerPixel ) {
16211623 case 2 :
0 commit comments