@@ -2139,25 +2139,24 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
21392139 SURF_INIT_CHECK (dest )
21402140
21412141 SDL_Rect * src_rect , temp , dest_rect ;
2142- PyObject * item = NULL , * src_surf = NULL , * blit_pos = NULL ;
2143- PyObject * blit_sequence ;
2144- int error = 0 , flags_numeric = 0 ;
2142+ PyObject * blit_sequence , * item , * src_surf , * blit_pos ;
2143+ int blend_flags = 0 ; /* Default flag is 0, opaque */
2144+ int error = 0 ;
21452145
21462146 if (nargs == 0 || nargs > 2 ) {
21472147 error = FBLITS_ERR_INCORRECT_ARGS_NUM ;
21482148 goto on_error ;
21492149 }
2150+ /* Get the blend flags if they are passed */
21502151 else if (nargs == 2 ) {
2151- if (PyLong_Check (args [1 ])) {
2152- flags_numeric = PyLong_AsLong (args [1 ]);
2153- if (PyErr_Occurred ()) {
2154- return NULL ;
2155- }
2156- }
2157- else {
2152+ if (!PyLong_Check (args [1 ])) {
21582153 error = FBLITS_ERR_FLAG_NOT_NUMERIC ;
21592154 goto on_error ;
21602155 }
2156+ blend_flags = PyLong_AsLong (args [1 ]);
2157+ if (PyErr_Occurred ()) {
2158+ return NULL ;
2159+ }
21612160 }
21622161
21632162 blit_sequence = args [0 ];
@@ -2206,7 +2205,7 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
22062205
22072206 /* Perform the blit */
22082207 if (pgSurface_Blit (self , (pgSurfaceObject * )src_surf , & dest_rect ,
2209- NULL , flags_numeric )) {
2208+ NULL , blend_flags )) {
22102209 error = BLITS_ERR_BLIT_FAIL ;
22112210 goto on_error ;
22122211 }
@@ -2256,7 +2255,7 @@ surf_fblits(pgSurfaceObject *self, PyObject *const *args, Py_ssize_t nargs)
22562255
22572256 /* Perform the blit */
22582257 if (pgSurface_Blit (self , (pgSurfaceObject * )src_surf , & dest_rect ,
2259- NULL , flags_numeric )) {
2258+ NULL , blend_flags )) {
22602259 error = BLITS_ERR_BLIT_FAIL ;
22612260 goto on_error ;
22622261 }
0 commit comments