File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -1610,13 +1610,13 @@ pg_DisplayFormatAlpha(SDL_Surface *surface)
16101610 Uint32 gmask = 0x0000ff00 ;
16111611 Uint32 bmask = 0x000000ff ;
16121612
1613- if (!pg_GetDefaultConvertFormat ()) {
1613+ dformat = pg_GetDefaultConvertFormat ();
1614+ if (!dformat ) {
16141615 SDL_SetError (
16151616 "No convert format has been set, try display.set_mode()"
16161617 " or Window.get_surface()." );
16171618 return NULL ;
16181619 }
1619- dformat = pg_GetDefaultConvertFormat ();
16201620
16211621 switch (dformat -> BytesPerPixel ) {
16221622 case 2 :
Original file line number Diff line number Diff line change @@ -157,12 +157,6 @@ window_get_surface(pgWindowObject *self)
157157 if (!_surf ) {
158158 return RAISE (pgExc_SDLError , SDL_GetError ());
159159 }
160- if (self -> surf == NULL ) {
161- self -> surf = pgSurface_New2 (_surf , SDL_FALSE );
162- if (!self -> surf )
163- return NULL ;
164- }
165- self -> surf -> surf = _surf ;
166160
167161 if (pg_GetDefaultConvertFormat () == NULL ) {
168162 if (pg_SetDefaultConvertFormat (_surf -> format -> format ) == NULL ) {
@@ -172,6 +166,13 @@ window_get_surface(pgWindowObject *self)
172166 }
173167 }
174168
169+ if (self -> surf == NULL ) {
170+ self -> surf = pgSurface_New2 (_surf , SDL_FALSE );
171+ if (!self -> surf )
172+ return NULL ;
173+ }
174+ self -> surf -> surf = _surf ;
175+
175176 Py_INCREF (self -> surf );
176177 return (PyObject * )self -> surf ;
177178}
You can’t perform that action at this time.
0 commit comments