1 /* Generated by Cython 0.29.24 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [],
7         "name": "pygame._sdl2.video",
8         "sources": [
9             "src_c\\cython\\pygame\\_sdl2\\video.pyx"
10         ]
11     },
12     "module_name": "pygame._sdl2.video"
13 }
14 END: Cython Metadata */
15 
16 #ifndef PY_SSIZE_T_CLEAN
17 #define PY_SSIZE_T_CLEAN
18 #endif /* PY_SSIZE_T_CLEAN */
19 #include "Python.h"
20 #ifndef Py_PYTHON_H
21     #error Python headers needed to compile C extensions, please install development version of Python.
22 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
23     #error Cython requires Python 2.6+ or Python 3.3+.
24 #else
25 #define CYTHON_ABI "0_29_24"
26 #define CYTHON_HEX_VERSION 0x001D18F0
27 #define CYTHON_FUTURE_DIVISION 0
28 #include <stddef.h>
29 #ifndef offsetof
30   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
31 #endif
32 #if !defined(WIN32) && !defined(MS_WINDOWS)
33   #ifndef __stdcall
34     #define __stdcall
35   #endif
36   #ifndef __cdecl
37     #define __cdecl
38   #endif
39   #ifndef __fastcall
40     #define __fastcall
41   #endif
42 #endif
43 #ifndef DL_IMPORT
44   #define DL_IMPORT(t) t
45 #endif
46 #ifndef DL_EXPORT
47   #define DL_EXPORT(t) t
48 #endif
49 #define __PYX_COMMA ,
50 #ifndef HAVE_LONG_LONG
51   #if PY_VERSION_HEX >= 0x02070000
52     #define HAVE_LONG_LONG
53   #endif
54 #endif
55 #ifndef PY_LONG_LONG
56   #define PY_LONG_LONG LONG_LONG
57 #endif
58 #ifndef Py_HUGE_VAL
59   #define Py_HUGE_VAL HUGE_VAL
60 #endif
61 #ifdef PYPY_VERSION
62   #define CYTHON_COMPILING_IN_PYPY 1
63   #define CYTHON_COMPILING_IN_PYSTON 0
64   #define CYTHON_COMPILING_IN_CPYTHON 0
65   #undef CYTHON_USE_TYPE_SLOTS
66   #define CYTHON_USE_TYPE_SLOTS 0
67   #undef CYTHON_USE_PYTYPE_LOOKUP
68   #define CYTHON_USE_PYTYPE_LOOKUP 0
69   #if PY_VERSION_HEX < 0x03050000
70     #undef CYTHON_USE_ASYNC_SLOTS
71     #define CYTHON_USE_ASYNC_SLOTS 0
72   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
73     #define CYTHON_USE_ASYNC_SLOTS 1
74   #endif
75   #undef CYTHON_USE_PYLIST_INTERNALS
76   #define CYTHON_USE_PYLIST_INTERNALS 0
77   #undef CYTHON_USE_UNICODE_INTERNALS
78   #define CYTHON_USE_UNICODE_INTERNALS 0
79   #undef CYTHON_USE_UNICODE_WRITER
80   #define CYTHON_USE_UNICODE_WRITER 0
81   #undef CYTHON_USE_PYLONG_INTERNALS
82   #define CYTHON_USE_PYLONG_INTERNALS 0
83   #undef CYTHON_AVOID_BORROWED_REFS
84   #define CYTHON_AVOID_BORROWED_REFS 1
85   #undef CYTHON_ASSUME_SAFE_MACROS
86   #define CYTHON_ASSUME_SAFE_MACROS 0
87   #undef CYTHON_UNPACK_METHODS
88   #define CYTHON_UNPACK_METHODS 0
89   #undef CYTHON_FAST_THREAD_STATE
90   #define CYTHON_FAST_THREAD_STATE 0
91   #undef CYTHON_FAST_PYCALL
92   #define CYTHON_FAST_PYCALL 0
93   #undef CYTHON_PEP489_MULTI_PHASE_INIT
94   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
95   #undef CYTHON_USE_TP_FINALIZE
96   #define CYTHON_USE_TP_FINALIZE 0
97   #undef CYTHON_USE_DICT_VERSIONS
98   #define CYTHON_USE_DICT_VERSIONS 0
99   #undef CYTHON_USE_EXC_INFO_STACK
100   #define CYTHON_USE_EXC_INFO_STACK 0
101 #elif defined(PYSTON_VERSION)
102   #define CYTHON_COMPILING_IN_PYPY 0
103   #define CYTHON_COMPILING_IN_PYSTON 1
104   #define CYTHON_COMPILING_IN_CPYTHON 0
105   #ifndef CYTHON_USE_TYPE_SLOTS
106     #define CYTHON_USE_TYPE_SLOTS 1
107   #endif
108   #undef CYTHON_USE_PYTYPE_LOOKUP
109   #define CYTHON_USE_PYTYPE_LOOKUP 0
110   #undef CYTHON_USE_ASYNC_SLOTS
111   #define CYTHON_USE_ASYNC_SLOTS 0
112   #undef CYTHON_USE_PYLIST_INTERNALS
113   #define CYTHON_USE_PYLIST_INTERNALS 0
114   #ifndef CYTHON_USE_UNICODE_INTERNALS
115     #define CYTHON_USE_UNICODE_INTERNALS 1
116   #endif
117   #undef CYTHON_USE_UNICODE_WRITER
118   #define CYTHON_USE_UNICODE_WRITER 0
119   #undef CYTHON_USE_PYLONG_INTERNALS
120   #define CYTHON_USE_PYLONG_INTERNALS 0
121   #ifndef CYTHON_AVOID_BORROWED_REFS
122     #define CYTHON_AVOID_BORROWED_REFS 0
123   #endif
124   #ifndef CYTHON_ASSUME_SAFE_MACROS
125     #define CYTHON_ASSUME_SAFE_MACROS 1
126   #endif
127   #ifndef CYTHON_UNPACK_METHODS
128     #define CYTHON_UNPACK_METHODS 1
129   #endif
130   #undef CYTHON_FAST_THREAD_STATE
131   #define CYTHON_FAST_THREAD_STATE 0
132   #undef CYTHON_FAST_PYCALL
133   #define CYTHON_FAST_PYCALL 0
134   #undef CYTHON_PEP489_MULTI_PHASE_INIT
135   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
136   #undef CYTHON_USE_TP_FINALIZE
137   #define CYTHON_USE_TP_FINALIZE 0
138   #undef CYTHON_USE_DICT_VERSIONS
139   #define CYTHON_USE_DICT_VERSIONS 0
140   #undef CYTHON_USE_EXC_INFO_STACK
141   #define CYTHON_USE_EXC_INFO_STACK 0
142 #else
143   #define CYTHON_COMPILING_IN_PYPY 0
144   #define CYTHON_COMPILING_IN_PYSTON 0
145   #define CYTHON_COMPILING_IN_CPYTHON 1
146   #ifndef CYTHON_USE_TYPE_SLOTS
147     #define CYTHON_USE_TYPE_SLOTS 1
148   #endif
149   #if PY_VERSION_HEX < 0x02070000
150     #undef CYTHON_USE_PYTYPE_LOOKUP
151     #define CYTHON_USE_PYTYPE_LOOKUP 0
152   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
153     #define CYTHON_USE_PYTYPE_LOOKUP 1
154   #endif
155   #if PY_MAJOR_VERSION < 3
156     #undef CYTHON_USE_ASYNC_SLOTS
157     #define CYTHON_USE_ASYNC_SLOTS 0
158   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
159     #define CYTHON_USE_ASYNC_SLOTS 1
160   #endif
161   #if PY_VERSION_HEX < 0x02070000
162     #undef CYTHON_USE_PYLONG_INTERNALS
163     #define CYTHON_USE_PYLONG_INTERNALS 0
164   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
165     #define CYTHON_USE_PYLONG_INTERNALS 1
166   #endif
167   #ifndef CYTHON_USE_PYLIST_INTERNALS
168     #define CYTHON_USE_PYLIST_INTERNALS 1
169   #endif
170   #ifndef CYTHON_USE_UNICODE_INTERNALS
171     #define CYTHON_USE_UNICODE_INTERNALS 1
172   #endif
173   #if PY_VERSION_HEX < 0x030300F0
174     #undef CYTHON_USE_UNICODE_WRITER
175     #define CYTHON_USE_UNICODE_WRITER 0
176   #elif !defined(CYTHON_USE_UNICODE_WRITER)
177     #define CYTHON_USE_UNICODE_WRITER 1
178   #endif
179   #ifndef CYTHON_AVOID_BORROWED_REFS
180     #define CYTHON_AVOID_BORROWED_REFS 0
181   #endif
182   #ifndef CYTHON_ASSUME_SAFE_MACROS
183     #define CYTHON_ASSUME_SAFE_MACROS 1
184   #endif
185   #ifndef CYTHON_UNPACK_METHODS
186     #define CYTHON_UNPACK_METHODS 1
187   #endif
188   #ifndef CYTHON_FAST_THREAD_STATE
189     #define CYTHON_FAST_THREAD_STATE 1
190   #endif
191   #ifndef CYTHON_FAST_PYCALL
192     #define CYTHON_FAST_PYCALL 1
193   #endif
194   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
195     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
196   #endif
197   #ifndef CYTHON_USE_TP_FINALIZE
198     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
199   #endif
200   #ifndef CYTHON_USE_DICT_VERSIONS
201     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
202   #endif
203   #ifndef CYTHON_USE_EXC_INFO_STACK
204     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
205   #endif
206 #endif
207 #if !defined(CYTHON_FAST_PYCCALL)
208 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
209 #endif
210 #if CYTHON_USE_PYLONG_INTERNALS
211   #include "longintrepr.h"
212   #undef SHIFT
213   #undef BASE
214   #undef MASK
215   #ifdef SIZEOF_VOID_P
216     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
217   #endif
218 #endif
219 #ifndef __has_attribute
220   #define __has_attribute(x) 0
221 #endif
222 #ifndef __has_cpp_attribute
223   #define __has_cpp_attribute(x) 0
224 #endif
225 #ifndef CYTHON_RESTRICT
226   #if defined(__GNUC__)
227     #define CYTHON_RESTRICT __restrict__
228   #elif defined(_MSC_VER) && _MSC_VER >= 1400
229     #define CYTHON_RESTRICT __restrict
230   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
231     #define CYTHON_RESTRICT restrict
232   #else
233     #define CYTHON_RESTRICT
234   #endif
235 #endif
236 #ifndef CYTHON_UNUSED
237 # if defined(__GNUC__)
238 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
239 #     define CYTHON_UNUSED __attribute__ ((__unused__))
240 #   else
241 #     define CYTHON_UNUSED
242 #   endif
243 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
244 #   define CYTHON_UNUSED __attribute__ ((__unused__))
245 # else
246 #   define CYTHON_UNUSED
247 # endif
248 #endif
249 #ifndef CYTHON_MAYBE_UNUSED_VAR
250 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)251      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
252 #  else
253 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
254 #  endif
255 #endif
256 #ifndef CYTHON_NCP_UNUSED
257 # if CYTHON_COMPILING_IN_CPYTHON
258 #  define CYTHON_NCP_UNUSED
259 # else
260 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
261 # endif
262 #endif
263 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
264 #ifdef _MSC_VER
265     #ifndef _MSC_STDINT_H_
266         #if _MSC_VER < 1300
267            typedef unsigned char     uint8_t;
268            typedef unsigned int      uint32_t;
269         #else
270            typedef unsigned __int8   uint8_t;
271            typedef unsigned __int32  uint32_t;
272         #endif
273     #endif
274 #else
275    #include <stdint.h>
276 #endif
277 #ifndef CYTHON_FALLTHROUGH
278   #if defined(__cplusplus) && __cplusplus >= 201103L
279     #if __has_cpp_attribute(fallthrough)
280       #define CYTHON_FALLTHROUGH [[fallthrough]]
281     #elif __has_cpp_attribute(clang::fallthrough)
282       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
283     #elif __has_cpp_attribute(gnu::fallthrough)
284       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
285     #endif
286   #endif
287   #ifndef CYTHON_FALLTHROUGH
288     #if __has_attribute(fallthrough)
289       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
290     #else
291       #define CYTHON_FALLTHROUGH
292     #endif
293   #endif
294   #if defined(__clang__ ) && defined(__apple_build_version__)
295     #if __apple_build_version__ < 7000000
296       #undef  CYTHON_FALLTHROUGH
297       #define CYTHON_FALLTHROUGH
298     #endif
299   #endif
300 #endif
301 
302 #ifndef CYTHON_INLINE
303   #if defined(__clang__)
304     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
305   #elif defined(__GNUC__)
306     #define CYTHON_INLINE __inline__
307   #elif defined(_MSC_VER)
308     #define CYTHON_INLINE __inline
309   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
310     #define CYTHON_INLINE inline
311   #else
312     #define CYTHON_INLINE
313   #endif
314 #endif
315 
316 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
317   #define Py_OptimizeFlag 0
318 #endif
319 #define __PYX_BUILD_PY_SSIZE_T "n"
320 #define CYTHON_FORMAT_SSIZE_T "z"
321 #if PY_MAJOR_VERSION < 3
322   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
323   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
324           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
325   #define __Pyx_DefaultClassType PyClass_Type
326 #else
327   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
328 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
329   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
330           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
331 #else
332   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
333           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
334 #endif
335   #define __Pyx_DefaultClassType PyType_Type
336 #endif
337 #ifndef Py_TPFLAGS_CHECKTYPES
338   #define Py_TPFLAGS_CHECKTYPES 0
339 #endif
340 #ifndef Py_TPFLAGS_HAVE_INDEX
341   #define Py_TPFLAGS_HAVE_INDEX 0
342 #endif
343 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
344   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
345 #endif
346 #ifndef Py_TPFLAGS_HAVE_FINALIZE
347   #define Py_TPFLAGS_HAVE_FINALIZE 0
348 #endif
349 #ifndef METH_STACKLESS
350   #define METH_STACKLESS 0
351 #endif
352 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
353   #ifndef METH_FASTCALL
354      #define METH_FASTCALL 0x80
355   #endif
356   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
357   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
358                                                           Py_ssize_t nargs, PyObject *kwnames);
359 #else
360   #define __Pyx_PyCFunctionFast _PyCFunctionFast
361   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
362 #endif
363 #if CYTHON_FAST_PYCCALL
364 #define __Pyx_PyFastCFunction_Check(func)\
365     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
366 #else
367 #define __Pyx_PyFastCFunction_Check(func) 0
368 #endif
369 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
370   #define PyObject_Malloc(s)   PyMem_Malloc(s)
371   #define PyObject_Free(p)     PyMem_Free(p)
372   #define PyObject_Realloc(p)  PyMem_Realloc(p)
373 #endif
374 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
375   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
376   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
377   #define PyMem_RawFree(p)             PyMem_Free(p)
378 #endif
379 #if CYTHON_COMPILING_IN_PYSTON
380   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
381   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
382 #else
383   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
384   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
385 #endif
386 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
387   #define __Pyx_PyThreadState_Current PyThreadState_GET()
388 #elif PY_VERSION_HEX >= 0x03060000
389   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
390 #elif PY_VERSION_HEX >= 0x03000000
391   #define __Pyx_PyThreadState_Current PyThreadState_GET()
392 #else
393   #define __Pyx_PyThreadState_Current _PyThreadState_Current
394 #endif
395 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
396 #include "pythread.h"
397 #define Py_tss_NEEDS_INIT 0
398 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)399 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
400   *key = PyThread_create_key();
401   return 0;
402 }
PyThread_tss_alloc(void)403 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
404   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
405   *key = Py_tss_NEEDS_INIT;
406   return key;
407 }
PyThread_tss_free(Py_tss_t * key)408 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
409   PyObject_Free(key);
410 }
PyThread_tss_is_created(Py_tss_t * key)411 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
412   return *key != Py_tss_NEEDS_INIT;
413 }
PyThread_tss_delete(Py_tss_t * key)414 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
415   PyThread_delete_key(*key);
416   *key = Py_tss_NEEDS_INIT;
417 }
PyThread_tss_set(Py_tss_t * key,void * value)418 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
419   return PyThread_set_key_value(*key, value);
420 }
PyThread_tss_get(Py_tss_t * key)421 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
422   return PyThread_get_key_value(*key);
423 }
424 #endif
425 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
426 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
427 #else
428 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
429 #endif
430 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
431   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
432   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
433 #else
434   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
435   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
436 #endif
437 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
438 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
439 #else
440 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
441 #endif
442 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
443   #define CYTHON_PEP393_ENABLED 1
444   #if defined(PyUnicode_IS_READY)
445   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
446                                               0 : _PyUnicode_Ready((PyObject *)(op)))
447   #else
448   #define __Pyx_PyUnicode_READY(op)       (0)
449   #endif
450   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
451   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
452   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
453   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
454   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
455   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
456   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
457   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
458   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
459   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
460   #else
461   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
462   #endif
463   #else
464   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
465   #endif
466 #else
467   #define CYTHON_PEP393_ENABLED 0
468   #define PyUnicode_1BYTE_KIND  1
469   #define PyUnicode_2BYTE_KIND  2
470   #define PyUnicode_4BYTE_KIND  4
471   #define __Pyx_PyUnicode_READY(op)       (0)
472   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
473   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
474   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
475   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
476   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
477   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
478   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
479   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
480 #endif
481 #if CYTHON_COMPILING_IN_PYPY
482   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
483   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
484 #else
485   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
486   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
487       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
488 #endif
489 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
490   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
491 #endif
492 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
493   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
494 #endif
495 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
496   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
497 #endif
498 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
499 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
500 #if PY_MAJOR_VERSION >= 3
501   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
502 #else
503   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
504 #endif
505 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
506   #define PyObject_ASCII(o)            PyObject_Repr(o)
507 #endif
508 #if PY_MAJOR_VERSION >= 3
509   #define PyBaseString_Type            PyUnicode_Type
510   #define PyStringObject               PyUnicodeObject
511   #define PyString_Type                PyUnicode_Type
512   #define PyString_Check               PyUnicode_Check
513   #define PyString_CheckExact          PyUnicode_CheckExact
514 #ifndef PyObject_Unicode
515   #define PyObject_Unicode             PyObject_Str
516 #endif
517 #endif
518 #if PY_MAJOR_VERSION >= 3
519   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
520   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
521 #else
522   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
523   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
524 #endif
525 #ifndef PySet_CheckExact
526   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
527 #endif
528 #if PY_VERSION_HEX >= 0x030900A4
529   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
530   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
531 #else
532   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
533   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
534 #endif
535 #if CYTHON_ASSUME_SAFE_MACROS
536   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
537 #else
538   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
539 #endif
540 #if PY_MAJOR_VERSION >= 3
541   #define PyIntObject                  PyLongObject
542   #define PyInt_Type                   PyLong_Type
543   #define PyInt_Check(op)              PyLong_Check(op)
544   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
545   #define PyInt_FromString             PyLong_FromString
546   #define PyInt_FromUnicode            PyLong_FromUnicode
547   #define PyInt_FromLong               PyLong_FromLong
548   #define PyInt_FromSize_t             PyLong_FromSize_t
549   #define PyInt_FromSsize_t            PyLong_FromSsize_t
550   #define PyInt_AsLong                 PyLong_AsLong
551   #define PyInt_AS_LONG                PyLong_AS_LONG
552   #define PyInt_AsSsize_t              PyLong_AsSsize_t
553   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
554   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
555   #define PyNumber_Int                 PyNumber_Long
556 #endif
557 #if PY_MAJOR_VERSION >= 3
558   #define PyBoolObject                 PyLongObject
559 #endif
560 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
561   #ifndef PyUnicode_InternFromString
562     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
563   #endif
564 #endif
565 #if PY_VERSION_HEX < 0x030200A4
566   typedef long Py_hash_t;
567   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
568   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
569 #else
570   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
571   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
572 #endif
573 #if PY_MAJOR_VERSION >= 3
574   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
575 #else
576   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
577 #endif
578 #if CYTHON_USE_ASYNC_SLOTS
579   #if PY_VERSION_HEX >= 0x030500B1
580     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
581     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
582   #else
583     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
584   #endif
585 #else
586   #define __Pyx_PyType_AsAsync(obj) NULL
587 #endif
588 #ifndef __Pyx_PyAsyncMethodsStruct
589     typedef struct {
590         unaryfunc am_await;
591         unaryfunc am_aiter;
592         unaryfunc am_anext;
593     } __Pyx_PyAsyncMethodsStruct;
594 #endif
595 
596 #if defined(WIN32) || defined(MS_WINDOWS)
597   #define _USE_MATH_DEFINES
598 #endif
599 #include <math.h>
600 #ifdef NAN
601 #define __PYX_NAN() ((float) NAN)
602 #else
__PYX_NAN()603 static CYTHON_INLINE float __PYX_NAN() {
604   float value;
605   memset(&value, 0xFF, sizeof(value));
606   return value;
607 }
608 #endif
609 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
610 #define __Pyx_truncl trunc
611 #else
612 #define __Pyx_truncl truncl
613 #endif
614 
615 #define __PYX_MARK_ERR_POS(f_index, lineno) \
616     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
617 #define __PYX_ERR(f_index, lineno, Ln_error) \
618     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
619 
620 #ifndef __PYX_EXTERN_C
621   #ifdef __cplusplus
622     #define __PYX_EXTERN_C extern "C"
623   #else
624     #define __PYX_EXTERN_C extern
625   #endif
626 #endif
627 
628 #define __PYX_HAVE__pygame___sdl2__video
629 #define __PYX_HAVE_API__pygame___sdl2__video
630 /* Early includes */
631 #include <string.h>
632 #include <stdio.h>
633 #include "SDL.h"
634 #include "pygame.h"
635 #include "pythread.h"
636 #include <stdlib.h>
637 #include "pgcompat.h"
638 #ifdef _OPENMP
639 #include <omp.h>
640 #endif /* _OPENMP */
641 
642 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
643 #define CYTHON_WITHOUT_ASSERTIONS
644 #endif
645 
646 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
647                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
648 
649 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
650 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
651 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
652 #define __PYX_DEFAULT_STRING_ENCODING ""
653 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
654 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
655 #define __Pyx_uchar_cast(c) ((unsigned char)c)
656 #define __Pyx_long_cast(x) ((long)x)
657 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
658     (sizeof(type) < sizeof(Py_ssize_t))  ||\
659     (sizeof(type) > sizeof(Py_ssize_t) &&\
660           likely(v < (type)PY_SSIZE_T_MAX ||\
661                  v == (type)PY_SSIZE_T_MAX)  &&\
662           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
663                                 v == (type)PY_SSIZE_T_MIN)))  ||\
664     (sizeof(type) == sizeof(Py_ssize_t) &&\
665           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
666                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)667 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
668     return (size_t) i < (size_t) limit;
669 }
670 #if defined (__cplusplus) && __cplusplus >= 201103L
671     #include <cstdlib>
672     #define __Pyx_sst_abs(value) std::abs(value)
673 #elif SIZEOF_INT >= SIZEOF_SIZE_T
674     #define __Pyx_sst_abs(value) abs(value)
675 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
676     #define __Pyx_sst_abs(value) labs(value)
677 #elif defined (_MSC_VER)
678     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
679 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
680     #define __Pyx_sst_abs(value) llabs(value)
681 #elif defined (__GNUC__)
682     #define __Pyx_sst_abs(value) __builtin_llabs(value)
683 #else
684     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
685 #endif
686 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
687 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
688 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
689 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
690 #define __Pyx_PyBytes_FromString        PyBytes_FromString
691 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
692 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
693 #if PY_MAJOR_VERSION < 3
694     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
695     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
696 #else
697     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
698     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
699 #endif
700 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
701 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
702 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
703 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
704 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
705 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
706 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
707 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
708 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
709 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
710 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
711 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
712 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
713 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
714 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
715 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)716 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
717     const Py_UNICODE *u_end = u;
718     while (*u_end++) ;
719     return (size_t)(u_end - u - 1);
720 }
721 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
722 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
723 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
724 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
725 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
726 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
727 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
728 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
729 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
730 #define __Pyx_PySequence_Tuple(obj)\
731     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
732 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
733 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
734 #if CYTHON_ASSUME_SAFE_MACROS
735 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
736 #else
737 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
738 #endif
739 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
740 #if PY_MAJOR_VERSION >= 3
741 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
742 #else
743 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
744 #endif
745 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
746 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
747 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)748 static int __Pyx_init_sys_getdefaultencoding_params(void) {
749     PyObject* sys;
750     PyObject* default_encoding = NULL;
751     PyObject* ascii_chars_u = NULL;
752     PyObject* ascii_chars_b = NULL;
753     const char* default_encoding_c;
754     sys = PyImport_ImportModule("sys");
755     if (!sys) goto bad;
756     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
757     Py_DECREF(sys);
758     if (!default_encoding) goto bad;
759     default_encoding_c = PyBytes_AsString(default_encoding);
760     if (!default_encoding_c) goto bad;
761     if (strcmp(default_encoding_c, "ascii") == 0) {
762         __Pyx_sys_getdefaultencoding_not_ascii = 0;
763     } else {
764         char ascii_chars[128];
765         int c;
766         for (c = 0; c < 128; c++) {
767             ascii_chars[c] = c;
768         }
769         __Pyx_sys_getdefaultencoding_not_ascii = 1;
770         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
771         if (!ascii_chars_u) goto bad;
772         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
773         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
774             PyErr_Format(
775                 PyExc_ValueError,
776                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
777                 default_encoding_c);
778             goto bad;
779         }
780         Py_DECREF(ascii_chars_u);
781         Py_DECREF(ascii_chars_b);
782     }
783     Py_DECREF(default_encoding);
784     return 0;
785 bad:
786     Py_XDECREF(default_encoding);
787     Py_XDECREF(ascii_chars_u);
788     Py_XDECREF(ascii_chars_b);
789     return -1;
790 }
791 #endif
792 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
793 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
794 #else
795 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
796 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
797 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)798 static int __Pyx_init_sys_getdefaultencoding_params(void) {
799     PyObject* sys;
800     PyObject* default_encoding = NULL;
801     char* default_encoding_c;
802     sys = PyImport_ImportModule("sys");
803     if (!sys) goto bad;
804     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
805     Py_DECREF(sys);
806     if (!default_encoding) goto bad;
807     default_encoding_c = PyBytes_AsString(default_encoding);
808     if (!default_encoding_c) goto bad;
809     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
810     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
811     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
812     Py_DECREF(default_encoding);
813     return 0;
814 bad:
815     Py_XDECREF(default_encoding);
816     return -1;
817 }
818 #endif
819 #endif
820 
821 
822 /* Test for GCC > 2.95 */
823 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
824   #define likely(x)   __builtin_expect(!!(x), 1)
825   #define unlikely(x) __builtin_expect(!!(x), 0)
826 #else /* !__GNUC__ or GCC < 2.95 */
827   #define likely(x)   (x)
828   #define unlikely(x) (x)
829 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)830 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
831 
832 static PyObject *__pyx_m = NULL;
833 static PyObject *__pyx_d;
834 static PyObject *__pyx_b;
835 static PyObject *__pyx_cython_runtime = NULL;
836 static PyObject *__pyx_empty_tuple;
837 static PyObject *__pyx_empty_bytes;
838 static PyObject *__pyx_empty_unicode;
839 static int __pyx_lineno;
840 static int __pyx_clineno = 0;
841 static const char * __pyx_cfilenm= __FILE__;
842 static const char *__pyx_filename;
843 
844 
845 static const char *__pyx_f[] = {
846   "src_c\\cython\\pygame\\_sdl2\\video.pyx",
847   "stringsource",
848   "src_c\\cython\\pygame\\_sdl2\\video.pxd",
849   "type.pxd",
850   "bool.pxd",
851   "complex.pxd",
852 };
853 
854 /*--- Type declarations ---*/
855 struct __pyx_obj_6pygame_5_sdl2_5video_Window;
856 struct __pyx_obj_6pygame_5_sdl2_5video_Renderer;
857 struct __pyx_obj_6pygame_5_sdl2_5video_Texture;
858 struct __pyx_obj_6pygame_5_sdl2_5video_Image;
859 struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers;
860 struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit;
861 struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal;
862 struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw;
863 struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw;
864 
865 /* "pygame/_sdl2/video.pxd":392
866  *
867  *     cpdef object get_viewport(self)
868  *     cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*)             # <<<<<<<<<<<<<<
869  *
870  * cdef class Texture:
871  */
872 struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit {
873   int __pyx_n;
874   pgRectObject *dest;
875   pgRectObject *area;
876   int special_flags;
877 };
878 
879 /* "pygame/_sdl2/video.pxd":401
880  *     cdef readonly int height
881  *
882  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*,             # <<<<<<<<<<<<<<
883  *                        bint flipX=*, bint flipY=*)
884  *     cpdef void draw(self, srcrect=*, dstrect=*, float angle=*, origin=*,
885  */
886 struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal {
887   int __pyx_n;
888   float angle;
889   SDL_Point *originptr;
890   int flipX;
891   int flipY;
892 };
893 
894 /* "pygame/_sdl2/video.pxd":403
895  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*,
896  *                        bint flipX=*, bint flipY=*)
897  *     cpdef void draw(self, srcrect=*, dstrect=*, float angle=*, origin=*,             # <<<<<<<<<<<<<<
898  *                     bint flipX=*, bint flipY=*)
899  *
900  */
901 struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw {
902   int __pyx_n;
903   PyObject *srcrect;
904   PyObject *dstrect;
905   float angle;
906   PyObject *origin;
907   int flipX;
908   int flipY;
909 };
910 
911 /* "pygame/_sdl2/video.pxd":419
912  *     cdef public Rect srcrect
913  *
914  *     cpdef void draw(self, srcrect=*, dstrect=*)             # <<<<<<<<<<<<<<
915  */
916 struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw {
917   int __pyx_n;
918   PyObject *srcrect;
919   PyObject *dstrect;
920 };
921 
922 /* "pygame/_sdl2/video.pxd":380
923  *
924  *
925  * cdef class Window:             # <<<<<<<<<<<<<<
926  *     cdef SDL_Window* _win
927  *     cdef int _is_borrowed
928  */
929 struct __pyx_obj_6pygame_5_sdl2_5video_Window {
930   PyObject_HEAD
931   SDL_Window *_win;
932   int _is_borrowed;
933 };
934 
935 
936 /* "pygame/_sdl2/video.pxd":384
937  *     cdef int _is_borrowed
938  *
939  * cdef class Renderer:             # <<<<<<<<<<<<<<
940  *     cdef SDL_Renderer* _renderer
941  *     cdef Color _draw_color
942  */
943 struct __pyx_obj_6pygame_5_sdl2_5video_Renderer {
944   PyObject_HEAD
945   struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *__pyx_vtab;
946   SDL_Renderer *_renderer;
947   pgColorObject *_draw_color;
948   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *_target;
949   struct __pyx_obj_6pygame_5_sdl2_5video_Window *_win;
950   int _is_borrowed;
951 };
952 
953 
954 /* "pygame/_sdl2/video.pxd":394
955  *     cpdef object blit(self, object source, Rect dest=*, Rect area=*, int special_flags=*)
956  *
957  * cdef class Texture:             # <<<<<<<<<<<<<<
958  *     cdef SDL_Texture* _tex
959  *     cdef Color _color
960  */
961 struct __pyx_obj_6pygame_5_sdl2_5video_Texture {
962   PyObject_HEAD
963   struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *__pyx_vtab;
964   SDL_Texture *_tex;
965   pgColorObject *_color;
966   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *renderer;
967   int width;
968   int height;
969 };
970 
971 
972 /* "pygame/_sdl2/video.pxd":406
973  *                     bint flipX=*, bint flipY=*)
974  *
975  * cdef class Image:             # <<<<<<<<<<<<<<
976  *     cdef Color _color
977  *     cdef public float angle
978  */
979 struct __pyx_obj_6pygame_5_sdl2_5video_Image {
980   PyObject_HEAD
981   struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image *__pyx_vtab;
982   pgColorObject *_color;
983   float angle;
984   SDL_Point _origin;
985   SDL_Point *_originptr;
986   int flipX;
987   int flipY;
988   float alpha;
989   SDL_BlendMode blend_mode;
990   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *texture;
991   pgRectObject *srcrect;
992 };
993 
994 
995 /* "pygame/_sdl2/video.pyx":75
996  *         )
997  *
998  * def get_drivers():             # <<<<<<<<<<<<<<
999  *     cdef int num = SDL_GetNumRenderDrivers()
1000  *     cdef SDL_RendererInfo info
1001  */
1002 struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers {
1003   PyObject_HEAD
1004   int __pyx_v_ind;
1005   SDL_RendererInfo __pyx_v_info;
1006   int __pyx_v_num;
1007   PyObject *__pyx_v_ret;
1008   int __pyx_t_0;
1009 };
1010 
1011 
1012 
1013 /* "pygame/_sdl2/video.pyx":922
1014  *
1015  *
1016  * cdef class Renderer:             # <<<<<<<<<<<<<<
1017  *
1018  *     @classmethod
1019  */
1020 
1021 struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer {
1022   PyObject *(*get_viewport)(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *, int __pyx_skip_dispatch);
1023   PyObject *(*blit)(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit *__pyx_optional_args);
1024 };
1025 static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *__pyx_vtabptr_6pygame_5_sdl2_5video_Renderer;
1026 
1027 
1028 /* "pygame/_sdl2/video.pyx":553
1029  *
1030  *
1031  * cdef class Texture:             # <<<<<<<<<<<<<<
1032  *     def __cinit__(self):
1033  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
1034  */
1035 
1036 struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture {
1037   PyObject *(*draw_internal)(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *, SDL_Rect *, SDL_Rect *, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal *__pyx_optional_args);
1038   void (*draw)(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw *__pyx_optional_args);
1039 };
1040 static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *__pyx_vtabptr_6pygame_5_sdl2_5video_Texture;
1041 
1042 
1043 /* "pygame/_sdl2/video.pyx":799
1044  *             raise error()
1045  *
1046  * cdef class Image:             # <<<<<<<<<<<<<<
1047  *
1048  *     def __cinit__(self):
1049  */
1050 
1051 struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image {
1052   void (*draw)(struct __pyx_obj_6pygame_5_sdl2_5video_Image *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw *__pyx_optional_args);
1053 };
1054 static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image *__pyx_vtabptr_6pygame_5_sdl2_5video_Image;
1055 
1056 /* --- Runtime support code (head) --- */
1057 /* Refnanny.proto */
1058 #ifndef CYTHON_REFNANNY
1059   #define CYTHON_REFNANNY 0
1060 #endif
1061 #if CYTHON_REFNANNY
1062   typedef struct {
1063     void (*INCREF)(void*, PyObject*, int);
1064     void (*DECREF)(void*, PyObject*, int);
1065     void (*GOTREF)(void*, PyObject*, int);
1066     void (*GIVEREF)(void*, PyObject*, int);
1067     void* (*SetupContext)(const char*, int, const char*);
1068     void (*FinishContext)(void**);
1069   } __Pyx_RefNannyAPIStruct;
1070   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1071   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1072   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1073 #ifdef WITH_THREAD
1074   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1075           if (acquire_gil) {\
1076               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1077               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1078               PyGILState_Release(__pyx_gilstate_save);\
1079           } else {\
1080               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1081           }
1082 #else
1083   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1084           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1085 #endif
1086   #define __Pyx_RefNannyFinishContext()\
1087           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1088   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1089   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1090   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1091   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1092   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1093   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1094   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1095   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1096 #else
1097   #define __Pyx_RefNannyDeclarations
1098   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1099   #define __Pyx_RefNannyFinishContext()
1100   #define __Pyx_INCREF(r) Py_INCREF(r)
1101   #define __Pyx_DECREF(r) Py_DECREF(r)
1102   #define __Pyx_GOTREF(r)
1103   #define __Pyx_GIVEREF(r)
1104   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1105   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1106   #define __Pyx_XGOTREF(r)
1107   #define __Pyx_XGIVEREF(r)
1108 #endif
1109 #define __Pyx_XDECREF_SET(r, v) do {\
1110         PyObject *tmp = (PyObject *) r;\
1111         r = v; __Pyx_XDECREF(tmp);\
1112     } while (0)
1113 #define __Pyx_DECREF_SET(r, v) do {\
1114         PyObject *tmp = (PyObject *) r;\
1115         r = v; __Pyx_DECREF(tmp);\
1116     } while (0)
1117 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1118 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1119 
1120 /* PyObjectGetAttrStr.proto */
1121 #if CYTHON_USE_TYPE_SLOTS
1122 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1123 #else
1124 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1125 #endif
1126 
1127 /* GetBuiltinName.proto */
1128 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1129 
1130 /* PyDictVersioning.proto */
1131 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1132 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1133 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1134 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1135     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1136     (cache_var) = (value);
1137 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1138     static PY_UINT64_T __pyx_dict_version = 0;\
1139     static PyObject *__pyx_dict_cached_value = NULL;\
1140     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1141         (VAR) = __pyx_dict_cached_value;\
1142     } else {\
1143         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1144         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1145     }\
1146 }
1147 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1148 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1149 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1150 #else
1151 #define __PYX_GET_DICT_VERSION(dict)  (0)
1152 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1153 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1154 #endif
1155 
1156 /* GetModuleGlobalName.proto */
1157 #if CYTHON_USE_DICT_VERSIONS
1158 #define __Pyx_GetModuleGlobalName(var, name)  {\
1159     static PY_UINT64_T __pyx_dict_version = 0;\
1160     static PyObject *__pyx_dict_cached_value = NULL;\
1161     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1162         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1163         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1164 }
1165 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1166     PY_UINT64_T __pyx_dict_version;\
1167     PyObject *__pyx_dict_cached_value;\
1168     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1169 }
1170 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1171 #else
1172 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1173 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1174 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1175 #endif
1176 
1177 /* PyFunctionFastCall.proto */
1178 #if CYTHON_FAST_PYCALL
1179 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1180     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1181 #if 1 || PY_VERSION_HEX < 0x030600B1
1182 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1183 #else
1184 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1185 #endif
1186 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1187     (sizeof(char [1 - 2*!(cond)]) - 1)
1188 #ifndef Py_MEMBER_SIZE
1189 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1190 #endif
1191   static size_t __pyx_pyframe_localsplus_offset = 0;
1192   #include "frameobject.h"
1193   #define __Pxy_PyFrame_Initialize_Offsets()\
1194     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1195      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1196   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1197     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1198 #endif
1199 
1200 /* PyObjectCall.proto */
1201 #if CYTHON_COMPILING_IN_CPYTHON
1202 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1203 #else
1204 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1205 #endif
1206 
1207 /* PyObjectCallMethO.proto */
1208 #if CYTHON_COMPILING_IN_CPYTHON
1209 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1210 #endif
1211 
1212 /* PyObjectCallNoArg.proto */
1213 #if CYTHON_COMPILING_IN_CPYTHON
1214 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1215 #else
1216 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1217 #endif
1218 
1219 /* PyCFunctionFastCall.proto */
1220 #if CYTHON_FAST_PYCCALL
1221 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1222 #else
1223 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1224 #endif
1225 
1226 /* PyObjectCallOneArg.proto */
1227 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1228 
1229 /* PyObjectSetAttrStr.proto */
1230 #if CYTHON_USE_TYPE_SLOTS
1231 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1232 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1233 #else
1234 #define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
1235 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1236 #endif
1237 
1238 /* RaiseArgTupleInvalid.proto */
1239 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1240     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1241 
1242 /* RaiseDoubleKeywords.proto */
1243 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1244 
1245 /* ParseKeywords.proto */
1246 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1247     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1248     const char* function_name);
1249 
1250 /* ArgTypeTest.proto */
1251 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1252     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1253         __Pyx__ArgTypeTest(obj, type, name, exact))
1254 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1255 
1256 /* PyObjectCall2Args.proto */
1257 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1258 
1259 /* ListCompAppend.proto */
1260 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1261 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1262     PyListObject* L = (PyListObject*) list;
1263     Py_ssize_t len = Py_SIZE(list);
1264     if (likely(L->allocated > len)) {
1265         Py_INCREF(x);
1266         PyList_SET_ITEM(list, len, x);
1267         __Pyx_SET_SIZE(list, len + 1);
1268         return 0;
1269     }
1270     return PyList_Append(list, x);
1271 }
1272 #else
1273 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1274 #endif
1275 
1276 /* PyIntBinop.proto */
1277 #if !CYTHON_COMPILING_IN_PYPY
1278 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1279 #else
1280 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1281     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1282 #endif
1283 
1284 /* PyIntBinop.proto */
1285 #if !CYTHON_COMPILING_IN_PYPY
1286 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1287 #else
1288 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
1289     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
1290 #endif
1291 
1292 /* PyThreadStateGet.proto */
1293 #if CYTHON_FAST_THREAD_STATE
1294 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1295 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1296 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1297 #else
1298 #define __Pyx_PyThreadState_declare
1299 #define __Pyx_PyThreadState_assign
1300 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1301 #endif
1302 
1303 /* PyErrFetchRestore.proto */
1304 #if CYTHON_FAST_THREAD_STATE
1305 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1306 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1307 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1308 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1309 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1310 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1311 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1312 #if CYTHON_COMPILING_IN_CPYTHON
1313 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1314 #else
1315 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1316 #endif
1317 #else
1318 #define __Pyx_PyErr_Clear() PyErr_Clear()
1319 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1320 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1321 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1322 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1323 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1324 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1325 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1326 #endif
1327 
1328 /* RaiseException.proto */
1329 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1330 
1331 /* tp_new.proto */
1332 #define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL)
__Pyx_tp_new_kwargs(PyObject * type_obj,PyObject * args,PyObject * kwargs)1333 static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) {
1334     return (PyObject*) (((PyTypeObject*)type_obj)->tp_new((PyTypeObject*)type_obj, args, kwargs));
1335 }
1336 
1337 /* ExtTypeTest.proto */
1338 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1339 
1340 /* RaiseTooManyValuesToUnpack.proto */
1341 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1342 
1343 /* RaiseNeedMoreValuesToUnpack.proto */
1344 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1345 
1346 /* IterFinish.proto */
1347 static CYTHON_INLINE int __Pyx_IterFinish(void);
1348 
1349 /* UnpackItemEndCheck.proto */
1350 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1351 
1352 /* py_dict_items.proto */
1353 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
1354 
1355 /* UnpackUnboundCMethod.proto */
1356 typedef struct {
1357     PyObject *type;
1358     PyObject **method_name;
1359     PyCFunction func;
1360     PyObject *method;
1361     int flag;
1362 } __Pyx_CachedCFunction;
1363 
1364 /* CallUnboundCMethod0.proto */
1365 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
1366 #if CYTHON_COMPILING_IN_CPYTHON
1367 #define __Pyx_CallUnboundCMethod0(cfunc, self)\
1368     (likely((cfunc)->func) ?\
1369         (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
1370          (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
1371             (PY_VERSION_HEX >= 0x030700A0 ?\
1372                 (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
1373                 (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
1374           (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
1375             (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
1376             (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
1377                ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
1378                __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
1379         __Pyx__CallUnboundCMethod0(cfunc, self))
1380 #else
1381 #define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
1382 #endif
1383 
1384 /* GetItemInt.proto */
1385 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1386     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1387     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1388     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1389                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1390 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1391     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1392     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1393     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1394 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1395                                                               int wraparound, int boundscheck);
1396 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1397     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1398     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1399     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1400 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1401                                                               int wraparound, int boundscheck);
1402 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1403 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1404                                                      int is_list, int wraparound, int boundscheck);
1405 
1406 /* ObjectGetItem.proto */
1407 #if CYTHON_USE_TYPE_SLOTS
1408 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1409 #else
1410 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1411 #endif
1412 
1413 /* GetTopmostException.proto */
1414 #if CYTHON_USE_EXC_INFO_STACK
1415 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1416 #endif
1417 
1418 /* SaveResetException.proto */
1419 #if CYTHON_FAST_THREAD_STATE
1420 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1421 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1422 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1423 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1424 #else
1425 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1426 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1427 #endif
1428 
1429 /* PyErrExceptionMatches.proto */
1430 #if CYTHON_FAST_THREAD_STATE
1431 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1432 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1433 #else
1434 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1435 #endif
1436 
1437 /* GetException.proto */
1438 #if CYTHON_FAST_THREAD_STATE
1439 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1440 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1441 #else
1442 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1443 #endif
1444 
1445 /* Import.proto */
1446 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1447 
1448 /* IncludeStringH.proto */
1449 #include <string.h>
1450 
1451 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1452 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1453     int byteorder = 0;
1454     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1455 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1456 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1457     int byteorder = -1;
1458     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1459 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1460 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1461     int byteorder = 1;
1462     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1463 }
1464 
1465 /* decode_c_string.proto */
1466 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1467          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1468          const char* encoding, const char* errors,
1469          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1470 
1471 /* WriteUnraisableException.proto */
1472 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1473                                   int lineno, const char *filename,
1474                                   int full_traceback, int nogil);
1475 
1476 /* KeywordStringCheck.proto */
1477 static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
1478 
1479 /* PyObjectGetMethod.proto */
1480 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1481 
1482 /* PyObjectCallMethod0.proto */
1483 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1484 
1485 /* RaiseNoneIterError.proto */
1486 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1487 
1488 /* UnpackTupleError.proto */
1489 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1490 
1491 /* UnpackTuple2.proto */
1492 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1493     (likely(is_tuple || PyTuple_Check(tuple)) ?\
1494         (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1495             __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1496             (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1497         __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1498 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1499     PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1500 static int __Pyx_unpack_tuple2_generic(
1501     PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1502 
1503 /* dict_iter.proto */
1504 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1505                                                    Py_ssize_t* p_orig_length, int* p_is_dict);
1506 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1507                                               PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1508 
1509 /* DictGetItem.proto */
1510 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1511 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1512 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1513     (likely(PyDict_CheckExact(obj)) ?\
1514      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1515 #else
1516 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1517 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1518 #endif
1519 
1520 /* SliceObject.proto */
1521 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1522         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1523         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1524         int has_cstart, int has_cstop, int wraparound);
1525 
1526 /* SliceObject.proto */
1527 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1528     __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1529 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1530         PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1531         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1532         int has_cstart, int has_cstop, int wraparound);
1533 
1534 /* GetAttr.proto */
1535 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1536 
1537 /* HasAttr.proto */
1538 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1539 
1540 /* TypeImport.proto */
1541 #ifndef __PYX_HAVE_RT_ImportType_proto
1542 #define __PYX_HAVE_RT_ImportType_proto
1543 enum __Pyx_ImportType_CheckSize {
1544    __Pyx_ImportType_CheckSize_Error = 0,
1545    __Pyx_ImportType_CheckSize_Warn = 1,
1546    __Pyx_ImportType_CheckSize_Ignore = 2
1547 };
1548 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1549 #endif
1550 
1551 /* PyObject_GenericGetAttrNoDict.proto */
1552 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1553 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1554 #else
1555 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1556 #endif
1557 
1558 /* PyObject_GenericGetAttr.proto */
1559 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1560 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1561 #else
1562 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1563 #endif
1564 
1565 /* PyObjectGetAttrStrNoError.proto */
1566 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1567 
1568 /* SetupReduce.proto */
1569 static int __Pyx_setup_reduce(PyObject* type_obj);
1570 
1571 /* SetVTable.proto */
1572 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1573 
1574 /* ImportFrom.proto */
1575 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1576 
1577 /* FetchCommonType.proto */
1578 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1579 
1580 /* CythonFunctionShared.proto */
1581 #define __Pyx_CyFunction_USED 1
1582 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
1583 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
1584 #define __Pyx_CYFUNCTION_CCLASS        0x04
1585 #define __Pyx_CyFunction_GetClosure(f)\
1586     (((__pyx_CyFunctionObject *) (f))->func_closure)
1587 #define __Pyx_CyFunction_GetClassObj(f)\
1588     (((__pyx_CyFunctionObject *) (f))->func_classobj)
1589 #define __Pyx_CyFunction_Defaults(type, f)\
1590     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1591 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1592     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1593 typedef struct {
1594     PyCFunctionObject func;
1595 #if PY_VERSION_HEX < 0x030500A0
1596     PyObject *func_weakreflist;
1597 #endif
1598     PyObject *func_dict;
1599     PyObject *func_name;
1600     PyObject *func_qualname;
1601     PyObject *func_doc;
1602     PyObject *func_globals;
1603     PyObject *func_code;
1604     PyObject *func_closure;
1605     PyObject *func_classobj;
1606     void *defaults;
1607     int defaults_pyobjects;
1608     size_t defaults_size;  // used by FusedFunction for copying defaults
1609     int flags;
1610     PyObject *defaults_tuple;
1611     PyObject *defaults_kwdict;
1612     PyObject *(*defaults_getter)(PyObject *);
1613     PyObject *func_annotations;
1614 } __pyx_CyFunctionObject;
1615 static PyTypeObject *__pyx_CyFunctionType = 0;
1616 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1617 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1618                                       int flags, PyObject* qualname,
1619                                       PyObject *self,
1620                                       PyObject *module, PyObject *globals,
1621                                       PyObject* code);
1622 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1623                                                          size_t size,
1624                                                          int pyobjects);
1625 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1626                                                             PyObject *tuple);
1627 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1628                                                              PyObject *dict);
1629 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1630                                                               PyObject *dict);
1631 static int __pyx_CyFunction_init(void);
1632 
1633 /* CythonFunction.proto */
1634 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1635                                       int flags, PyObject* qualname,
1636                                       PyObject *closure,
1637                                       PyObject *module, PyObject *globals,
1638                                       PyObject* code);
1639 
1640 /* SetNameInClass.proto */
1641 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1642 #define __Pyx_SetNameInClass(ns, name, value)\
1643     (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1644 #elif CYTHON_COMPILING_IN_CPYTHON
1645 #define __Pyx_SetNameInClass(ns, name, value)\
1646     (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1647 #else
1648 #define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
1649 #endif
1650 
1651 /* CalculateMetaclass.proto */
1652 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1653 
1654 /* Py3ClassCreate.proto */
1655 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1656                                            PyObject *mkw, PyObject *modname, PyObject *doc);
1657 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1658                                       PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1659 
1660 /* ClassMethod.proto */
1661 #include "descrobject.h"
1662 static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method);
1663 
1664 /* GetNameInClass.proto */
1665 #define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
1666 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);
1667 
1668 /* CLineInTraceback.proto */
1669 #ifdef CYTHON_CLINE_IN_TRACEBACK
1670 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1671 #else
1672 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1673 #endif
1674 
1675 /* CodeObjectCache.proto */
1676 typedef struct {
1677     PyCodeObject* code_object;
1678     int code_line;
1679 } __Pyx_CodeObjectCacheEntry;
1680 struct __Pyx_CodeObjectCache {
1681     int count;
1682     int max_count;
1683     __Pyx_CodeObjectCacheEntry* entries;
1684 };
1685 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1686 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1687 static PyCodeObject *__pyx_find_code_object(int code_line);
1688 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1689 
1690 /* AddTraceback.proto */
1691 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1692                                int py_line, const char *filename);
1693 
1694 /* GCCDiagnostics.proto */
1695 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1696 #define __Pyx_HAS_GCC_DIAGNOSTIC
1697 #endif
1698 
1699 /* CIntToPy.proto */
1700 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1701 
1702 /* CIntToPy.proto */
1703 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint32(Uint32 value);
1704 
1705 /* CIntFromPy.proto */
1706 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1707 
1708 /* CIntFromPy.proto */
1709 static CYTHON_INLINE Uint8 __Pyx_PyInt_As_Uint8(PyObject *);
1710 
1711 /* CIntToPy.proto */
1712 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1713 
1714 /* CIntFromPy.proto */
1715 static CYTHON_INLINE Uint32 __Pyx_PyInt_As_Uint32(PyObject *);
1716 
1717 /* CIntToPy.proto */
1718 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SDL_bool(SDL_bool value);
1719 
1720 /* CIntToPy.proto */
1721 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint8(Uint8 value);
1722 
1723 /* CIntToPy.proto */
1724 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SDL_BlendMode(SDL_BlendMode value);
1725 
1726 /* CIntFromPy.proto */
1727 static CYTHON_INLINE SDL_BlendMode __Pyx_PyInt_As_SDL_BlendMode(PyObject *);
1728 
1729 /* CIntFromPy.proto */
1730 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1731 
1732 /* FastTypeChecks.proto */
1733 #if CYTHON_COMPILING_IN_CPYTHON
1734 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1735 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1736 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1737 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1738 #else
1739 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1740 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1741 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1742 #endif
1743 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1744 
1745 /* SwapException.proto */
1746 #if CYTHON_FAST_THREAD_STATE
1747 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1748 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1749 #else
1750 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1751 #endif
1752 
1753 /* PyObjectCallMethod1.proto */
1754 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1755 
1756 /* CoroutineBase.proto */
1757 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
1758 #if CYTHON_USE_EXC_INFO_STACK
1759 #define __Pyx_ExcInfoStruct  _PyErr_StackItem
1760 #else
1761 typedef struct {
1762     PyObject *exc_type;
1763     PyObject *exc_value;
1764     PyObject *exc_traceback;
1765 } __Pyx_ExcInfoStruct;
1766 #endif
1767 typedef struct {
1768     PyObject_HEAD
1769     __pyx_coroutine_body_t body;
1770     PyObject *closure;
1771     __Pyx_ExcInfoStruct gi_exc_state;
1772     PyObject *gi_weakreflist;
1773     PyObject *classobj;
1774     PyObject *yieldfrom;
1775     PyObject *gi_name;
1776     PyObject *gi_qualname;
1777     PyObject *gi_modulename;
1778     PyObject *gi_code;
1779     PyObject *gi_frame;
1780     int resume_label;
1781     char is_running;
1782 } __pyx_CoroutineObject;
1783 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
1784     PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
1785     PyObject *name, PyObject *qualname, PyObject *module_name);
1786 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
1787             __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
1788             PyObject *name, PyObject *qualname, PyObject *module_name);
1789 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
1790 static int __Pyx_Coroutine_clear(PyObject *self);
1791 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
1792 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
1793 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
1794 #if CYTHON_USE_EXC_INFO_STACK
1795 #define __Pyx_Coroutine_SwapException(self)
1796 #define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
1797 #else
1798 #define __Pyx_Coroutine_SwapException(self) {\
1799     __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
1800     __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
1801     }
1802 #define __Pyx_Coroutine_ResetAndClearException(self) {\
1803     __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
1804     (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
1805     }
1806 #endif
1807 #if CYTHON_FAST_THREAD_STATE
1808 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1809     __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
1810 #else
1811 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
1812     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
1813 #endif
1814 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
1815 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
1816 
1817 /* PatchModuleWithCoroutine.proto */
1818 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
1819 
1820 /* PatchGeneratorABC.proto */
1821 static int __Pyx_patch_abc(void);
1822 
1823 /* Generator.proto */
1824 #define __Pyx_Generator_USED
1825 static PyTypeObject *__pyx_GeneratorType = 0;
1826 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
1827 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
1828     __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
1829 static PyObject *__Pyx_Generator_Next(PyObject *self);
1830 static int __pyx_Generator_init(void);
1831 
1832 /* CheckBinaryVersion.proto */
1833 static int __Pyx_check_binary_version(void);
1834 
1835 /* InitStrings.proto */
1836 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1837 
1838 static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, SDL_Rect *__pyx_v_csrcrect, SDL_Rect *__pyx_v_cdstrect, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal *__pyx_optional_args); /* proto*/
1839 static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw *__pyx_optional_args); /* proto*/
1840 static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw *__pyx_optional_args); /* proto*/
1841 static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
1842 static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit *__pyx_optional_args); /* proto*/
1843 
1844 /* Module declarations from 'libc.string' */
1845 
1846 /* Module declarations from 'libc.stdio' */
1847 
1848 /* Module declarations from 'pygame._sdl2.sdl2' */
1849 
1850 /* Module declarations from 'pygame' */
1851 
1852 /* Module declarations from 'cpython.version' */
1853 
1854 /* Module declarations from '__builtin__' */
1855 
1856 /* Module declarations from 'cpython.type' */
1857 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1858 
1859 /* Module declarations from 'cpython.object' */
1860 
1861 /* Module declarations from 'cpython.ref' */
1862 
1863 /* Module declarations from 'cpython.exc' */
1864 
1865 /* Module declarations from 'cpython.module' */
1866 
1867 /* Module declarations from 'cpython.mem' */
1868 
1869 /* Module declarations from 'cpython.tuple' */
1870 
1871 /* Module declarations from 'cpython.list' */
1872 
1873 /* Module declarations from 'cpython.sequence' */
1874 
1875 /* Module declarations from 'cpython.mapping' */
1876 
1877 /* Module declarations from 'cpython.iterator' */
1878 
1879 /* Module declarations from 'cpython.number' */
1880 
1881 /* Module declarations from 'cpython.int' */
1882 
1883 /* Module declarations from '__builtin__' */
1884 
1885 /* Module declarations from 'cpython.bool' */
1886 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1887 
1888 /* Module declarations from 'cpython.long' */
1889 
1890 /* Module declarations from 'cpython.float' */
1891 
1892 /* Module declarations from '__builtin__' */
1893 
1894 /* Module declarations from 'cpython.complex' */
1895 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1896 
1897 /* Module declarations from 'cpython.string' */
1898 
1899 /* Module declarations from 'cpython.unicode' */
1900 
1901 /* Module declarations from 'cpython.dict' */
1902 
1903 /* Module declarations from 'cpython.instance' */
1904 
1905 /* Module declarations from 'cpython.function' */
1906 
1907 /* Module declarations from 'cpython.method' */
1908 
1909 /* Module declarations from 'cpython.weakref' */
1910 
1911 /* Module declarations from 'cpython.getargs' */
1912 
1913 /* Module declarations from 'cpython.pythread' */
1914 
1915 /* Module declarations from 'cpython.pystate' */
1916 
1917 /* Module declarations from 'cpython.cobject' */
1918 
1919 /* Module declarations from 'cpython.oldbuffer' */
1920 
1921 /* Module declarations from 'cpython.set' */
1922 
1923 /* Module declarations from 'cpython.buffer' */
1924 
1925 /* Module declarations from 'cpython.bytes' */
1926 
1927 /* Module declarations from 'cpython.pycapsule' */
1928 
1929 /* Module declarations from 'cpython' */
1930 
1931 /* Module declarations from 'libc.stdlib' */
1932 
1933 /* Module declarations from 'pygame._sdl2.video' */
1934 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Color = 0;
1935 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Rect = 0;
1936 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Window = 0;
1937 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Renderer = 0;
1938 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Texture = 0;
1939 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video_Image = 0;
1940 static PyTypeObject *__pyx_ptype_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers = 0;
1941 static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int); /*proto*/
1942 #define __Pyx_MODULE_NAME "pygame._sdl2.video"
1943 extern int __pyx_module_is_main_pygame___sdl2__video;
1944 int __pyx_module_is_main_pygame___sdl2__video = 0;
1945 
1946 /* Implementation of 'pygame._sdl2.video' */
1947 static PyObject *__pyx_builtin_staticmethod;
1948 static PyObject *__pyx_builtin_MemoryError;
1949 static PyObject *__pyx_builtin_enumerate;
1950 static PyObject *__pyx_builtin_reversed;
1951 static PyObject *__pyx_builtin_ValueError;
1952 static PyObject *__pyx_builtin_KeyError;
1953 static PyObject *__pyx_builtin_TypeError;
1954 static const char __pyx_k_h[] = "h";
1955 static const char __pyx_k_i[] = "i";
1956 static const char __pyx_k_s[] = "s";
1957 static const char __pyx_k_w[] = "w";
1958 static const char __pyx_k_x[] = "x";
1959 static const char __pyx_k_y[] = "y";
1960 static const char __pyx_k_OK[] = "OK";
1961 static const char __pyx_k_p1[] = "p1";
1962 static const char __pyx_k_p2[] = "p2";
1963 static const char __pyx_k__36[] = "";
1964 static const char __pyx_k_but[] = "but";
1965 static const char __pyx_k_doc[] = "__doc__";
1966 static const char __pyx_k_ind[] = "ind";
1967 static const char __pyx_k_num[] = "num";
1968 static const char __pyx_k_ptr[] = "ptr";
1969 static const char __pyx_k_ret[] = "ret";
1970 static const char __pyx_k_win[] = "win";
1971 static const char __pyx_k_area[] = "area";
1972 static const char __pyx_k_args[] = "args";
1973 static const char __pyx_k_blit[] = "blit";
1974 static const char __pyx_k_data[] = "data";
1975 static const char __pyx_k_dest[] = "dest";
1976 static const char __pyx_k_draw[] = "draw";
1977 static const char __pyx_k_info[] = "info";
1978 static const char __pyx_k_load[] = "load";
1979 static const char __pyx_k_main[] = "__main__";
1980 static const char __pyx_k_name[] = "__name__";
1981 static const char __pyx_k_repr[] = "__repr__";
1982 static const char __pyx_k_self[] = "self";
1983 static const char __pyx_k_send[] = "send";
1984 static const char __pyx_k_size[] = "size";
1985 static const char __pyx_k_test[] = "__test__";
1986 static const char __pyx_k_utf8[] = "utf8";
1987 static const char __pyx_k_warn[] = "warn";
1988 static const char __pyx_k_Image[] = "Image";
1989 static const char __pyx_k_alpha[] = "alpha";
1990 static const char __pyx_k_angle[] = "angle";
1991 static const char __pyx_k_class[] = "__class__";
1992 static const char __pyx_k_close[] = "close";
1993 static const char __pyx_k_color[] = "color";
1994 static const char __pyx_k_depth[] = "depth";
1995 static const char __pyx_k_error[] = "error";
1996 static const char __pyx_k_flags[] = "flags";
1997 static const char __pyx_k_flipX[] = "flipX";
1998 static const char __pyx_k_flipY[] = "flipY";
1999 static const char __pyx_k_image[] = "image";
2000 static const char __pyx_k_index[] = "index";
2001 static const char __pyx_k_items[] = "items";
2002 static const char __pyx_k_throw[] = "throw";
2003 static const char __pyx_k_title[] = "title";
2004 static const char __pyx_k_vsync[] = "vsync";
2005 static const char __pyx_k_Window[] = "Window";
2006 static const char __pyx_k_button[] = "button";
2007 static const char __pyx_k_encode[] = "encode";
2008 static const char __pyx_k_hidden[] = "hidden";
2009 static const char __pyx_k_import[] = "__import__";
2010 static const char __pyx_k_module[] = "__module__";
2011 static const char __pyx_k_name_2[] = "name";
2012 static const char __pyx_k_opengl[] = "opengl";
2013 static const char __pyx_k_origin[] = "origin";
2014 static const char __pyx_k_pygame[] = "pygame";
2015 static const char __pyx_k_reduce[] = "__reduce__";
2016 static const char __pyx_k_source[] = "source";
2017 static const char __pyx_k_static[] = "static";
2018 static const char __pyx_k_target[] = "target";
2019 static const char __pyx_k_vulkan[] = "vulkan";
2020 static const char __pyx_k_window[] = "window";
2021 static const char __pyx_k_Texture[] = "Texture";
2022 static const char __pyx_k_buttons[] = "buttons";
2023 static const char __pyx_k_desktop[] = "desktop";
2024 static const char __pyx_k_destroy[] = "destroy";
2025 static const char __pyx_k_dstrect[] = "dstrect";
2026 static const char __pyx_k_foreign[] = "foreign";
2027 static const char __pyx_k_message[] = "message";
2028 static const char __pyx_k_pkgdata[] = "pkgdata";
2029 static const char __pyx_k_prepare[] = "__prepare__";
2030 static const char __pyx_k_srcrect[] = "srcrect";
2031 static const char __pyx_k_surface[] = "surface";
2032 static const char __pyx_k_texture[] = "texture";
2033 static const char __pyx_k_tooltip[] = "tooltip";
2034 static const char __pyx_k_utility[] = "utility";
2035 static const char __pyx_k_KeyError[] = "KeyError";
2036 static const char __pyx_k_Renderer[] = "Renderer";
2037 static const char __pyx_k_buttonid[] = "buttonid";
2038 static const char __pyx_k_errorfnc[] = "errorfnc";
2039 static const char __pyx_k_get_rect[] = "get_rect";
2040 static const char __pyx_k_getstate[] = "__getstate__";
2041 static const char __pyx_k_position[] = "position";
2042 static const char __pyx_k_qualname[] = "__qualname__";
2043 static const char __pyx_k_renderer[] = "renderer";
2044 static const char __pyx_k_reversed[] = "reversed";
2045 static const char __pyx_k_set_icon[] = "set_icon";
2046 static const char __pyx_k_setstate[] = "__setstate__";
2047 static const char __pyx_k_surf_ptr[] = "surf_ptr";
2048 static const char __pyx_k_TypeError[] = "TypeError";
2049 static const char __pyx_k_c_buttons[] = "c_buttons";
2050 static const char __pyx_k_enumerate[] = "enumerate";
2051 static const char __pyx_k_get_width[] = "get_width";
2052 static const char __pyx_k_maximized[] = "maximized";
2053 static const char __pyx_k_metaclass[] = "__metaclass__";
2054 static const char __pyx_k_minimized[] = "minimized";
2055 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2056 static const char __pyx_k_resizable[] = "resizable";
2057 static const char __pyx_k_streaming[] = "streaming";
2058 static const char __pyx_k_ValueError[] = "ValueError";
2059 static const char __pyx_k_blend_mode[] = "blend_mode";
2060 static const char __pyx_k_borderless[] = "borderless";
2061 static const char __pyx_k_fullscreen[] = "fullscreen";
2062 static const char __pyx_k_get_height[] = "get_height";
2063 static const char __pyx_k_input_only[] = "input_only";
2064 static const char __pyx_k_messagebox[] = "messagebox";
2065 static const char __pyx_k_popup_menu[] = "popup_menu";
2066 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2067 static const char __pyx_k_renderer_2[] = "_renderer";
2068 static const char __pyx_k_MemoryError[] = "MemoryError";
2069 static const char __pyx_k_accelerated[] = "accelerated";
2070 static const char __pyx_k_from_window[] = "from_window";
2071 static const char __pyx_k_getResource[] = "getResource";
2072 static const char __pyx_k_get_drivers[] = "get_drivers";
2073 static const char __pyx_k_input_focus[] = "input_focus";
2074 static const char __pyx_k_mouse_focus[] = "mouse_focus";
2075 static const char __pyx_k_DEFAULT_SIZE[] = "DEFAULT_SIZE";
2076 static const char __pyx_k_buttons_utf8[] = "buttons_utf8";
2077 static const char __pyx_k_from_surface[] = "from_surface";
2078 static const char __pyx_k_get_viewport[] = "get_viewport";
2079 static const char __pyx_k_set_colorkey[] = "set_colorkey";
2080 static const char __pyx_k_skip_taskbar[] = "skip_taskbar";
2081 static const char __pyx_k_staticmethod[] = "staticmethod";
2082 static const char __pyx_k_allow_highdpi[] = "allow_highdpi";
2083 static const char __pyx_k_always_on_top[] = "always_on_top";
2084 static const char __pyx_k_escape_button[] = "escape_button";
2085 static const char __pyx_k_input_grabbed[] = "input_grabbed";
2086 static const char __pyx_k_kwarg_to_flag[] = "_kwarg_to_flag";
2087 static const char __pyx_k_mouse_capture[] = "mouse_capture";
2088 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2089 static const char __pyx_k_return_button[] = "return_button";
2090 static const char __pyx_k_special_flags[] = "special_flags";
2091 static const char __pyx_k_pygame_pkgdata[] = "pygame.pkgdata";
2092 static const char __pyx_k_target_texture[] = "target_texture";
2093 static const char __pyx_k_textureOrImage[] = "textureOrImage";
2094 static const char __pyx_k_pygame_icon_bmp[] = "pygame_icon.bmp";
2095 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2096 static const char __pyx_k_MESSAGEBOX_ERROR[] = "MESSAGEBOX_ERROR";
2097 static const char __pyx_k_max_texture_width[] = "max_texture_width";
2098 static const char __pyx_k_MESSAGEBOX_WARNING[] = "MESSAGEBOX_WARNING";
2099 static const char __pyx_k_RendererDriverInfo[] = "RendererDriverInfo";
2100 static const char __pyx_k_WINDOWPOS_CENTERED[] = "WINDOWPOS_CENTERED";
2101 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2102 static const char __pyx_k_fullscreen_desktop[] = "fullscreen_desktop";
2103 static const char __pyx_k_get_grabbed_window[] = "get_grabbed_window";
2104 static const char __pyx_k_max_texture_height[] = "max_texture_height";
2105 static const char __pyx_k_pygame__sdl2_video[] = "pygame._sdl2.video";
2106 static const char __pyx_k_WINDOWPOS_UNDEFINED[] = "WINDOWPOS_UNDEFINED";
2107 static const char __pyx_k_from_display_module[] = "from_display_module";
2108 static const char __pyx_k_num_texture_formats[] = "num_texture_formats";
2109 static const char __pyx_k_unknown_parameter_s[] = "unknown parameter: %s";
2110 static const char __pyx_k_expected_a_rectangle[] = "expected a rectangle";
2111 static const char __pyx_k_MESSAGEBOX_INFORMATION[] = "MESSAGEBOX_INFORMATION";
2112 static const char __pyx_k_source_must_be_drawable[] = "source must be drawable";
2113 static const char __pyx_k_the_surface_is_too_small[] = "the surface is too small";
2114 static const char __pyx_k_RendererDriverInfo___repr[] = "RendererDriverInfo.__repr__";
2115 static const char __pyx_k_area_must_be_None_or_a_rect[] = "area must be None or a rect";
2116 static const char __pyx_k_size_must_have_two_elements[] = "size must have two elements";
2117 static const char __pyx_k_rect_values_are_out_of_range[] = "rect values are out of range";
2118 static const char __pyx_k_2nd_argument_must_be_a_surface[] = "2nd argument must be a surface";
2119 static const char __pyx_k_srcrect_must_be_a_rect_or_None[] = "srcrect must be a rect or None";
2120 static const char __pyx_k_dstrect_must_be_a_position_rect[] = "dstrect must be a position, rect, or None";
2121 static const char __pyx_k_only_one_of_static_streaming_or[] = "only one of static, streaming, or target can be true";
2122 static const char __pyx_k_s_name_s_flags_0x_02x_num_textu[] = "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>";
2123 static const char __pyx_k_src_c_cython_pygame__sdl2_video[] = "src_c\\cython\\pygame\\_sdl2\\video.pyx";
2124 static const char __pyx_k_surface_must_be_a_surface_or_No[] = "'surface' must be a surface or None";
2125 static const char __pyx_k_the_argument_is_not_a_rectangle[] = "the argument is not a rectangle or None";
2126 static const char __pyx_k_area_must_be_a_rectangle_or_None[] = "area must be a rectangle or None";
2127 static const char __pyx_k_fullscreen_and_fullscreen_deskto[] = "fullscreen and fullscreen_desktop cannot be used at the same time.";
2128 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2129 static const char __pyx_k_no_standard_masks_exist_for_give[] = "no standard masks exist for given bitdepth with alpha";
2130 static const char __pyx_k_not_enough_memory_for_the_surfac[] = "not enough memory for the surface";
2131 static const char __pyx_k_self__renderer_cannot_be_convert[] = "self._renderer cannot be converted to a Python object for pickling";
2132 static const char __pyx_k_self__win_cannot_be_converted_to[] = "self._win cannot be converted to a Python object for pickling";
2133 static const char __pyx_k_size_must_contain_two_positive_v[] = "size must contain two positive values";
2134 static const char __pyx_k_srcrect_must_be_None_or_a_rectan[] = "srcrect must be None or a rectangle";
2135 static const char __pyx_k_surface_must_be_a_Surface_object[] = "surface must be a Surface object";
2136 static const char __pyx_k_target_must_be_a_Texture_or_None[] = "target must be a Texture or None";
2137 static const char __pyx_k_update_source_should_be_a_Surfac[] = "update source should be a Surface.";
2138 static PyObject *__pyx_kp_s_2nd_argument_must_be_a_surface;
2139 static PyObject *__pyx_n_s_DEFAULT_SIZE;
2140 static PyObject *__pyx_n_s_Image;
2141 static PyObject *__pyx_n_s_KeyError;
2142 static PyObject *__pyx_n_s_MESSAGEBOX_ERROR;
2143 static PyObject *__pyx_n_s_MESSAGEBOX_INFORMATION;
2144 static PyObject *__pyx_n_s_MESSAGEBOX_WARNING;
2145 static PyObject *__pyx_n_s_MemoryError;
2146 static PyObject *__pyx_n_s_OK;
2147 static PyObject *__pyx_n_s_Renderer;
2148 static PyObject *__pyx_n_s_RendererDriverInfo;
2149 static PyObject *__pyx_n_s_RendererDriverInfo___repr;
2150 static PyObject *__pyx_n_s_Texture;
2151 static PyObject *__pyx_n_s_TypeError;
2152 static PyObject *__pyx_n_s_ValueError;
2153 static PyObject *__pyx_n_s_WINDOWPOS_CENTERED;
2154 static PyObject *__pyx_n_s_WINDOWPOS_UNDEFINED;
2155 static PyObject *__pyx_n_s_Window;
2156 static PyObject *__pyx_n_s__36;
2157 static PyObject *__pyx_n_s_accelerated;
2158 static PyObject *__pyx_n_s_allow_highdpi;
2159 static PyObject *__pyx_n_s_alpha;
2160 static PyObject *__pyx_n_s_always_on_top;
2161 static PyObject *__pyx_n_s_angle;
2162 static PyObject *__pyx_n_s_area;
2163 static PyObject *__pyx_kp_s_area_must_be_None_or_a_rect;
2164 static PyObject *__pyx_kp_s_area_must_be_a_rectangle_or_None;
2165 static PyObject *__pyx_n_s_args;
2166 static PyObject *__pyx_n_s_blend_mode;
2167 static PyObject *__pyx_n_s_blit;
2168 static PyObject *__pyx_n_s_borderless;
2169 static PyObject *__pyx_n_s_but;
2170 static PyObject *__pyx_n_s_button;
2171 static PyObject *__pyx_n_s_buttonid;
2172 static PyObject *__pyx_n_s_buttons;
2173 static PyObject *__pyx_n_s_buttons_utf8;
2174 static PyObject *__pyx_n_s_c_buttons;
2175 static PyObject *__pyx_n_s_class;
2176 static PyObject *__pyx_n_s_cline_in_traceback;
2177 static PyObject *__pyx_n_s_close;
2178 static PyObject *__pyx_n_s_color;
2179 static PyObject *__pyx_n_s_data;
2180 static PyObject *__pyx_n_s_depth;
2181 static PyObject *__pyx_n_s_desktop;
2182 static PyObject *__pyx_n_s_dest;
2183 static PyObject *__pyx_n_s_destroy;
2184 static PyObject *__pyx_n_s_doc;
2185 static PyObject *__pyx_n_s_draw;
2186 static PyObject *__pyx_n_s_dstrect;
2187 static PyObject *__pyx_kp_s_dstrect_must_be_a_position_rect;
2188 static PyObject *__pyx_n_s_encode;
2189 static PyObject *__pyx_n_s_enumerate;
2190 static PyObject *__pyx_n_s_error;
2191 static PyObject *__pyx_n_s_errorfnc;
2192 static PyObject *__pyx_n_s_escape_button;
2193 static PyObject *__pyx_kp_s_expected_a_rectangle;
2194 static PyObject *__pyx_n_s_flags;
2195 static PyObject *__pyx_n_s_flipX;
2196 static PyObject *__pyx_n_s_flipY;
2197 static PyObject *__pyx_n_s_foreign;
2198 static PyObject *__pyx_n_s_from_display_module;
2199 static PyObject *__pyx_n_s_from_surface;
2200 static PyObject *__pyx_n_s_from_window;
2201 static PyObject *__pyx_n_s_fullscreen;
2202 static PyObject *__pyx_kp_s_fullscreen_and_fullscreen_deskto;
2203 static PyObject *__pyx_n_s_fullscreen_desktop;
2204 static PyObject *__pyx_n_s_getResource;
2205 static PyObject *__pyx_n_s_get_drivers;
2206 static PyObject *__pyx_n_s_get_grabbed_window;
2207 static PyObject *__pyx_n_s_get_height;
2208 static PyObject *__pyx_n_s_get_rect;
2209 static PyObject *__pyx_n_s_get_viewport;
2210 static PyObject *__pyx_n_s_get_width;
2211 static PyObject *__pyx_n_s_getstate;
2212 static PyObject *__pyx_n_s_h;
2213 static PyObject *__pyx_n_s_hidden;
2214 static PyObject *__pyx_n_s_i;
2215 static PyObject *__pyx_n_s_image;
2216 static PyObject *__pyx_n_s_import;
2217 static PyObject *__pyx_n_s_ind;
2218 static PyObject *__pyx_n_s_index;
2219 static PyObject *__pyx_n_s_info;
2220 static PyObject *__pyx_n_s_input_focus;
2221 static PyObject *__pyx_n_s_input_grabbed;
2222 static PyObject *__pyx_n_s_input_only;
2223 static PyObject *__pyx_n_s_items;
2224 static PyObject *__pyx_n_s_kwarg_to_flag;
2225 static PyObject *__pyx_n_s_load;
2226 static PyObject *__pyx_n_s_main;
2227 static PyObject *__pyx_n_s_max_texture_height;
2228 static PyObject *__pyx_n_s_max_texture_width;
2229 static PyObject *__pyx_n_s_maximized;
2230 static PyObject *__pyx_n_s_message;
2231 static PyObject *__pyx_n_s_messagebox;
2232 static PyObject *__pyx_n_s_metaclass;
2233 static PyObject *__pyx_n_s_minimized;
2234 static PyObject *__pyx_n_s_module;
2235 static PyObject *__pyx_n_s_mouse_capture;
2236 static PyObject *__pyx_n_s_mouse_focus;
2237 static PyObject *__pyx_n_s_name;
2238 static PyObject *__pyx_n_s_name_2;
2239 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2240 static PyObject *__pyx_kp_s_no_standard_masks_exist_for_give;
2241 static PyObject *__pyx_kp_s_not_enough_memory_for_the_surfac;
2242 static PyObject *__pyx_n_s_num;
2243 static PyObject *__pyx_n_s_num_texture_formats;
2244 static PyObject *__pyx_kp_s_only_one_of_static_streaming_or;
2245 static PyObject *__pyx_n_s_opengl;
2246 static PyObject *__pyx_n_s_origin;
2247 static PyObject *__pyx_n_s_p1;
2248 static PyObject *__pyx_n_s_p2;
2249 static PyObject *__pyx_n_s_pkgdata;
2250 static PyObject *__pyx_n_s_popup_menu;
2251 static PyObject *__pyx_n_s_position;
2252 static PyObject *__pyx_n_s_prepare;
2253 static PyObject *__pyx_n_s_ptr;
2254 static PyObject *__pyx_n_s_pygame;
2255 static PyObject *__pyx_n_s_pygame__sdl2_video;
2256 static PyObject *__pyx_kp_s_pygame_icon_bmp;
2257 static PyObject *__pyx_n_s_pygame_pkgdata;
2258 static PyObject *__pyx_n_s_pyx_vtable;
2259 static PyObject *__pyx_n_s_qualname;
2260 static PyObject *__pyx_kp_s_rect_values_are_out_of_range;
2261 static PyObject *__pyx_n_s_reduce;
2262 static PyObject *__pyx_n_s_reduce_cython;
2263 static PyObject *__pyx_n_s_reduce_ex;
2264 static PyObject *__pyx_n_s_renderer;
2265 static PyObject *__pyx_n_s_renderer_2;
2266 static PyObject *__pyx_n_s_repr;
2267 static PyObject *__pyx_n_s_resizable;
2268 static PyObject *__pyx_n_s_ret;
2269 static PyObject *__pyx_n_s_return_button;
2270 static PyObject *__pyx_n_s_reversed;
2271 static PyObject *__pyx_n_s_s;
2272 static PyObject *__pyx_kp_s_s_name_s_flags_0x_02x_num_textu;
2273 static PyObject *__pyx_n_s_self;
2274 static PyObject *__pyx_kp_s_self__renderer_cannot_be_convert;
2275 static PyObject *__pyx_kp_s_self__win_cannot_be_converted_to;
2276 static PyObject *__pyx_n_s_send;
2277 static PyObject *__pyx_n_s_set_colorkey;
2278 static PyObject *__pyx_n_s_set_icon;
2279 static PyObject *__pyx_n_s_setstate;
2280 static PyObject *__pyx_n_s_setstate_cython;
2281 static PyObject *__pyx_n_s_size;
2282 static PyObject *__pyx_kp_s_size_must_contain_two_positive_v;
2283 static PyObject *__pyx_kp_s_size_must_have_two_elements;
2284 static PyObject *__pyx_n_s_skip_taskbar;
2285 static PyObject *__pyx_n_s_source;
2286 static PyObject *__pyx_kp_s_source_must_be_drawable;
2287 static PyObject *__pyx_n_s_special_flags;
2288 static PyObject *__pyx_kp_s_src_c_cython_pygame__sdl2_video;
2289 static PyObject *__pyx_n_s_srcrect;
2290 static PyObject *__pyx_kp_s_srcrect_must_be_None_or_a_rectan;
2291 static PyObject *__pyx_kp_s_srcrect_must_be_a_rect_or_None;
2292 static PyObject *__pyx_n_s_static;
2293 static PyObject *__pyx_n_s_staticmethod;
2294 static PyObject *__pyx_n_s_streaming;
2295 static PyObject *__pyx_n_s_surf_ptr;
2296 static PyObject *__pyx_n_s_surface;
2297 static PyObject *__pyx_kp_s_surface_must_be_a_Surface_object;
2298 static PyObject *__pyx_kp_s_surface_must_be_a_surface_or_No;
2299 static PyObject *__pyx_n_s_target;
2300 static PyObject *__pyx_kp_s_target_must_be_a_Texture_or_None;
2301 static PyObject *__pyx_n_s_target_texture;
2302 static PyObject *__pyx_n_s_test;
2303 static PyObject *__pyx_n_s_texture;
2304 static PyObject *__pyx_n_s_textureOrImage;
2305 static PyObject *__pyx_kp_s_the_argument_is_not_a_rectangle;
2306 static PyObject *__pyx_kp_s_the_surface_is_too_small;
2307 static PyObject *__pyx_n_s_throw;
2308 static PyObject *__pyx_n_s_title;
2309 static PyObject *__pyx_n_s_tooltip;
2310 static PyObject *__pyx_kp_s_unknown_parameter_s;
2311 static PyObject *__pyx_kp_s_update_source_should_be_a_Surfac;
2312 static PyObject *__pyx_n_s_utf8;
2313 static PyObject *__pyx_n_s_utility;
2314 static PyObject *__pyx_n_s_vsync;
2315 static PyObject *__pyx_n_s_vulkan;
2316 static PyObject *__pyx_n_s_w;
2317 static PyObject *__pyx_n_s_warn;
2318 static PyObject *__pyx_n_s_win;
2319 static PyObject *__pyx_n_s_window;
2320 static PyObject *__pyx_n_s_x;
2321 static PyObject *__pyx_n_s_y;
2322 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
2323 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_get_drivers(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
2324 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
2325 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_title, PyObject *__pyx_v_message, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_info, int __pyx_v_warn, int __pyx_v_error, PyObject *__pyx_v_buttons, PyObject *__pyx_v_return_button, PyObject *__pyx_v_escape_button); /* proto */
2326 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTypeObject *__pyx_v_cls); /* proto */
2327 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title, PyObject *__pyx_v_size, PyObject *__pyx_v_position, int __pyx_v_fullscreen, int __pyx_v_fullscreen_desktop, PyObject *__pyx_v_kwargs); /* proto */
2328 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2329 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_grabbed); /* proto */
2330 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2331 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_enable); /* proto */
2332 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2333 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_desktop); /* proto */
2334 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2335 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title); /* proto */
2336 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2337 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2338 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2339 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_input_only); /* proto */
2340 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2341 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2342 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2343 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2344 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
2345 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2346 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled); /* proto */
2347 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_surface); /* proto */
2348 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2349 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2350 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
2351 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2352 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_position); /* proto */
2353 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2354 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_opacity); /* proto */
2355 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2356 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, float __pyx_v_value); /* proto */
2357 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2358 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_parent); /* proto */
2359 static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2360 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self); /* proto */
2361 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2362 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2363 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer, PyObject *__pyx_v_size, int __pyx_v_depth, PyObject *__pyx_v_static, PyObject *__pyx_v_streaming, PyObject *__pyx_v_target); /* proto */
2364 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer, PyObject *__pyx_v_surface); /* proto */
2365 static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2366 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2367 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, Uint8 __pyx_v_new_value); /* proto */
2368 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2369 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_blendMode); /* proto */
2370 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2371 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_new_value); /* proto */
2372 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
2373 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_srcrect, PyObject *__pyx_v_dstrect, float __pyx_v_angle, PyObject *__pyx_v_origin, int __pyx_v_flipX, int __pyx_v_flipY); /* proto */
2374 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12update(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_surface, PyObject *__pyx_v_area); /* proto */
2375 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8renderer___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2376 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5width___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2377 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_6height___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2378 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self); /* proto */
2379 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2380 static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2381 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_textureOrImage, PyObject *__pyx_v_srcrect); /* proto */
2382 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2383 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_new_color); /* proto */
2384 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2385 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_new_origin); /* proto */
2386 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_4get_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2387 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6draw(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_srcrect, PyObject *__pyx_v_dstrect); /* proto */
2388 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5angle___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2389 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5angle_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2390 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2391 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2392 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2393 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2394 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2395 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2396 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2397 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2398 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_7texture___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2399 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2400 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2401 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2402 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2403 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2404 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self); /* proto */
2405 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2406 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window); /* proto */
2407 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_index, int __pyx_v_accelerated, int __pyx_v_vsync, int __pyx_v_target_texture); /* proto */
2408 static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2409 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2410 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_blendMode); /* proto */
2411 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2412 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_new_value); /* proto */
2413 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2414 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2415 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2416 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2417 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
2418 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2419 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_scale); /* proto */
2420 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_area); /* proto */
2421 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2422 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_newtarget); /* proto */
2423 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_source, pgRectObject *__pyx_v_dest, pgRectObject *__pyx_v_area, int __pyx_v_special_flags); /* proto */
2424 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_p1, PyObject *__pyx_v_p2); /* proto */
2425 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_point); /* proto */
2426 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_rect); /* proto */
2427 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_rect); /* proto */
2428 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24to_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_surface, PyObject *__pyx_v_area); /* proto */
2429 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self); /* proto */
2430 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2431 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Window(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2432 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Renderer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2433 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Texture(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2434 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Image(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2435 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2436 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0};
2437 static PyObject *__pyx_int_0;
2438 static PyObject *__pyx_int_1;
2439 static PyObject *__pyx_int_3;
2440 static PyObject *__pyx_int_480;
2441 static PyObject *__pyx_int_640;
2442 static PyObject *__pyx_k__3;
2443 static PyObject *__pyx_k__4;
2444 static PyObject *__pyx_codeobj_;
2445 static PyObject *__pyx_tuple__2;
2446 static PyObject *__pyx_tuple__5;
2447 static PyObject *__pyx_tuple__6;
2448 static PyObject *__pyx_tuple__7;
2449 static PyObject *__pyx_tuple__8;
2450 static PyObject *__pyx_tuple__9;
2451 static PyObject *__pyx_slice__22;
2452 static PyObject *__pyx_slice__26;
2453 static PyObject *__pyx_tuple__10;
2454 static PyObject *__pyx_tuple__11;
2455 static PyObject *__pyx_tuple__12;
2456 static PyObject *__pyx_tuple__13;
2457 static PyObject *__pyx_tuple__14;
2458 static PyObject *__pyx_tuple__15;
2459 static PyObject *__pyx_tuple__16;
2460 static PyObject *__pyx_tuple__17;
2461 static PyObject *__pyx_tuple__18;
2462 static PyObject *__pyx_tuple__19;
2463 static PyObject *__pyx_tuple__20;
2464 static PyObject *__pyx_tuple__21;
2465 static PyObject *__pyx_tuple__23;
2466 static PyObject *__pyx_tuple__24;
2467 static PyObject *__pyx_tuple__25;
2468 static PyObject *__pyx_tuple__27;
2469 static PyObject *__pyx_tuple__28;
2470 static PyObject *__pyx_tuple__29;
2471 static PyObject *__pyx_tuple__30;
2472 static PyObject *__pyx_tuple__31;
2473 static PyObject *__pyx_tuple__32;
2474 static PyObject *__pyx_tuple__33;
2475 static PyObject *__pyx_tuple__34;
2476 static PyObject *__pyx_tuple__35;
2477 static PyObject *__pyx_tuple__37;
2478 static PyObject *__pyx_tuple__39;
2479 static PyObject *__pyx_tuple__40;
2480 static PyObject *__pyx_tuple__42;
2481 static PyObject *__pyx_tuple__44;
2482 static PyObject *__pyx_tuple__45;
2483 static PyObject *__pyx_codeobj__38;
2484 static PyObject *__pyx_codeobj__41;
2485 static PyObject *__pyx_codeobj__43;
2486 static PyObject *__pyx_codeobj__46;
2487 /* Late includes */
2488 
2489 /* "pygame/_sdl2/video.pyx":65
2490  *
2491  * class RendererDriverInfo:
2492  *     def __repr__(self):             # <<<<<<<<<<<<<<
2493  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
2494  *             self.__class__.__name__,
2495  */
2496 
2497 /* Python wrapper */
2498 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2499 static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__ = {"__repr__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__, METH_O, 0};
__pyx_pw_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__(PyObject * __pyx_self,PyObject * __pyx_v_self)2500 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2501   PyObject *__pyx_r = 0;
2502   __Pyx_RefNannyDeclarations
2503   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
2504   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(__pyx_self, ((PyObject *)__pyx_v_self));
2505 
2506   /* function exit code */
2507   __Pyx_RefNannyFinishContext();
2508   return __pyx_r;
2509 }
2510 
__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self)2511 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_18RendererDriverInfo___repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
2512   PyObject *__pyx_r = NULL;
2513   __Pyx_RefNannyDeclarations
2514   PyObject *__pyx_t_1 = NULL;
2515   PyObject *__pyx_t_2 = NULL;
2516   PyObject *__pyx_t_3 = NULL;
2517   PyObject *__pyx_t_4 = NULL;
2518   PyObject *__pyx_t_5 = NULL;
2519   PyObject *__pyx_t_6 = NULL;
2520   PyObject *__pyx_t_7 = NULL;
2521   int __pyx_lineno = 0;
2522   const char *__pyx_filename = NULL;
2523   int __pyx_clineno = 0;
2524   __Pyx_RefNannySetupContext("__repr__", 0);
2525 
2526   /* "pygame/_sdl2/video.pyx":66
2527  * class RendererDriverInfo:
2528  *     def __repr__(self):
2529  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (             # <<<<<<<<<<<<<<
2530  *             self.__class__.__name__,
2531  *             self.name,
2532  */
2533   __Pyx_XDECREF(__pyx_r);
2534 
2535   /* "pygame/_sdl2/video.pyx":67
2536  *     def __repr__(self):
2537  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
2538  *             self.__class__.__name__,             # <<<<<<<<<<<<<<
2539  *             self.name,
2540  *             self.flags,
2541  */
2542   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
2543   __Pyx_GOTREF(__pyx_t_1);
2544   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
2545   __Pyx_GOTREF(__pyx_t_2);
2546   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2547 
2548   /* "pygame/_sdl2/video.pyx":68
2549  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
2550  *             self.__class__.__name__,
2551  *             self.name,             # <<<<<<<<<<<<<<
2552  *             self.flags,
2553  *             self.num_texture_formats,
2554  */
2555   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
2556   __Pyx_GOTREF(__pyx_t_1);
2557 
2558   /* "pygame/_sdl2/video.pyx":69
2559  *             self.__class__.__name__,
2560  *             self.name,
2561  *             self.flags,             # <<<<<<<<<<<<<<
2562  *             self.num_texture_formats,
2563  *             self.max_texture_width,
2564  */
2565   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
2566   __Pyx_GOTREF(__pyx_t_3);
2567 
2568   /* "pygame/_sdl2/video.pyx":70
2569  *             self.name,
2570  *             self.flags,
2571  *             self.num_texture_formats,             # <<<<<<<<<<<<<<
2572  *             self.max_texture_width,
2573  *             self.max_texture_height,
2574  */
2575   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_texture_formats); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
2576   __Pyx_GOTREF(__pyx_t_4);
2577 
2578   /* "pygame/_sdl2/video.pyx":71
2579  *             self.flags,
2580  *             self.num_texture_formats,
2581  *             self.max_texture_width,             # <<<<<<<<<<<<<<
2582  *             self.max_texture_height,
2583  *         )
2584  */
2585   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_texture_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error)
2586   __Pyx_GOTREF(__pyx_t_5);
2587 
2588   /* "pygame/_sdl2/video.pyx":72
2589  *             self.num_texture_formats,
2590  *             self.max_texture_width,
2591  *             self.max_texture_height,             # <<<<<<<<<<<<<<
2592  *         )
2593  *
2594  */
2595   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_texture_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error)
2596   __Pyx_GOTREF(__pyx_t_6);
2597 
2598   /* "pygame/_sdl2/video.pyx":67
2599  *     def __repr__(self):
2600  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
2601  *             self.__class__.__name__,             # <<<<<<<<<<<<<<
2602  *             self.name,
2603  *             self.flags,
2604  */
2605   __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error)
2606   __Pyx_GOTREF(__pyx_t_7);
2607   __Pyx_GIVEREF(__pyx_t_2);
2608   PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
2609   __Pyx_GIVEREF(__pyx_t_1);
2610   PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
2611   __Pyx_GIVEREF(__pyx_t_3);
2612   PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
2613   __Pyx_GIVEREF(__pyx_t_4);
2614   PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
2615   __Pyx_GIVEREF(__pyx_t_5);
2616   PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_5);
2617   __Pyx_GIVEREF(__pyx_t_6);
2618   PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
2619   __pyx_t_2 = 0;
2620   __pyx_t_1 = 0;
2621   __pyx_t_3 = 0;
2622   __pyx_t_4 = 0;
2623   __pyx_t_5 = 0;
2624   __pyx_t_6 = 0;
2625 
2626   /* "pygame/_sdl2/video.pyx":66
2627  * class RendererDriverInfo:
2628  *     def __repr__(self):
2629  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (             # <<<<<<<<<<<<<<
2630  *             self.__class__.__name__,
2631  *             self.name,
2632  */
2633   __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_name_s_flags_0x_02x_num_textu, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
2634   __Pyx_GOTREF(__pyx_t_6);
2635   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2636   __pyx_r = __pyx_t_6;
2637   __pyx_t_6 = 0;
2638   goto __pyx_L0;
2639 
2640   /* "pygame/_sdl2/video.pyx":65
2641  *
2642  * class RendererDriverInfo:
2643  *     def __repr__(self):             # <<<<<<<<<<<<<<
2644  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
2645  *             self.__class__.__name__,
2646  */
2647 
2648   /* function exit code */
2649   __pyx_L1_error:;
2650   __Pyx_XDECREF(__pyx_t_1);
2651   __Pyx_XDECREF(__pyx_t_2);
2652   __Pyx_XDECREF(__pyx_t_3);
2653   __Pyx_XDECREF(__pyx_t_4);
2654   __Pyx_XDECREF(__pyx_t_5);
2655   __Pyx_XDECREF(__pyx_t_6);
2656   __Pyx_XDECREF(__pyx_t_7);
2657   __Pyx_AddTraceback("pygame._sdl2.video.RendererDriverInfo.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2658   __pyx_r = NULL;
2659   __pyx_L0:;
2660   __Pyx_XGIVEREF(__pyx_r);
2661   __Pyx_RefNannyFinishContext();
2662   return __pyx_r;
2663 }
2664 static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
2665 
2666 /* "pygame/_sdl2/video.pyx":75
2667  *         )
2668  *
2669  * def get_drivers():             # <<<<<<<<<<<<<<
2670  *     cdef int num = SDL_GetNumRenderDrivers()
2671  *     cdef SDL_RendererInfo info
2672  */
2673 
2674 /* Python wrapper */
2675 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_1get_drivers(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2676 static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_1get_drivers = {"get_drivers", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_1get_drivers, METH_NOARGS, 0};
__pyx_pw_6pygame_5_sdl2_5video_1get_drivers(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2677 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_1get_drivers(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2678   PyObject *__pyx_r = 0;
2679   __Pyx_RefNannyDeclarations
2680   __Pyx_RefNannySetupContext("get_drivers (wrapper)", 0);
2681   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_get_drivers(__pyx_self);
2682 
2683   /* function exit code */
2684   __Pyx_RefNannyFinishContext();
2685   return __pyx_r;
2686 }
2687 
__pyx_pf_6pygame_5_sdl2_5video_get_drivers(CYTHON_UNUSED PyObject * __pyx_self)2688 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_get_drivers(CYTHON_UNUSED PyObject *__pyx_self) {
2689   struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *__pyx_cur_scope;
2690   PyObject *__pyx_r = NULL;
2691   __Pyx_RefNannyDeclarations
2692   int __pyx_lineno = 0;
2693   const char *__pyx_filename = NULL;
2694   int __pyx_clineno = 0;
2695   __Pyx_RefNannySetupContext("get_drivers", 0);
2696   __pyx_cur_scope = (struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)__pyx_tp_new_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(__pyx_ptype_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers, __pyx_empty_tuple, NULL);
2697   if (unlikely(!__pyx_cur_scope)) {
2698     __pyx_cur_scope = ((struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)Py_None);
2699     __Pyx_INCREF(Py_None);
2700     __PYX_ERR(0, 75, __pyx_L1_error)
2701   } else {
2702     __Pyx_GOTREF(__pyx_cur_scope);
2703   }
2704   {
2705     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6pygame_5_sdl2_5video_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_get_drivers, __pyx_n_s_get_drivers, __pyx_n_s_pygame__sdl2_video); if (unlikely(!gen)) __PYX_ERR(0, 75, __pyx_L1_error)
2706     __Pyx_DECREF(__pyx_cur_scope);
2707     __Pyx_RefNannyFinishContext();
2708     return (PyObject *) gen;
2709   }
2710 
2711   /* function exit code */
2712   __pyx_L1_error:;
2713   __Pyx_AddTraceback("pygame._sdl2.video.get_drivers", __pyx_clineno, __pyx_lineno, __pyx_filename);
2714   __pyx_r = NULL;
2715   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
2716   __Pyx_XGIVEREF(__pyx_r);
2717   __Pyx_RefNannyFinishContext();
2718   return __pyx_r;
2719 }
2720 
__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject * __pyx_generator,CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject * __pyx_sent_value)2721 static PyObject *__pyx_gb_6pygame_5_sdl2_5video_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
2722 {
2723   struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *__pyx_cur_scope = ((struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)__pyx_generator->closure);
2724   PyObject *__pyx_r = NULL;
2725   int __pyx_t_1;
2726   PyObject *__pyx_t_2 = NULL;
2727   PyObject *__pyx_t_3 = NULL;
2728   PyObject *__pyx_t_4 = NULL;
2729   int __pyx_lineno = 0;
2730   const char *__pyx_filename = NULL;
2731   int __pyx_clineno = 0;
2732   __Pyx_RefNannyDeclarations
2733   __Pyx_RefNannySetupContext("get_drivers", 0);
2734   switch (__pyx_generator->resume_label) {
2735     case 0: goto __pyx_L3_first_run;
2736     case 1: goto __pyx_L6_resume_from_yield;
2737     default: /* CPython raises the right error here */
2738     __Pyx_RefNannyFinishContext();
2739     return NULL;
2740   }
2741   __pyx_L3_first_run:;
2742   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 75, __pyx_L1_error)
2743 
2744   /* "pygame/_sdl2/video.pyx":76
2745  *
2746  * def get_drivers():
2747  *     cdef int num = SDL_GetNumRenderDrivers()             # <<<<<<<<<<<<<<
2748  *     cdef SDL_RendererInfo info
2749  *     cdef int ind
2750  */
2751   __pyx_cur_scope->__pyx_v_num = SDL_GetNumRenderDrivers();
2752 
2753   /* "pygame/_sdl2/video.pyx":79
2754  *     cdef SDL_RendererInfo info
2755  *     cdef int ind
2756  *     for ind from 0 <= ind < num:             # <<<<<<<<<<<<<<
2757  *         SDL_GetRenderDriverInfo(ind, &info)
2758  *         ret = RendererDriverInfo()
2759  */
2760   __pyx_t_1 = __pyx_cur_scope->__pyx_v_num;
2761   for (__pyx_cur_scope->__pyx_v_ind = 0; __pyx_cur_scope->__pyx_v_ind < __pyx_t_1; __pyx_cur_scope->__pyx_v_ind++) {
2762 
2763     /* "pygame/_sdl2/video.pyx":80
2764  *     cdef int ind
2765  *     for ind from 0 <= ind < num:
2766  *         SDL_GetRenderDriverInfo(ind, &info)             # <<<<<<<<<<<<<<
2767  *         ret = RendererDriverInfo()
2768  *         ret.name = info.name
2769  */
2770     (void)(SDL_GetRenderDriverInfo(__pyx_cur_scope->__pyx_v_ind, (&__pyx_cur_scope->__pyx_v_info)));
2771 
2772     /* "pygame/_sdl2/video.pyx":81
2773  *     for ind from 0 <= ind < num:
2774  *         SDL_GetRenderDriverInfo(ind, &info)
2775  *         ret = RendererDriverInfo()             # <<<<<<<<<<<<<<
2776  *         ret.name = info.name
2777  *         ret.flags = info.flags
2778  */
2779     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RendererDriverInfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
2780     __Pyx_GOTREF(__pyx_t_3);
2781     __pyx_t_4 = NULL;
2782     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2783       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2784       if (likely(__pyx_t_4)) {
2785         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2786         __Pyx_INCREF(__pyx_t_4);
2787         __Pyx_INCREF(function);
2788         __Pyx_DECREF_SET(__pyx_t_3, function);
2789       }
2790     }
2791     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
2792     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2793     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
2794     __Pyx_GOTREF(__pyx_t_2);
2795     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2796     __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ret);
2797     __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ret, __pyx_t_2);
2798     __Pyx_GIVEREF(__pyx_t_2);
2799     __pyx_t_2 = 0;
2800 
2801     /* "pygame/_sdl2/video.pyx":82
2802  *         SDL_GetRenderDriverInfo(ind, &info)
2803  *         ret = RendererDriverInfo()
2804  *         ret.name = info.name             # <<<<<<<<<<<<<<
2805  *         ret.flags = info.flags
2806  *         ret.num_texture_formats = info.num_texture_formats
2807  */
2808     __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_cur_scope->__pyx_v_info.name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
2809     __Pyx_GOTREF(__pyx_t_2);
2810     if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_name_2, __pyx_t_2) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
2811     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2812 
2813     /* "pygame/_sdl2/video.pyx":83
2814  *         ret = RendererDriverInfo()
2815  *         ret.name = info.name
2816  *         ret.flags = info.flags             # <<<<<<<<<<<<<<
2817  *         ret.num_texture_formats = info.num_texture_formats
2818  *         ret.max_texture_width = info.max_texture_width
2819  */
2820     __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_cur_scope->__pyx_v_info.flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
2821     __Pyx_GOTREF(__pyx_t_2);
2822     if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_flags, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
2823     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2824 
2825     /* "pygame/_sdl2/video.pyx":84
2826  *         ret.name = info.name
2827  *         ret.flags = info.flags
2828  *         ret.num_texture_formats = info.num_texture_formats             # <<<<<<<<<<<<<<
2829  *         ret.max_texture_width = info.max_texture_width
2830  *         ret.max_texture_height = info.max_texture_height
2831  */
2832     __pyx_t_2 = __Pyx_PyInt_From_Uint32(__pyx_cur_scope->__pyx_v_info.num_texture_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
2833     __Pyx_GOTREF(__pyx_t_2);
2834     if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_num_texture_formats, __pyx_t_2) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
2835     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2836 
2837     /* "pygame/_sdl2/video.pyx":85
2838  *         ret.flags = info.flags
2839  *         ret.num_texture_formats = info.num_texture_formats
2840  *         ret.max_texture_width = info.max_texture_width             # <<<<<<<<<<<<<<
2841  *         ret.max_texture_height = info.max_texture_height
2842  *         yield ret
2843  */
2844     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_info.max_texture_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
2845     __Pyx_GOTREF(__pyx_t_2);
2846     if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_max_texture_width, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
2847     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2848 
2849     /* "pygame/_sdl2/video.pyx":86
2850  *         ret.num_texture_formats = info.num_texture_formats
2851  *         ret.max_texture_width = info.max_texture_width
2852  *         ret.max_texture_height = info.max_texture_height             # <<<<<<<<<<<<<<
2853  *         yield ret
2854  *
2855  */
2856     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_info.max_texture_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
2857     __Pyx_GOTREF(__pyx_t_2);
2858     if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_ret, __pyx_n_s_max_texture_height, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
2859     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2860 
2861     /* "pygame/_sdl2/video.pyx":87
2862  *         ret.max_texture_width = info.max_texture_width
2863  *         ret.max_texture_height = info.max_texture_height
2864  *         yield ret             # <<<<<<<<<<<<<<
2865  *
2866  *
2867  */
2868     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ret);
2869     __pyx_r = __pyx_cur_scope->__pyx_v_ret;
2870     __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
2871     __Pyx_XGIVEREF(__pyx_r);
2872     __Pyx_RefNannyFinishContext();
2873     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
2874     /* return from generator, yielding value */
2875     __pyx_generator->resume_label = 1;
2876     return __pyx_r;
2877     __pyx_L6_resume_from_yield:;
2878     __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
2879     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 87, __pyx_L1_error)
2880   }
2881   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
2882 
2883   /* "pygame/_sdl2/video.pyx":75
2884  *         )
2885  *
2886  * def get_drivers():             # <<<<<<<<<<<<<<
2887  *     cdef int num = SDL_GetNumRenderDrivers()
2888  *     cdef SDL_RendererInfo info
2889  */
2890 
2891   /* function exit code */
2892   PyErr_SetNone(PyExc_StopIteration);
2893   goto __pyx_L0;
2894   __pyx_L1_error:;
2895   __Pyx_XDECREF(__pyx_t_2);
2896   __Pyx_XDECREF(__pyx_t_3);
2897   __Pyx_XDECREF(__pyx_t_4);
2898   __Pyx_AddTraceback("get_drivers", __pyx_clineno, __pyx_lineno, __pyx_filename);
2899   __pyx_L0:;
2900   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
2901   #if !CYTHON_USE_EXC_INFO_STACK
2902   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
2903   #endif
2904   __pyx_generator->resume_label = -1;
2905   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
2906   __Pyx_RefNannyFinishContext();
2907   return __pyx_r;
2908 }
2909 
2910 /* "pygame/_sdl2/video.pyx":90
2911  *
2912  *
2913  * def get_grabbed_window():             # <<<<<<<<<<<<<<
2914  *     """return the Window with input grab enabled,
2915  *        or None if input isn't grabbed."""
2916  */
2917 
2918 /* Python wrapper */
2919 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2920 static char __pyx_doc_6pygame_5_sdl2_5video_3get_grabbed_window[] = "return the Window with input grab enabled,\n       or None if input isn't grabbed.";
2921 static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_4get_grabbed_window = {"get_grabbed_window", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_3get_grabbed_window};
__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2922 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_4get_grabbed_window(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2923   PyObject *__pyx_r = 0;
2924   __Pyx_RefNannyDeclarations
2925   __Pyx_RefNannySetupContext("get_grabbed_window (wrapper)", 0);
2926   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(__pyx_self);
2927 
2928   /* function exit code */
2929   __Pyx_RefNannyFinishContext();
2930   return __pyx_r;
2931 }
2932 
__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSED PyObject * __pyx_self)2933 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_3get_grabbed_window(CYTHON_UNUSED PyObject *__pyx_self) {
2934   SDL_Window *__pyx_v_win;
2935   void *__pyx_v_ptr;
2936   PyObject *__pyx_r = NULL;
2937   __Pyx_RefNannyDeclarations
2938   int __pyx_t_1;
2939   __Pyx_RefNannySetupContext("get_grabbed_window", 0);
2940 
2941   /* "pygame/_sdl2/video.pyx":93
2942  *     """return the Window with input grab enabled,
2943  *        or None if input isn't grabbed."""
2944  *     cdef SDL_Window *win = SDL_GetGrabbedWindow()             # <<<<<<<<<<<<<<
2945  *     cdef void *ptr
2946  *     if win:
2947  */
2948   __pyx_v_win = SDL_GetGrabbedWindow();
2949 
2950   /* "pygame/_sdl2/video.pyx":95
2951  *     cdef SDL_Window *win = SDL_GetGrabbedWindow()
2952  *     cdef void *ptr
2953  *     if win:             # <<<<<<<<<<<<<<
2954  *         ptr = SDL_GetWindowData(win, "pg_window")
2955  *         if not ptr:
2956  */
2957   __pyx_t_1 = (__pyx_v_win != 0);
2958   if (__pyx_t_1) {
2959 
2960     /* "pygame/_sdl2/video.pyx":96
2961  *     cdef void *ptr
2962  *     if win:
2963  *         ptr = SDL_GetWindowData(win, "pg_window")             # <<<<<<<<<<<<<<
2964  *         if not ptr:
2965  *             return None
2966  */
2967     __pyx_v_ptr = SDL_GetWindowData(__pyx_v_win, ((char const *)"pg_window"));
2968 
2969     /* "pygame/_sdl2/video.pyx":97
2970  *     if win:
2971  *         ptr = SDL_GetWindowData(win, "pg_window")
2972  *         if not ptr:             # <<<<<<<<<<<<<<
2973  *             return None
2974  *         return <object>ptr
2975  */
2976     __pyx_t_1 = ((!(__pyx_v_ptr != 0)) != 0);
2977     if (__pyx_t_1) {
2978 
2979       /* "pygame/_sdl2/video.pyx":98
2980  *         ptr = SDL_GetWindowData(win, "pg_window")
2981  *         if not ptr:
2982  *             return None             # <<<<<<<<<<<<<<
2983  *         return <object>ptr
2984  *     return None
2985  */
2986       __Pyx_XDECREF(__pyx_r);
2987       __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2988       goto __pyx_L0;
2989 
2990       /* "pygame/_sdl2/video.pyx":97
2991  *     if win:
2992  *         ptr = SDL_GetWindowData(win, "pg_window")
2993  *         if not ptr:             # <<<<<<<<<<<<<<
2994  *             return None
2995  *         return <object>ptr
2996  */
2997     }
2998 
2999     /* "pygame/_sdl2/video.pyx":99
3000  *         if not ptr:
3001  *             return None
3002  *         return <object>ptr             # <<<<<<<<<<<<<<
3003  *     return None
3004  *
3005  */
3006     __Pyx_XDECREF(__pyx_r);
3007     __Pyx_INCREF(((PyObject *)__pyx_v_ptr));
3008     __pyx_r = ((PyObject *)__pyx_v_ptr);
3009     goto __pyx_L0;
3010 
3011     /* "pygame/_sdl2/video.pyx":95
3012  *     cdef SDL_Window *win = SDL_GetGrabbedWindow()
3013  *     cdef void *ptr
3014  *     if win:             # <<<<<<<<<<<<<<
3015  *         ptr = SDL_GetWindowData(win, "pg_window")
3016  *         if not ptr:
3017  */
3018   }
3019 
3020   /* "pygame/_sdl2/video.pyx":100
3021  *             return None
3022  *         return <object>ptr
3023  *     return None             # <<<<<<<<<<<<<<
3024  *
3025  *
3026  */
3027   __Pyx_XDECREF(__pyx_r);
3028   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3029   goto __pyx_L0;
3030 
3031   /* "pygame/_sdl2/video.pyx":90
3032  *
3033  *
3034  * def get_grabbed_window():             # <<<<<<<<<<<<<<
3035  *     """return the Window with input grab enabled,
3036  *        or None if input isn't grabbed."""
3037  */
3038 
3039   /* function exit code */
3040   __pyx_L0:;
3041   __Pyx_XGIVEREF(__pyx_r);
3042   __Pyx_RefNannyFinishContext();
3043   return __pyx_r;
3044 }
3045 
3046 /* "pygame/_sdl2/video.pyx":103
3047  *
3048  *
3049  * def messagebox(title, message,             # <<<<<<<<<<<<<<
3050  *                Window window=None,
3051  *                bint info=False,
3052  */
3053 
3054 /* Python wrapper */
3055 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3056 static char __pyx_doc_6pygame_5_sdl2_5video_5messagebox[] = " Display a message box.\n\n    :param str title: A title string or None.\n    :param str message: A message string.\n    :param bool info: If ``True``, display an info message.\n    :param bool warn: If ``True``, display a warning message.\n    :param bool error: If ``True``, display an error message.\n    :param tuple buttons: An optional sequence of buttons to show to the user (strings).\n    :param int return_button: Button index to use if the return key is hit (-1 for none).\n    :param int escape_button: Button index to use if the escape key is hit (-1 for none).\n    :return: The index of the button that was pushed.\n    ";
3057 static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_6messagebox = {"messagebox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_6messagebox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_5messagebox};
__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3058 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6messagebox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3059   PyObject *__pyx_v_title = 0;
3060   PyObject *__pyx_v_message = 0;
3061   struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window = 0;
3062   int __pyx_v_info;
3063   int __pyx_v_warn;
3064   int __pyx_v_error;
3065   PyObject *__pyx_v_buttons = 0;
3066   PyObject *__pyx_v_return_button = 0;
3067   PyObject *__pyx_v_escape_button = 0;
3068   int __pyx_lineno = 0;
3069   const char *__pyx_filename = NULL;
3070   int __pyx_clineno = 0;
3071   PyObject *__pyx_r = 0;
3072   __Pyx_RefNannyDeclarations
3073   __Pyx_RefNannySetupContext("messagebox (wrapper)", 0);
3074   {
3075     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_title,&__pyx_n_s_message,&__pyx_n_s_window,&__pyx_n_s_info,&__pyx_n_s_warn,&__pyx_n_s_error,&__pyx_n_s_buttons,&__pyx_n_s_return_button,&__pyx_n_s_escape_button,0};
3076     PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
3077 
3078     /* "pygame/_sdl2/video.pyx":104
3079  *
3080  * def messagebox(title, message,
3081  *                Window window=None,             # <<<<<<<<<<<<<<
3082  *                bint info=False,
3083  *                bint warn=False,
3084  */
3085     values[2] = (PyObject *)((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)Py_None);
3086 
3087     /* "pygame/_sdl2/video.pyx":108
3088  *                bint warn=False,
3089  *                bint error=False,
3090  *                buttons=('OK', ),             # <<<<<<<<<<<<<<
3091  *                return_button=0,
3092  *                escape_button=0):
3093  */
3094     values[6] = ((PyObject *)__pyx_tuple__2);
3095     values[7] = ((PyObject *)__pyx_int_0);
3096     values[8] = ((PyObject *)__pyx_int_0);
3097     if (unlikely(__pyx_kwds)) {
3098       Py_ssize_t kw_args;
3099       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3100       switch (pos_args) {
3101         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3102         CYTHON_FALLTHROUGH;
3103         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3104         CYTHON_FALLTHROUGH;
3105         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3106         CYTHON_FALLTHROUGH;
3107         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3108         CYTHON_FALLTHROUGH;
3109         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3110         CYTHON_FALLTHROUGH;
3111         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3112         CYTHON_FALLTHROUGH;
3113         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3114         CYTHON_FALLTHROUGH;
3115         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3116         CYTHON_FALLTHROUGH;
3117         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3118         CYTHON_FALLTHROUGH;
3119         case  0: break;
3120         default: goto __pyx_L5_argtuple_error;
3121       }
3122       kw_args = PyDict_Size(__pyx_kwds);
3123       switch (pos_args) {
3124         case  0:
3125         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_title)) != 0)) kw_args--;
3126         else goto __pyx_L5_argtuple_error;
3127         CYTHON_FALLTHROUGH;
3128         case  1:
3129         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message)) != 0)) kw_args--;
3130         else {
3131           __Pyx_RaiseArgtupleInvalid("messagebox", 0, 2, 9, 1); __PYX_ERR(0, 103, __pyx_L3_error)
3132         }
3133         CYTHON_FALLTHROUGH;
3134         case  2:
3135         if (kw_args > 0) {
3136           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window);
3137           if (value) { values[2] = value; kw_args--; }
3138         }
3139         CYTHON_FALLTHROUGH;
3140         case  3:
3141         if (kw_args > 0) {
3142           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_info);
3143           if (value) { values[3] = value; kw_args--; }
3144         }
3145         CYTHON_FALLTHROUGH;
3146         case  4:
3147         if (kw_args > 0) {
3148           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_warn);
3149           if (value) { values[4] = value; kw_args--; }
3150         }
3151         CYTHON_FALLTHROUGH;
3152         case  5:
3153         if (kw_args > 0) {
3154           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error);
3155           if (value) { values[5] = value; kw_args--; }
3156         }
3157         CYTHON_FALLTHROUGH;
3158         case  6:
3159         if (kw_args > 0) {
3160           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buttons);
3161           if (value) { values[6] = value; kw_args--; }
3162         }
3163         CYTHON_FALLTHROUGH;
3164         case  7:
3165         if (kw_args > 0) {
3166           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_button);
3167           if (value) { values[7] = value; kw_args--; }
3168         }
3169         CYTHON_FALLTHROUGH;
3170         case  8:
3171         if (kw_args > 0) {
3172           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_escape_button);
3173           if (value) { values[8] = value; kw_args--; }
3174         }
3175       }
3176       if (unlikely(kw_args > 0)) {
3177         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "messagebox") < 0)) __PYX_ERR(0, 103, __pyx_L3_error)
3178       }
3179     } else {
3180       switch (PyTuple_GET_SIZE(__pyx_args)) {
3181         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3182         CYTHON_FALLTHROUGH;
3183         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3184         CYTHON_FALLTHROUGH;
3185         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3186         CYTHON_FALLTHROUGH;
3187         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3188         CYTHON_FALLTHROUGH;
3189         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3190         CYTHON_FALLTHROUGH;
3191         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3192         CYTHON_FALLTHROUGH;
3193         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3194         CYTHON_FALLTHROUGH;
3195         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3196         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3197         break;
3198         default: goto __pyx_L5_argtuple_error;
3199       }
3200     }
3201     __pyx_v_title = values[0];
3202     __pyx_v_message = values[1];
3203     __pyx_v_window = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)values[2]);
3204     if (values[3]) {
3205       __pyx_v_info = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_info == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
3206     } else {
3207 
3208       /* "pygame/_sdl2/video.pyx":105
3209  * def messagebox(title, message,
3210  *                Window window=None,
3211  *                bint info=False,             # <<<<<<<<<<<<<<
3212  *                bint warn=False,
3213  *                bint error=False,
3214  */
3215       __pyx_v_info = ((int)0);
3216     }
3217     if (values[4]) {
3218       __pyx_v_warn = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_warn == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L3_error)
3219     } else {
3220 
3221       /* "pygame/_sdl2/video.pyx":106
3222  *                Window window=None,
3223  *                bint info=False,
3224  *                bint warn=False,             # <<<<<<<<<<<<<<
3225  *                bint error=False,
3226  *                buttons=('OK', ),
3227  */
3228       __pyx_v_warn = ((int)0);
3229     }
3230     if (values[5]) {
3231       __pyx_v_error = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_error == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error)
3232     } else {
3233 
3234       /* "pygame/_sdl2/video.pyx":107
3235  *                bint info=False,
3236  *                bint warn=False,
3237  *                bint error=False,             # <<<<<<<<<<<<<<
3238  *                buttons=('OK', ),
3239  *                return_button=0,
3240  */
3241       __pyx_v_error = ((int)0);
3242     }
3243     __pyx_v_buttons = values[6];
3244     __pyx_v_return_button = values[7];
3245     __pyx_v_escape_button = values[8];
3246   }
3247   goto __pyx_L4_argument_unpacking_done;
3248   __pyx_L5_argtuple_error:;
3249   __Pyx_RaiseArgtupleInvalid("messagebox", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 103, __pyx_L3_error)
3250   __pyx_L3_error:;
3251   __Pyx_AddTraceback("pygame._sdl2.video.messagebox", __pyx_clineno, __pyx_lineno, __pyx_filename);
3252   __Pyx_RefNannyFinishContext();
3253   return NULL;
3254   __pyx_L4_argument_unpacking_done:;
3255   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 104, __pyx_L1_error)
3256   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5messagebox(__pyx_self, __pyx_v_title, __pyx_v_message, __pyx_v_window, __pyx_v_info, __pyx_v_warn, __pyx_v_error, __pyx_v_buttons, __pyx_v_return_button, __pyx_v_escape_button);
3257 
3258   /* "pygame/_sdl2/video.pyx":103
3259  *
3260  *
3261  * def messagebox(title, message,             # <<<<<<<<<<<<<<
3262  *                Window window=None,
3263  *                bint info=False,
3264  */
3265 
3266   /* function exit code */
3267   goto __pyx_L0;
3268   __pyx_L1_error:;
3269   __pyx_r = NULL;
3270   __pyx_L0:;
3271   __Pyx_RefNannyFinishContext();
3272   return __pyx_r;
3273 }
3274 
__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_title,PyObject * __pyx_v_message,struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_window,int __pyx_v_info,int __pyx_v_warn,int __pyx_v_error,PyObject * __pyx_v_buttons,PyObject * __pyx_v_return_button,PyObject * __pyx_v_escape_button)3275 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5messagebox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_title, PyObject *__pyx_v_message, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_info, int __pyx_v_warn, int __pyx_v_error, PyObject *__pyx_v_buttons, PyObject *__pyx_v_return_button, PyObject *__pyx_v_escape_button) {
3276   SDL_MessageBoxButtonData *__pyx_v_c_buttons;
3277   SDL_MessageBoxData __pyx_v_data;
3278   SDL_MessageBoxButtonData __pyx_v_button;
3279   PyObject *__pyx_v_buttons_utf8 = NULL;
3280   PyObject *__pyx_v_i = NULL;
3281   PyObject *__pyx_v_but = NULL;
3282   int __pyx_v_buttonid;
3283   PyObject *__pyx_v_s = NULL;
3284   PyObject *__pyx_r = NULL;
3285   __Pyx_RefNannyDeclarations
3286   int __pyx_t_1;
3287   int __pyx_t_2;
3288   SDL_Window *__pyx_t_3;
3289   PyObject *__pyx_t_4 = NULL;
3290   PyObject *__pyx_t_5 = NULL;
3291   PyObject *__pyx_t_6 = NULL;
3292   char const *__pyx_t_7;
3293   char const *__pyx_t_8;
3294   Py_ssize_t __pyx_t_9;
3295   PyObject *(*__pyx_t_10)(PyObject *);
3296   PyObject *__pyx_t_11 = NULL;
3297   PyObject *__pyx_t_12 = NULL;
3298   Py_ssize_t __pyx_t_13;
3299   int __pyx_t_14;
3300   char const *__pyx_t_15;
3301   int __pyx_lineno = 0;
3302   const char *__pyx_filename = NULL;
3303   int __pyx_clineno = 0;
3304   __Pyx_RefNannySetupContext("messagebox", 0);
3305   __Pyx_INCREF(__pyx_v_title);
3306   __Pyx_INCREF(__pyx_v_message);
3307 
3308   /* "pygame/_sdl2/video.pyx":125
3309  *     # TODO: type check
3310  *     # TODO: color scheme
3311  *     cdef SDL_MessageBoxButtonData* c_buttons = NULL             # <<<<<<<<<<<<<<
3312  *
3313  *     cdef SDL_MessageBoxData data
3314  */
3315   __pyx_v_c_buttons = NULL;
3316 
3317   /* "pygame/_sdl2/video.pyx":128
3318  *
3319  *     cdef SDL_MessageBoxData data
3320  *     data.flags = 0             # <<<<<<<<<<<<<<
3321  *     if warn:
3322  *         data.flags |= _SDL_MESSAGEBOX_WARNING
3323  */
3324   __pyx_v_data.flags = 0;
3325 
3326   /* "pygame/_sdl2/video.pyx":129
3327  *     cdef SDL_MessageBoxData data
3328  *     data.flags = 0
3329  *     if warn:             # <<<<<<<<<<<<<<
3330  *         data.flags |= _SDL_MESSAGEBOX_WARNING
3331  *     if error:
3332  */
3333   __pyx_t_1 = (__pyx_v_warn != 0);
3334   if (__pyx_t_1) {
3335 
3336     /* "pygame/_sdl2/video.pyx":130
3337  *     data.flags = 0
3338  *     if warn:
3339  *         data.flags |= _SDL_MESSAGEBOX_WARNING             # <<<<<<<<<<<<<<
3340  *     if error:
3341  *         data.flags |= _SDL_MESSAGEBOX_ERROR
3342  */
3343     __pyx_v_data.flags = (__pyx_v_data.flags | SDL_MESSAGEBOX_WARNING);
3344 
3345     /* "pygame/_sdl2/video.pyx":129
3346  *     cdef SDL_MessageBoxData data
3347  *     data.flags = 0
3348  *     if warn:             # <<<<<<<<<<<<<<
3349  *         data.flags |= _SDL_MESSAGEBOX_WARNING
3350  *     if error:
3351  */
3352   }
3353 
3354   /* "pygame/_sdl2/video.pyx":131
3355  *     if warn:
3356  *         data.flags |= _SDL_MESSAGEBOX_WARNING
3357  *     if error:             # <<<<<<<<<<<<<<
3358  *         data.flags |= _SDL_MESSAGEBOX_ERROR
3359  *     if info:
3360  */
3361   __pyx_t_1 = (__pyx_v_error != 0);
3362   if (__pyx_t_1) {
3363 
3364     /* "pygame/_sdl2/video.pyx":132
3365  *         data.flags |= _SDL_MESSAGEBOX_WARNING
3366  *     if error:
3367  *         data.flags |= _SDL_MESSAGEBOX_ERROR             # <<<<<<<<<<<<<<
3368  *     if info:
3369  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION
3370  */
3371     __pyx_v_data.flags = (__pyx_v_data.flags | SDL_MESSAGEBOX_ERROR);
3372 
3373     /* "pygame/_sdl2/video.pyx":131
3374  *     if warn:
3375  *         data.flags |= _SDL_MESSAGEBOX_WARNING
3376  *     if error:             # <<<<<<<<<<<<<<
3377  *         data.flags |= _SDL_MESSAGEBOX_ERROR
3378  *     if info:
3379  */
3380   }
3381 
3382   /* "pygame/_sdl2/video.pyx":133
3383  *     if error:
3384  *         data.flags |= _SDL_MESSAGEBOX_ERROR
3385  *     if info:             # <<<<<<<<<<<<<<
3386  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION
3387  *     if not window:
3388  */
3389   __pyx_t_1 = (__pyx_v_info != 0);
3390   if (__pyx_t_1) {
3391 
3392     /* "pygame/_sdl2/video.pyx":134
3393  *         data.flags |= _SDL_MESSAGEBOX_ERROR
3394  *     if info:
3395  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION             # <<<<<<<<<<<<<<
3396  *     if not window:
3397  *         data.window = NULL
3398  */
3399     __pyx_v_data.flags = (__pyx_v_data.flags | SDL_MESSAGEBOX_INFORMATION);
3400 
3401     /* "pygame/_sdl2/video.pyx":133
3402  *     if error:
3403  *         data.flags |= _SDL_MESSAGEBOX_ERROR
3404  *     if info:             # <<<<<<<<<<<<<<
3405  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION
3406  *     if not window:
3407  */
3408   }
3409 
3410   /* "pygame/_sdl2/video.pyx":135
3411  *     if info:
3412  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION
3413  *     if not window:             # <<<<<<<<<<<<<<
3414  *         data.window = NULL
3415  *     else:
3416  */
3417   __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_window)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 135, __pyx_L1_error)
3418   __pyx_t_2 = ((!__pyx_t_1) != 0);
3419   if (__pyx_t_2) {
3420 
3421     /* "pygame/_sdl2/video.pyx":136
3422  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION
3423  *     if not window:
3424  *         data.window = NULL             # <<<<<<<<<<<<<<
3425  *     else:
3426  *         data.window = window._win
3427  */
3428     __pyx_v_data.window = NULL;
3429 
3430     /* "pygame/_sdl2/video.pyx":135
3431  *     if info:
3432  *         data.flags |= _SDL_MESSAGEBOX_INFORMATION
3433  *     if not window:             # <<<<<<<<<<<<<<
3434  *         data.window = NULL
3435  *     else:
3436  */
3437     goto __pyx_L6;
3438   }
3439 
3440   /* "pygame/_sdl2/video.pyx":138
3441  *         data.window = NULL
3442  *     else:
3443  *         data.window = window._win             # <<<<<<<<<<<<<<
3444  *     if title is not None:
3445  *         title = title.encode('utf8')
3446  */
3447   /*else*/ {
3448     __pyx_t_3 = __pyx_v_window->_win;
3449     __pyx_v_data.window = __pyx_t_3;
3450   }
3451   __pyx_L6:;
3452 
3453   /* "pygame/_sdl2/video.pyx":139
3454  *     else:
3455  *         data.window = window._win
3456  *     if title is not None:             # <<<<<<<<<<<<<<
3457  *         title = title.encode('utf8')
3458  *         data.title = title
3459  */
3460   __pyx_t_2 = (__pyx_v_title != Py_None);
3461   __pyx_t_1 = (__pyx_t_2 != 0);
3462   if (__pyx_t_1) {
3463 
3464     /* "pygame/_sdl2/video.pyx":140
3465  *         data.window = window._win
3466  *     if title is not None:
3467  *         title = title.encode('utf8')             # <<<<<<<<<<<<<<
3468  *         data.title = title
3469  *     else:
3470  */
3471     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error)
3472     __Pyx_GOTREF(__pyx_t_5);
3473     __pyx_t_6 = NULL;
3474     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
3475       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3476       if (likely(__pyx_t_6)) {
3477         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3478         __Pyx_INCREF(__pyx_t_6);
3479         __Pyx_INCREF(function);
3480         __Pyx_DECREF_SET(__pyx_t_5, function);
3481       }
3482     }
3483     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_utf8);
3484     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3485     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error)
3486     __Pyx_GOTREF(__pyx_t_4);
3487     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3488     __Pyx_DECREF_SET(__pyx_v_title, __pyx_t_4);
3489     __pyx_t_4 = 0;
3490 
3491     /* "pygame/_sdl2/video.pyx":141
3492  *     if title is not None:
3493  *         title = title.encode('utf8')
3494  *         data.title = title             # <<<<<<<<<<<<<<
3495  *     else:
3496  *         data.title = NULL
3497  */
3498     __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_title); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
3499     __pyx_v_data.title = __pyx_t_7;
3500 
3501     /* "pygame/_sdl2/video.pyx":139
3502  *     else:
3503  *         data.window = window._win
3504  *     if title is not None:             # <<<<<<<<<<<<<<
3505  *         title = title.encode('utf8')
3506  *         data.title = title
3507  */
3508     goto __pyx_L7;
3509   }
3510 
3511   /* "pygame/_sdl2/video.pyx":143
3512  *         data.title = title
3513  *     else:
3514  *         data.title = NULL             # <<<<<<<<<<<<<<
3515  *     message = message.encode('utf8')
3516  *     data.message = message
3517  */
3518   /*else*/ {
3519     __pyx_v_data.title = NULL;
3520   }
3521   __pyx_L7:;
3522 
3523   /* "pygame/_sdl2/video.pyx":144
3524  *     else:
3525  *         data.title = NULL
3526  *     message = message.encode('utf8')             # <<<<<<<<<<<<<<
3527  *     data.message = message
3528  *     data.colorScheme = NULL
3529  */
3530   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_message, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error)
3531   __Pyx_GOTREF(__pyx_t_5);
3532   __pyx_t_6 = NULL;
3533   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
3534     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3535     if (likely(__pyx_t_6)) {
3536       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3537       __Pyx_INCREF(__pyx_t_6);
3538       __Pyx_INCREF(function);
3539       __Pyx_DECREF_SET(__pyx_t_5, function);
3540     }
3541   }
3542   __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_utf8);
3543   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3544   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error)
3545   __Pyx_GOTREF(__pyx_t_4);
3546   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3547   __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
3548   __pyx_t_4 = 0;
3549 
3550   /* "pygame/_sdl2/video.pyx":145
3551  *         data.title = NULL
3552  *     message = message.encode('utf8')
3553  *     data.message = message             # <<<<<<<<<<<<<<
3554  *     data.colorScheme = NULL
3555  *
3556  */
3557   __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_message); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
3558   __pyx_v_data.message = __pyx_t_8;
3559 
3560   /* "pygame/_sdl2/video.pyx":146
3561  *     message = message.encode('utf8')
3562  *     data.message = message
3563  *     data.colorScheme = NULL             # <<<<<<<<<<<<<<
3564  *
3565  *     cdef SDL_MessageBoxButtonData button
3566  */
3567   __pyx_v_data.colorScheme = NULL;
3568 
3569   /* "pygame/_sdl2/video.pyx":149
3570  *
3571  *     cdef SDL_MessageBoxButtonData button
3572  *     if not buttons:             # <<<<<<<<<<<<<<
3573  *         button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\
3574  *                        _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3575  */
3576   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_buttons); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 149, __pyx_L1_error)
3577   __pyx_t_2 = ((!__pyx_t_1) != 0);
3578   if (__pyx_t_2) {
3579 
3580     /* "pygame/_sdl2/video.pyx":150
3581  *     cdef SDL_MessageBoxButtonData button
3582  *     if not buttons:
3583  *         button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\             # <<<<<<<<<<<<<<
3584  *                        _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3585  *         button.buttonid = 0
3586  */
3587     __pyx_v_button.flags = (SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT);
3588 
3589     /* "pygame/_sdl2/video.pyx":152
3590  *         button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\
3591  *                        _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3592  *         button.buttonid = 0             # <<<<<<<<<<<<<<
3593  *         button.text = "OK"
3594  *         data.buttons = &button
3595  */
3596     __pyx_v_button.buttonid = 0;
3597 
3598     /* "pygame/_sdl2/video.pyx":153
3599  *                        _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3600  *         button.buttonid = 0
3601  *         button.text = "OK"             # <<<<<<<<<<<<<<
3602  *         data.buttons = &button
3603  *         data.numbuttons = 1
3604  */
3605     __pyx_v_button.text = ((char const *)"OK");
3606 
3607     /* "pygame/_sdl2/video.pyx":154
3608  *         button.buttonid = 0
3609  *         button.text = "OK"
3610  *         data.buttons = &button             # <<<<<<<<<<<<<<
3611  *         data.numbuttons = 1
3612  *     else:
3613  */
3614     __pyx_v_data.buttons = (&__pyx_v_button);
3615 
3616     /* "pygame/_sdl2/video.pyx":155
3617  *         button.text = "OK"
3618  *         data.buttons = &button
3619  *         data.numbuttons = 1             # <<<<<<<<<<<<<<
3620  *     else:
3621  *         buttons_utf8 = [s.encode('utf8') for s in buttons]
3622  */
3623     __pyx_v_data.numbuttons = 1;
3624 
3625     /* "pygame/_sdl2/video.pyx":149
3626  *
3627  *     cdef SDL_MessageBoxButtonData button
3628  *     if not buttons:             # <<<<<<<<<<<<<<
3629  *         button.flags = _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT |\
3630  *                        _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3631  */
3632     goto __pyx_L8;
3633   }
3634 
3635   /* "pygame/_sdl2/video.pyx":157
3636  *         data.numbuttons = 1
3637  *     else:
3638  *         buttons_utf8 = [s.encode('utf8') for s in buttons]             # <<<<<<<<<<<<<<
3639  *         data.numbuttons = len(buttons)
3640  *         c_buttons =\
3641  */
3642   /*else*/ {
3643     __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error)
3644     __Pyx_GOTREF(__pyx_t_4);
3645     if (likely(PyList_CheckExact(__pyx_v_buttons)) || PyTuple_CheckExact(__pyx_v_buttons)) {
3646       __pyx_t_5 = __pyx_v_buttons; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
3647       __pyx_t_10 = NULL;
3648     } else {
3649       __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_buttons); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error)
3650       __Pyx_GOTREF(__pyx_t_5);
3651       __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L1_error)
3652     }
3653     for (;;) {
3654       if (likely(!__pyx_t_10)) {
3655         if (likely(PyList_CheckExact(__pyx_t_5))) {
3656           if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
3657           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3658           __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
3659           #else
3660           __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
3661           __Pyx_GOTREF(__pyx_t_6);
3662           #endif
3663         } else {
3664           if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
3665           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3666           __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
3667           #else
3668           __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
3669           __Pyx_GOTREF(__pyx_t_6);
3670           #endif
3671         }
3672       } else {
3673         __pyx_t_6 = __pyx_t_10(__pyx_t_5);
3674         if (unlikely(!__pyx_t_6)) {
3675           PyObject* exc_type = PyErr_Occurred();
3676           if (exc_type) {
3677             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3678             else __PYX_ERR(0, 157, __pyx_L1_error)
3679           }
3680           break;
3681         }
3682         __Pyx_GOTREF(__pyx_t_6);
3683       }
3684       __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_6);
3685       __pyx_t_6 = 0;
3686       __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 157, __pyx_L1_error)
3687       __Pyx_GOTREF(__pyx_t_11);
3688       __pyx_t_12 = NULL;
3689       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
3690         __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
3691         if (likely(__pyx_t_12)) {
3692           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
3693           __Pyx_INCREF(__pyx_t_12);
3694           __Pyx_INCREF(function);
3695           __Pyx_DECREF_SET(__pyx_t_11, function);
3696         }
3697       }
3698       __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_n_s_utf8);
3699       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
3700       if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
3701       __Pyx_GOTREF(__pyx_t_6);
3702       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3703       if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 157, __pyx_L1_error)
3704       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3705     }
3706     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3707     __pyx_v_buttons_utf8 = ((PyObject*)__pyx_t_4);
3708     __pyx_t_4 = 0;
3709 
3710     /* "pygame/_sdl2/video.pyx":158
3711  *     else:
3712  *         buttons_utf8 = [s.encode('utf8') for s in buttons]
3713  *         data.numbuttons = len(buttons)             # <<<<<<<<<<<<<<
3714  *         c_buttons =\
3715  *             <SDL_MessageBoxButtonData*>malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
3716  */
3717     __pyx_t_9 = PyObject_Length(__pyx_v_buttons); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 158, __pyx_L1_error)
3718     __pyx_v_data.numbuttons = __pyx_t_9;
3719 
3720     /* "pygame/_sdl2/video.pyx":160
3721  *         data.numbuttons = len(buttons)
3722  *         c_buttons =\
3723  *             <SDL_MessageBoxButtonData*>malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))             # <<<<<<<<<<<<<<
3724  *         if not c_buttons:
3725  *             raise MemoryError()
3726  */
3727     __pyx_v_c_buttons = ((SDL_MessageBoxButtonData *)malloc((__pyx_v_data.numbuttons * (sizeof(SDL_MessageBoxButtonData)))));
3728 
3729     /* "pygame/_sdl2/video.pyx":161
3730  *         c_buttons =\
3731  *             <SDL_MessageBoxButtonData*>malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
3732  *         if not c_buttons:             # <<<<<<<<<<<<<<
3733  *             raise MemoryError()
3734  *         for i, but in enumerate(reversed(buttons_utf8)):
3735  */
3736     __pyx_t_2 = ((!(__pyx_v_c_buttons != 0)) != 0);
3737     if (unlikely(__pyx_t_2)) {
3738 
3739       /* "pygame/_sdl2/video.pyx":162
3740  *             <SDL_MessageBoxButtonData*>malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
3741  *         if not c_buttons:
3742  *             raise MemoryError()             # <<<<<<<<<<<<<<
3743  *         for i, but in enumerate(reversed(buttons_utf8)):
3744  *             c_buttons[i].flags = 0
3745  */
3746       PyErr_NoMemory(); __PYX_ERR(0, 162, __pyx_L1_error)
3747 
3748       /* "pygame/_sdl2/video.pyx":161
3749  *         c_buttons =\
3750  *             <SDL_MessageBoxButtonData*>malloc(data.numbuttons * sizeof(SDL_MessageBoxButtonData))
3751  *         if not c_buttons:             # <<<<<<<<<<<<<<
3752  *             raise MemoryError()
3753  *         for i, but in enumerate(reversed(buttons_utf8)):
3754  */
3755     }
3756 
3757     /* "pygame/_sdl2/video.pyx":163
3758  *         if not c_buttons:
3759  *             raise MemoryError()
3760  *         for i, but in enumerate(reversed(buttons_utf8)):             # <<<<<<<<<<<<<<
3761  *             c_buttons[i].flags = 0
3762  *             c_buttons[i].buttonid = data.numbuttons - i - 1
3763  */
3764     __Pyx_INCREF(__pyx_int_0);
3765     __pyx_t_4 = __pyx_int_0;
3766     __pyx_t_5 = __pyx_v_buttons_utf8; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = PyList_GET_SIZE(__pyx_t_5) - 1;
3767     for (;;) {
3768       if (__pyx_t_9 < 0) break;
3769       if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
3770       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3771       __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9--; if (unlikely(0 < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
3772       #else
3773       __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9--; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 163, __pyx_L1_error)
3774       __Pyx_GOTREF(__pyx_t_6);
3775       #endif
3776       __Pyx_XDECREF_SET(__pyx_v_but, __pyx_t_6);
3777       __pyx_t_6 = 0;
3778       __Pyx_INCREF(__pyx_t_4);
3779       __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
3780       __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 163, __pyx_L1_error)
3781       __Pyx_GOTREF(__pyx_t_6);
3782       __Pyx_DECREF(__pyx_t_4);
3783       __pyx_t_4 = __pyx_t_6;
3784       __pyx_t_6 = 0;
3785 
3786       /* "pygame/_sdl2/video.pyx":164
3787  *             raise MemoryError()
3788  *         for i, but in enumerate(reversed(buttons_utf8)):
3789  *             c_buttons[i].flags = 0             # <<<<<<<<<<<<<<
3790  *             c_buttons[i].buttonid = data.numbuttons - i - 1
3791  *             if c_buttons[i].buttonid == return_button:
3792  */
3793       __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L1_error)
3794       (__pyx_v_c_buttons[__pyx_t_13]).flags = 0;
3795 
3796       /* "pygame/_sdl2/video.pyx":165
3797  *         for i, but in enumerate(reversed(buttons_utf8)):
3798  *             c_buttons[i].flags = 0
3799  *             c_buttons[i].buttonid = data.numbuttons - i - 1             # <<<<<<<<<<<<<<
3800  *             if c_buttons[i].buttonid == return_button:
3801  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
3802  */
3803       __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_data.numbuttons); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error)
3804       __Pyx_GOTREF(__pyx_t_6);
3805       __pyx_t_11 = PyNumber_Subtract(__pyx_t_6, __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 165, __pyx_L1_error)
3806       __Pyx_GOTREF(__pyx_t_11);
3807       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3808       __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_t_11, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error)
3809       __Pyx_GOTREF(__pyx_t_6);
3810       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3811       __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error)
3812       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3813       __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error)
3814       (__pyx_v_c_buttons[__pyx_t_13]).buttonid = __pyx_t_14;
3815 
3816       /* "pygame/_sdl2/video.pyx":166
3817  *             c_buttons[i].flags = 0
3818  *             c_buttons[i].buttonid = data.numbuttons - i - 1
3819  *             if c_buttons[i].buttonid == return_button:             # <<<<<<<<<<<<<<
3820  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
3821  *             if c_buttons[i].buttonid == escape_button:
3822  */
3823       __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error)
3824       __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_c_buttons[__pyx_t_13]).buttonid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error)
3825       __Pyx_GOTREF(__pyx_t_6);
3826       __pyx_t_11 = PyObject_RichCompare(__pyx_t_6, __pyx_v_return_button, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 166, __pyx_L1_error)
3827       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3828       __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 166, __pyx_L1_error)
3829       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3830       if (__pyx_t_2) {
3831 
3832         /* "pygame/_sdl2/video.pyx":167
3833  *             c_buttons[i].buttonid = data.numbuttons - i - 1
3834  *             if c_buttons[i].buttonid == return_button:
3835  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT             # <<<<<<<<<<<<<<
3836  *             if c_buttons[i].buttonid == escape_button:
3837  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3838  */
3839         __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error)
3840         (__pyx_v_c_buttons[__pyx_t_13]).flags = ((__pyx_v_c_buttons[__pyx_t_13]).flags | SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT);
3841 
3842         /* "pygame/_sdl2/video.pyx":166
3843  *             c_buttons[i].flags = 0
3844  *             c_buttons[i].buttonid = data.numbuttons - i - 1
3845  *             if c_buttons[i].buttonid == return_button:             # <<<<<<<<<<<<<<
3846  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
3847  *             if c_buttons[i].buttonid == escape_button:
3848  */
3849       }
3850 
3851       /* "pygame/_sdl2/video.pyx":168
3852  *             if c_buttons[i].buttonid == return_button:
3853  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
3854  *             if c_buttons[i].buttonid == escape_button:             # <<<<<<<<<<<<<<
3855  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3856  *             c_buttons[i].text = but
3857  */
3858       __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
3859       __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_c_buttons[__pyx_t_13]).buttonid); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 168, __pyx_L1_error)
3860       __Pyx_GOTREF(__pyx_t_11);
3861       __pyx_t_6 = PyObject_RichCompare(__pyx_t_11, __pyx_v_escape_button, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error)
3862       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3863       __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
3864       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3865       if (__pyx_t_2) {
3866 
3867         /* "pygame/_sdl2/video.pyx":169
3868  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
3869  *             if c_buttons[i].buttonid == escape_button:
3870  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT             # <<<<<<<<<<<<<<
3871  *             c_buttons[i].text = but
3872  *         data.buttons = c_buttons
3873  */
3874         __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error)
3875         (__pyx_v_c_buttons[__pyx_t_13]).flags = ((__pyx_v_c_buttons[__pyx_t_13]).flags | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT);
3876 
3877         /* "pygame/_sdl2/video.pyx":168
3878  *             if c_buttons[i].buttonid == return_button:
3879  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
3880  *             if c_buttons[i].buttonid == escape_button:             # <<<<<<<<<<<<<<
3881  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3882  *             c_buttons[i].text = but
3883  */
3884       }
3885 
3886       /* "pygame/_sdl2/video.pyx":170
3887  *             if c_buttons[i].buttonid == escape_button:
3888  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3889  *             c_buttons[i].text = but             # <<<<<<<<<<<<<<
3890  *         data.buttons = c_buttons
3891  *
3892  */
3893       __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_v_but); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
3894       __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
3895       (__pyx_v_c_buttons[__pyx_t_13]).text = __pyx_t_15;
3896 
3897       /* "pygame/_sdl2/video.pyx":163
3898  *         if not c_buttons:
3899  *             raise MemoryError()
3900  *         for i, but in enumerate(reversed(buttons_utf8)):             # <<<<<<<<<<<<<<
3901  *             c_buttons[i].flags = 0
3902  *             c_buttons[i].buttonid = data.numbuttons - i - 1
3903  */
3904     }
3905     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3906     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3907 
3908     /* "pygame/_sdl2/video.pyx":171
3909  *                 c_buttons[i].flags |= _SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
3910  *             c_buttons[i].text = but
3911  *         data.buttons = c_buttons             # <<<<<<<<<<<<<<
3912  *
3913  *     cdef int buttonid
3914  */
3915     __pyx_v_data.buttons = __pyx_v_c_buttons;
3916   }
3917   __pyx_L8:;
3918 
3919   /* "pygame/_sdl2/video.pyx":174
3920  *
3921  *     cdef int buttonid
3922  *     if SDL_ShowMessageBox(&data, &buttonid):             # <<<<<<<<<<<<<<
3923  *         free(c_buttons)
3924  *         raise errorfnc()
3925  */
3926   __pyx_t_2 = (SDL_ShowMessageBox((&__pyx_v_data), (&__pyx_v_buttonid)) != 0);
3927   if (unlikely(__pyx_t_2)) {
3928 
3929     /* "pygame/_sdl2/video.pyx":175
3930  *     cdef int buttonid
3931  *     if SDL_ShowMessageBox(&data, &buttonid):
3932  *         free(c_buttons)             # <<<<<<<<<<<<<<
3933  *         raise errorfnc()
3934  *
3935  */
3936     free(__pyx_v_c_buttons);
3937 
3938     /* "pygame/_sdl2/video.pyx":176
3939  *     if SDL_ShowMessageBox(&data, &buttonid):
3940  *         free(c_buttons)
3941  *         raise errorfnc()             # <<<<<<<<<<<<<<
3942  *
3943  *     free(c_buttons)
3944  */
3945     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_errorfnc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error)
3946     __Pyx_GOTREF(__pyx_t_5);
3947     __pyx_t_6 = NULL;
3948     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3949       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3950       if (likely(__pyx_t_6)) {
3951         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3952         __Pyx_INCREF(__pyx_t_6);
3953         __Pyx_INCREF(function);
3954         __Pyx_DECREF_SET(__pyx_t_5, function);
3955       }
3956     }
3957     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
3958     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3959     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error)
3960     __Pyx_GOTREF(__pyx_t_4);
3961     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3962     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3963     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3964     __PYX_ERR(0, 176, __pyx_L1_error)
3965 
3966     /* "pygame/_sdl2/video.pyx":174
3967  *
3968  *     cdef int buttonid
3969  *     if SDL_ShowMessageBox(&data, &buttonid):             # <<<<<<<<<<<<<<
3970  *         free(c_buttons)
3971  *         raise errorfnc()
3972  */
3973   }
3974 
3975   /* "pygame/_sdl2/video.pyx":178
3976  *         raise errorfnc()
3977  *
3978  *     free(c_buttons)             # <<<<<<<<<<<<<<
3979  *     return buttonid
3980  *
3981  */
3982   free(__pyx_v_c_buttons);
3983 
3984   /* "pygame/_sdl2/video.pyx":179
3985  *
3986  *     free(c_buttons)
3987  *     return buttonid             # <<<<<<<<<<<<<<
3988  *
3989  *
3990  */
3991   __Pyx_XDECREF(__pyx_r);
3992   __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_buttonid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error)
3993   __Pyx_GOTREF(__pyx_t_4);
3994   __pyx_r = __pyx_t_4;
3995   __pyx_t_4 = 0;
3996   goto __pyx_L0;
3997 
3998   /* "pygame/_sdl2/video.pyx":103
3999  *
4000  *
4001  * def messagebox(title, message,             # <<<<<<<<<<<<<<
4002  *                Window window=None,
4003  *                bint info=False,
4004  */
4005 
4006   /* function exit code */
4007   __pyx_L1_error:;
4008   __Pyx_XDECREF(__pyx_t_4);
4009   __Pyx_XDECREF(__pyx_t_5);
4010   __Pyx_XDECREF(__pyx_t_6);
4011   __Pyx_XDECREF(__pyx_t_11);
4012   __Pyx_XDECREF(__pyx_t_12);
4013   __Pyx_AddTraceback("pygame._sdl2.video.messagebox", __pyx_clineno, __pyx_lineno, __pyx_filename);
4014   __pyx_r = NULL;
4015   __pyx_L0:;
4016   __Pyx_XDECREF(__pyx_v_buttons_utf8);
4017   __Pyx_XDECREF(__pyx_v_i);
4018   __Pyx_XDECREF(__pyx_v_but);
4019   __Pyx_XDECREF(__pyx_v_s);
4020   __Pyx_XDECREF(__pyx_v_title);
4021   __Pyx_XDECREF(__pyx_v_message);
4022   __Pyx_XGIVEREF(__pyx_r);
4023   __Pyx_RefNannyFinishContext();
4024   return __pyx_r;
4025 }
4026 
4027 /* "pygame/_sdl2/video.pyx":207
4028  *
4029  *     @classmethod
4030  *     def from_display_module(cls):             # <<<<<<<<<<<<<<
4031  *         cdef Window self = cls.__new__(cls)
4032  *         cdef SDL_Window* window = pg_GetDefaultWindow()
4033  */
4034 
4035 /* Python wrapper */
4036 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module(PyObject * __pyx_v_cls,CYTHON_UNUSED PyObject * unused)4037 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module(PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *unused) {
4038   PyObject *__pyx_r = 0;
4039   __Pyx_RefNannyDeclarations
4040   __Pyx_RefNannySetupContext("from_display_module (wrapper)", 0);
4041   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(((PyTypeObject*)__pyx_v_cls));
4042 
4043   /* function exit code */
4044   __Pyx_RefNannyFinishContext();
4045   return __pyx_r;
4046 }
4047 
__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTypeObject * __pyx_v_cls)4048 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_from_display_module(PyTypeObject *__pyx_v_cls) {
4049   struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self = 0;
4050   SDL_Window *__pyx_v_window;
4051   PyObject *__pyx_r = NULL;
4052   __Pyx_RefNannyDeclarations
4053   PyObject *__pyx_t_1 = NULL;
4054   int __pyx_t_2;
4055   PyObject *__pyx_t_3 = NULL;
4056   PyObject *__pyx_t_4 = NULL;
4057   int __pyx_lineno = 0;
4058   const char *__pyx_filename = NULL;
4059   int __pyx_clineno = 0;
4060   __Pyx_RefNannySetupContext("from_display_module", 0);
4061 
4062   /* "pygame/_sdl2/video.pyx":208
4063  *     @classmethod
4064  *     def from_display_module(cls):
4065  *         cdef Window self = cls.__new__(cls)             # <<<<<<<<<<<<<<
4066  *         cdef SDL_Window* window = pg_GetDefaultWindow()
4067  *         if not window:
4068  */
4069   if (unlikely(((PyObject *)__pyx_v_cls) == Py_None)) {
4070     PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
4071     __PYX_ERR(0, 208, __pyx_L1_error)
4072   }
4073   __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
4074   __Pyx_GOTREF(__pyx_t_1);
4075   if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video_Window)))) __PYX_ERR(0, 208, __pyx_L1_error)
4076   __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_t_1);
4077   __pyx_t_1 = 0;
4078 
4079   /* "pygame/_sdl2/video.pyx":209
4080  *     def from_display_module(cls):
4081  *         cdef Window self = cls.__new__(cls)
4082  *         cdef SDL_Window* window = pg_GetDefaultWindow()             # <<<<<<<<<<<<<<
4083  *         if not window:
4084  *             raise error()
4085  */
4086   __pyx_v_window = pg_GetDefaultWindow();
4087 
4088   /* "pygame/_sdl2/video.pyx":210
4089  *         cdef Window self = cls.__new__(cls)
4090  *         cdef SDL_Window* window = pg_GetDefaultWindow()
4091  *         if not window:             # <<<<<<<<<<<<<<
4092  *             raise error()
4093  *         self._win=window
4094  */
4095   __pyx_t_2 = ((!(__pyx_v_window != 0)) != 0);
4096   if (unlikely(__pyx_t_2)) {
4097 
4098     /* "pygame/_sdl2/video.pyx":211
4099  *         cdef SDL_Window* window = pg_GetDefaultWindow()
4100  *         if not window:
4101  *             raise error()             # <<<<<<<<<<<<<<
4102  *         self._win=window
4103  *         self._is_borrowed=1
4104  */
4105     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
4106     __Pyx_GOTREF(__pyx_t_3);
4107     __pyx_t_4 = NULL;
4108     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4109       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4110       if (likely(__pyx_t_4)) {
4111         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4112         __Pyx_INCREF(__pyx_t_4);
4113         __Pyx_INCREF(function);
4114         __Pyx_DECREF_SET(__pyx_t_3, function);
4115       }
4116     }
4117     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
4118     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4119     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
4120     __Pyx_GOTREF(__pyx_t_1);
4121     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4122     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4123     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4124     __PYX_ERR(0, 211, __pyx_L1_error)
4125 
4126     /* "pygame/_sdl2/video.pyx":210
4127  *         cdef Window self = cls.__new__(cls)
4128  *         cdef SDL_Window* window = pg_GetDefaultWindow()
4129  *         if not window:             # <<<<<<<<<<<<<<
4130  *             raise error()
4131  *         self._win=window
4132  */
4133   }
4134 
4135   /* "pygame/_sdl2/video.pyx":212
4136  *         if not window:
4137  *             raise error()
4138  *         self._win=window             # <<<<<<<<<<<<<<
4139  *         self._is_borrowed=1
4140  *         SDL_SetWindowData(window, "pg_window", <PyObject*>self)
4141  */
4142   __pyx_v_self->_win = __pyx_v_window;
4143 
4144   /* "pygame/_sdl2/video.pyx":213
4145  *             raise error()
4146  *         self._win=window
4147  *         self._is_borrowed=1             # <<<<<<<<<<<<<<
4148  *         SDL_SetWindowData(window, "pg_window", <PyObject*>self)
4149  *         return self
4150  */
4151   __pyx_v_self->_is_borrowed = 1;
4152 
4153   /* "pygame/_sdl2/video.pyx":214
4154  *         self._win=window
4155  *         self._is_borrowed=1
4156  *         SDL_SetWindowData(window, "pg_window", <PyObject*>self)             # <<<<<<<<<<<<<<
4157  *         return self
4158  *
4159  */
4160   (void)(SDL_SetWindowData(__pyx_v_window, ((char const *)"pg_window"), ((PyObject *)__pyx_v_self)));
4161 
4162   /* "pygame/_sdl2/video.pyx":215
4163  *         self._is_borrowed=1
4164  *         SDL_SetWindowData(window, "pg_window", <PyObject*>self)
4165  *         return self             # <<<<<<<<<<<<<<
4166  *
4167  *     def __init__(self, title='pygame',
4168  */
4169   __Pyx_XDECREF(__pyx_r);
4170   __Pyx_INCREF(((PyObject *)__pyx_v_self));
4171   __pyx_r = ((PyObject *)__pyx_v_self);
4172   goto __pyx_L0;
4173 
4174   /* "pygame/_sdl2/video.pyx":207
4175  *
4176  *     @classmethod
4177  *     def from_display_module(cls):             # <<<<<<<<<<<<<<
4178  *         cdef Window self = cls.__new__(cls)
4179  *         cdef SDL_Window* window = pg_GetDefaultWindow()
4180  */
4181 
4182   /* function exit code */
4183   __pyx_L1_error:;
4184   __Pyx_XDECREF(__pyx_t_1);
4185   __Pyx_XDECREF(__pyx_t_3);
4186   __Pyx_XDECREF(__pyx_t_4);
4187   __Pyx_AddTraceback("pygame._sdl2.video.Window.from_display_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
4188   __pyx_r = NULL;
4189   __pyx_L0:;
4190   __Pyx_XDECREF((PyObject *)__pyx_v_self);
4191   __Pyx_XGIVEREF(__pyx_r);
4192   __Pyx_RefNannyFinishContext();
4193   return __pyx_r;
4194 }
4195 
4196 /* "pygame/_sdl2/video.pyx":217
4197  *         return self
4198  *
4199  *     def __init__(self, title='pygame',             # <<<<<<<<<<<<<<
4200  *                  size=DEFAULT_SIZE,
4201  *                  position=WINDOWPOS_UNDEFINED,
4202  */
4203 
4204 /* Python wrapper */
4205 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4206 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_2__init__[] = " Create a window with the specified position, dimensions, and flags.\n\n        :param str title: the title of the window, in UTF-8 encoding\n        :param tuple size: the size of the window, in screen coordinates (width, height)\n        :param position: a tuple specifying the window position, WINDOWPOS_CENTERED, or WINDOWPOS_UNDEFINED.\n        :param bool fullscreen: fullscreen window using the window size as the resolution (videomode change)\n        :param bool fullscreen_desktop: fullscreen window using the current desktop resolution\n        :param bool opengl: Usable with OpenGL context. You will still need to create an OpenGL context.\n        :param bool vulkan: usable with a Vulkan instance\n        :param bool hidden: window is not visible\n        :param bool borderless: no window decoration\n        :param bool resizable: window can be resized\n        :param bool minimized: window is minimized\n        :param bool maximized: window is maximized\n        :param bool input_grabbed: window has grabbed input focus\n        :param bool input_focus: window has input focus\n        :param bool mouse_focus: window has mouse focus\n        :param bool foreign: window not created by SDL\n        :param bool allow_highdpi: window should be created in high-DPI mode if supported (>= SDL 2.0.1)\n        :param bool mouse_capture: window has mouse captured (unrelated to INPUT_GRABBED, >= SDL 2.0.4)\n        :param bool always_on_top: window should always be above others (X11 only, >= SDL 2.0.5)\n        :param bool skip_taskbar: window should not be added to the taskbar (X11 only, >= SDL 2.0.5)\n        :param bool utility: window should be treated as a utility window (X11 only, >= SDL 2.0.5)\n        :param bool tooltip: window should be treated as a tooltip (X11 only, >= SDL 2.0.5)\n        :param bool popup_menu: window should be treated as a popup menu (X11 only, >= SDL 2.0.5)\n        ";
4207 #if CYTHON_COMPILING_IN_CPYTHON
4208 struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__;
4209 #endif
__pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4210 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4211   PyObject *__pyx_v_title = 0;
4212   PyObject *__pyx_v_size = 0;
4213   PyObject *__pyx_v_position = 0;
4214   int __pyx_v_fullscreen;
4215   int __pyx_v_fullscreen_desktop;
4216   PyObject *__pyx_v_kwargs = 0;
4217   int __pyx_lineno = 0;
4218   const char *__pyx_filename = NULL;
4219   int __pyx_clineno = 0;
4220   int __pyx_r;
4221   __Pyx_RefNannyDeclarations
4222   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4223   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
4224   __Pyx_GOTREF(__pyx_v_kwargs);
4225   {
4226     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_title,&__pyx_n_s_size,&__pyx_n_s_position,&__pyx_n_s_fullscreen,&__pyx_n_s_fullscreen_desktop,0};
4227     PyObject* values[5] = {0,0,0,0,0};
4228     values[0] = ((PyObject *)__pyx_n_s_pygame);
4229     values[1] = __pyx_k__3;
4230     values[2] = __pyx_k__4;
4231     if (unlikely(__pyx_kwds)) {
4232       Py_ssize_t kw_args;
4233       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4234       switch (pos_args) {
4235         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4236         CYTHON_FALLTHROUGH;
4237         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4238         CYTHON_FALLTHROUGH;
4239         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4240         CYTHON_FALLTHROUGH;
4241         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4242         CYTHON_FALLTHROUGH;
4243         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4244         CYTHON_FALLTHROUGH;
4245         case  0: break;
4246         default: goto __pyx_L5_argtuple_error;
4247       }
4248       kw_args = PyDict_Size(__pyx_kwds);
4249       switch (pos_args) {
4250         case  0:
4251         if (kw_args > 0) {
4252           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_title);
4253           if (value) { values[0] = value; kw_args--; }
4254         }
4255         CYTHON_FALLTHROUGH;
4256         case  1:
4257         if (kw_args > 0) {
4258           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
4259           if (value) { values[1] = value; kw_args--; }
4260         }
4261         CYTHON_FALLTHROUGH;
4262         case  2:
4263         if (kw_args > 0) {
4264           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_position);
4265           if (value) { values[2] = value; kw_args--; }
4266         }
4267         CYTHON_FALLTHROUGH;
4268         case  3:
4269         if (kw_args > 0) {
4270           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fullscreen);
4271           if (value) { values[3] = value; kw_args--; }
4272         }
4273         CYTHON_FALLTHROUGH;
4274         case  4:
4275         if (kw_args > 0) {
4276           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fullscreen_desktop);
4277           if (value) { values[4] = value; kw_args--; }
4278         }
4279       }
4280       if (unlikely(kw_args > 0)) {
4281         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 217, __pyx_L3_error)
4282       }
4283     } else {
4284       switch (PyTuple_GET_SIZE(__pyx_args)) {
4285         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4286         CYTHON_FALLTHROUGH;
4287         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4288         CYTHON_FALLTHROUGH;
4289         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4290         CYTHON_FALLTHROUGH;
4291         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4292         CYTHON_FALLTHROUGH;
4293         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4294         CYTHON_FALLTHROUGH;
4295         case  0: break;
4296         default: goto __pyx_L5_argtuple_error;
4297       }
4298     }
4299     __pyx_v_title = values[0];
4300     __pyx_v_size = values[1];
4301     __pyx_v_position = values[2];
4302     if (values[3]) {
4303       __pyx_v_fullscreen = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_fullscreen == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
4304     } else {
4305 
4306       /* "pygame/_sdl2/video.pyx":220
4307  *                  size=DEFAULT_SIZE,
4308  *                  position=WINDOWPOS_UNDEFINED,
4309  *                  bint fullscreen=False,             # <<<<<<<<<<<<<<
4310  *                  bint fullscreen_desktop=False, **kwargs):
4311  *         """ Create a window with the specified position, dimensions, and flags.
4312  */
4313       __pyx_v_fullscreen = ((int)0);
4314     }
4315     if (values[4]) {
4316       __pyx_v_fullscreen_desktop = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_fullscreen_desktop == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L3_error)
4317     } else {
4318 
4319       /* "pygame/_sdl2/video.pyx":221
4320  *                  position=WINDOWPOS_UNDEFINED,
4321  *                  bint fullscreen=False,
4322  *                  bint fullscreen_desktop=False, **kwargs):             # <<<<<<<<<<<<<<
4323  *         """ Create a window with the specified position, dimensions, and flags.
4324  *
4325  */
4326       __pyx_v_fullscreen_desktop = ((int)0);
4327     }
4328   }
4329   goto __pyx_L4_argument_unpacking_done;
4330   __pyx_L5_argtuple_error:;
4331   __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 217, __pyx_L3_error)
4332   __pyx_L3_error:;
4333   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
4334   __Pyx_AddTraceback("pygame._sdl2.video.Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4335   __Pyx_RefNannyFinishContext();
4336   return -1;
4337   __pyx_L4_argument_unpacking_done:;
4338   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), __pyx_v_title, __pyx_v_size, __pyx_v_position, __pyx_v_fullscreen, __pyx_v_fullscreen_desktop, __pyx_v_kwargs);
4339 
4340   /* "pygame/_sdl2/video.pyx":217
4341  *         return self
4342  *
4343  *     def __init__(self, title='pygame',             # <<<<<<<<<<<<<<
4344  *                  size=DEFAULT_SIZE,
4345  *                  position=WINDOWPOS_UNDEFINED,
4346  */
4347 
4348   /* function exit code */
4349   __Pyx_XDECREF(__pyx_v_kwargs);
4350   __Pyx_RefNannyFinishContext();
4351   return __pyx_r;
4352 }
4353 
__pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_title,PyObject * __pyx_v_size,PyObject * __pyx_v_position,int __pyx_v_fullscreen,int __pyx_v_fullscreen_desktop,PyObject * __pyx_v_kwargs)4354 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title, PyObject *__pyx_v_size, PyObject *__pyx_v_position, int __pyx_v_fullscreen, int __pyx_v_fullscreen_desktop, PyObject *__pyx_v_kwargs) {
4355   PyObject *__pyx_v_x = NULL;
4356   PyObject *__pyx_v_y = NULL;
4357   PyObject *__pyx_v_flags = NULL;
4358   PyObject *__pyx_v__kwarg_to_flag = NULL;
4359   PyObject *__pyx_v_k = NULL;
4360   PyObject *__pyx_v_v = NULL;
4361   PyObject *__pyx_v_flag = NULL;
4362   PyObject *__pyx_v_pygame = NULL;
4363   PyObject *__pyx_v_surf = NULL;
4364   int __pyx_r;
4365   __Pyx_RefNannyDeclarations
4366   PyObject *__pyx_t_1 = NULL;
4367   PyObject *__pyx_t_2 = NULL;
4368   int __pyx_t_3;
4369   PyObject *__pyx_t_4 = NULL;
4370   PyObject *(*__pyx_t_5)(PyObject *);
4371   int __pyx_t_6;
4372   Py_ssize_t __pyx_t_7;
4373   PyObject *(*__pyx_t_8)(PyObject *);
4374   PyObject *__pyx_t_9 = NULL;
4375   PyObject *__pyx_t_10 = NULL;
4376   PyObject *__pyx_t_11 = NULL;
4377   PyObject *__pyx_t_12 = NULL;
4378   PyObject *__pyx_t_13 = NULL;
4379   int __pyx_t_14;
4380   PyObject *__pyx_t_15 = NULL;
4381   char const *__pyx_t_16;
4382   int __pyx_t_17;
4383   int __pyx_t_18;
4384   int __pyx_t_19;
4385   Uint32 __pyx_t_20;
4386   int __pyx_lineno = 0;
4387   const char *__pyx_filename = NULL;
4388   int __pyx_clineno = 0;
4389   __Pyx_RefNannySetupContext("__init__", 0);
4390 
4391   /* "pygame/_sdl2/video.pyx":250
4392  *         # https://wiki.libsdl.org/SDL_CreateWindow
4393  *         # https://wiki.libsdl.org/SDL_WindowFlags
4394  *         if position == WINDOWPOS_UNDEFINED:             # <<<<<<<<<<<<<<
4395  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
4396  *         elif position == WINDOWPOS_CENTERED:
4397  */
4398   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
4399   __Pyx_GOTREF(__pyx_t_1);
4400   __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
4401   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4402   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 250, __pyx_L1_error)
4403   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4404   if (__pyx_t_3) {
4405 
4406     /* "pygame/_sdl2/video.pyx":251
4407  *         # https://wiki.libsdl.org/SDL_WindowFlags
4408  *         if position == WINDOWPOS_UNDEFINED:
4409  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED             # <<<<<<<<<<<<<<
4410  *         elif position == WINDOWPOS_CENTERED:
4411  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
4412  */
4413     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
4414     __Pyx_GOTREF(__pyx_t_2);
4415     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
4416     __Pyx_GOTREF(__pyx_t_1);
4417     __pyx_v_x = __pyx_t_2;
4418     __pyx_t_2 = 0;
4419     __pyx_v_y = __pyx_t_1;
4420     __pyx_t_1 = 0;
4421 
4422     /* "pygame/_sdl2/video.pyx":250
4423  *         # https://wiki.libsdl.org/SDL_CreateWindow
4424  *         # https://wiki.libsdl.org/SDL_WindowFlags
4425  *         if position == WINDOWPOS_UNDEFINED:             # <<<<<<<<<<<<<<
4426  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
4427  *         elif position == WINDOWPOS_CENTERED:
4428  */
4429     goto __pyx_L3;
4430   }
4431 
4432   /* "pygame/_sdl2/video.pyx":252
4433  *         if position == WINDOWPOS_UNDEFINED:
4434  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
4435  *         elif position == WINDOWPOS_CENTERED:             # <<<<<<<<<<<<<<
4436  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
4437  *         else:
4438  */
4439   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
4440   __Pyx_GOTREF(__pyx_t_1);
4441   __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error)
4442   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4443   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 252, __pyx_L1_error)
4444   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4445   if (__pyx_t_3) {
4446 
4447     /* "pygame/_sdl2/video.pyx":253
4448  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
4449  *         elif position == WINDOWPOS_CENTERED:
4450  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED             # <<<<<<<<<<<<<<
4451  *         else:
4452  *             x, y = position
4453  */
4454     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
4455     __Pyx_GOTREF(__pyx_t_2);
4456     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
4457     __Pyx_GOTREF(__pyx_t_1);
4458     __pyx_v_x = __pyx_t_2;
4459     __pyx_t_2 = 0;
4460     __pyx_v_y = __pyx_t_1;
4461     __pyx_t_1 = 0;
4462 
4463     /* "pygame/_sdl2/video.pyx":252
4464  *         if position == WINDOWPOS_UNDEFINED:
4465  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
4466  *         elif position == WINDOWPOS_CENTERED:             # <<<<<<<<<<<<<<
4467  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
4468  *         else:
4469  */
4470     goto __pyx_L3;
4471   }
4472 
4473   /* "pygame/_sdl2/video.pyx":255
4474  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
4475  *         else:
4476  *             x, y = position             # <<<<<<<<<<<<<<
4477  *
4478  *         flags = 0
4479  */
4480   /*else*/ {
4481     if ((likely(PyTuple_CheckExact(__pyx_v_position))) || (PyList_CheckExact(__pyx_v_position))) {
4482       PyObject* sequence = __pyx_v_position;
4483       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4484       if (unlikely(size != 2)) {
4485         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4486         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4487         __PYX_ERR(0, 255, __pyx_L1_error)
4488       }
4489       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4490       if (likely(PyTuple_CheckExact(sequence))) {
4491         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
4492         __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
4493       } else {
4494         __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
4495         __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
4496       }
4497       __Pyx_INCREF(__pyx_t_1);
4498       __Pyx_INCREF(__pyx_t_2);
4499       #else
4500       __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
4501       __Pyx_GOTREF(__pyx_t_1);
4502       __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
4503       __Pyx_GOTREF(__pyx_t_2);
4504       #endif
4505     } else {
4506       Py_ssize_t index = -1;
4507       __pyx_t_4 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
4508       __Pyx_GOTREF(__pyx_t_4);
4509       __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
4510       index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
4511       __Pyx_GOTREF(__pyx_t_1);
4512       index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
4513       __Pyx_GOTREF(__pyx_t_2);
4514       if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 255, __pyx_L1_error)
4515       __pyx_t_5 = NULL;
4516       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4517       goto __pyx_L5_unpacking_done;
4518       __pyx_L4_unpacking_failed:;
4519       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4520       __pyx_t_5 = NULL;
4521       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4522       __PYX_ERR(0, 255, __pyx_L1_error)
4523       __pyx_L5_unpacking_done:;
4524     }
4525     __pyx_v_x = __pyx_t_1;
4526     __pyx_t_1 = 0;
4527     __pyx_v_y = __pyx_t_2;
4528     __pyx_t_2 = 0;
4529   }
4530   __pyx_L3:;
4531 
4532   /* "pygame/_sdl2/video.pyx":257
4533  *             x, y = position
4534  *
4535  *         flags = 0             # <<<<<<<<<<<<<<
4536  *         if fullscreen and fullscreen_desktop:
4537  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
4538  */
4539   __Pyx_INCREF(__pyx_int_0);
4540   __pyx_v_flags = __pyx_int_0;
4541 
4542   /* "pygame/_sdl2/video.pyx":258
4543  *
4544  *         flags = 0
4545  *         if fullscreen and fullscreen_desktop:             # <<<<<<<<<<<<<<
4546  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
4547  *         if fullscreen:
4548  */
4549   __pyx_t_6 = (__pyx_v_fullscreen != 0);
4550   if (__pyx_t_6) {
4551   } else {
4552     __pyx_t_3 = __pyx_t_6;
4553     goto __pyx_L7_bool_binop_done;
4554   }
4555   __pyx_t_6 = (__pyx_v_fullscreen_desktop != 0);
4556   __pyx_t_3 = __pyx_t_6;
4557   __pyx_L7_bool_binop_done:;
4558   if (unlikely(__pyx_t_3)) {
4559 
4560     /* "pygame/_sdl2/video.pyx":259
4561  *         flags = 0
4562  *         if fullscreen and fullscreen_desktop:
4563  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")             # <<<<<<<<<<<<<<
4564  *         if fullscreen:
4565  *             flags |= _SDL_WINDOW_FULLSCREEN
4566  */
4567     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
4568     __Pyx_GOTREF(__pyx_t_2);
4569     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4570     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4571     __PYX_ERR(0, 259, __pyx_L1_error)
4572 
4573     /* "pygame/_sdl2/video.pyx":258
4574  *
4575  *         flags = 0
4576  *         if fullscreen and fullscreen_desktop:             # <<<<<<<<<<<<<<
4577  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
4578  *         if fullscreen:
4579  */
4580   }
4581 
4582   /* "pygame/_sdl2/video.pyx":260
4583  *         if fullscreen and fullscreen_desktop:
4584  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
4585  *         if fullscreen:             # <<<<<<<<<<<<<<
4586  *             flags |= _SDL_WINDOW_FULLSCREEN
4587  *         elif fullscreen_desktop:
4588  */
4589   __pyx_t_3 = (__pyx_v_fullscreen != 0);
4590   if (__pyx_t_3) {
4591 
4592     /* "pygame/_sdl2/video.pyx":261
4593  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
4594  *         if fullscreen:
4595  *             flags |= _SDL_WINDOW_FULLSCREEN             # <<<<<<<<<<<<<<
4596  *         elif fullscreen_desktop:
4597  *             flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP
4598  */
4599     __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FULLSCREEN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error)
4600     __Pyx_GOTREF(__pyx_t_2);
4601     __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
4602     __Pyx_GOTREF(__pyx_t_1);
4603     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4604     __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_1);
4605     __pyx_t_1 = 0;
4606 
4607     /* "pygame/_sdl2/video.pyx":260
4608  *         if fullscreen and fullscreen_desktop:
4609  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")
4610  *         if fullscreen:             # <<<<<<<<<<<<<<
4611  *             flags |= _SDL_WINDOW_FULLSCREEN
4612  *         elif fullscreen_desktop:
4613  */
4614     goto __pyx_L9;
4615   }
4616 
4617   /* "pygame/_sdl2/video.pyx":262
4618  *         if fullscreen:
4619  *             flags |= _SDL_WINDOW_FULLSCREEN
4620  *         elif fullscreen_desktop:             # <<<<<<<<<<<<<<
4621  *             flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP
4622  *
4623  */
4624   __pyx_t_3 = (__pyx_v_fullscreen_desktop != 0);
4625   if (__pyx_t_3) {
4626 
4627     /* "pygame/_sdl2/video.pyx":263
4628  *             flags |= _SDL_WINDOW_FULLSCREEN
4629  *         elif fullscreen_desktop:
4630  *             flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP             # <<<<<<<<<<<<<<
4631  *
4632  *         _kwarg_to_flag = self._kwarg_to_flag
4633  */
4634     __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FULLSCREEN_DESKTOP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error)
4635     __Pyx_GOTREF(__pyx_t_1);
4636     __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
4637     __Pyx_GOTREF(__pyx_t_2);
4638     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4639     __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_2);
4640     __pyx_t_2 = 0;
4641 
4642     /* "pygame/_sdl2/video.pyx":262
4643  *         if fullscreen:
4644  *             flags |= _SDL_WINDOW_FULLSCREEN
4645  *         elif fullscreen_desktop:             # <<<<<<<<<<<<<<
4646  *             flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP
4647  *
4648  */
4649   }
4650   __pyx_L9:;
4651 
4652   /* "pygame/_sdl2/video.pyx":265
4653  *             flags |= _SDL_WINDOW_FULLSCREEN_DESKTOP
4654  *
4655  *         _kwarg_to_flag = self._kwarg_to_flag             # <<<<<<<<<<<<<<
4656  *         for k, v in kwargs.items():
4657  *             try:
4658  */
4659   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwarg_to_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
4660   __Pyx_GOTREF(__pyx_t_2);
4661   __pyx_v__kwarg_to_flag = __pyx_t_2;
4662   __pyx_t_2 = 0;
4663 
4664   /* "pygame/_sdl2/video.pyx":266
4665  *
4666  *         _kwarg_to_flag = self._kwarg_to_flag
4667  *         for k, v in kwargs.items():             # <<<<<<<<<<<<<<
4668  *             try:
4669  *                 flag = _kwarg_to_flag[k]
4670  */
4671   __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
4672   __Pyx_GOTREF(__pyx_t_2);
4673   if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
4674     __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
4675     __pyx_t_8 = NULL;
4676   } else {
4677     __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
4678     __Pyx_GOTREF(__pyx_t_1);
4679     __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 266, __pyx_L1_error)
4680   }
4681   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4682   for (;;) {
4683     if (likely(!__pyx_t_8)) {
4684       if (likely(PyList_CheckExact(__pyx_t_1))) {
4685         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
4686         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4687         __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
4688         #else
4689         __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
4690         __Pyx_GOTREF(__pyx_t_2);
4691         #endif
4692       } else {
4693         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
4694         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4695         __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
4696         #else
4697         __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
4698         __Pyx_GOTREF(__pyx_t_2);
4699         #endif
4700       }
4701     } else {
4702       __pyx_t_2 = __pyx_t_8(__pyx_t_1);
4703       if (unlikely(!__pyx_t_2)) {
4704         PyObject* exc_type = PyErr_Occurred();
4705         if (exc_type) {
4706           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4707           else __PYX_ERR(0, 266, __pyx_L1_error)
4708         }
4709         break;
4710       }
4711       __Pyx_GOTREF(__pyx_t_2);
4712     }
4713     if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
4714       PyObject* sequence = __pyx_t_2;
4715       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4716       if (unlikely(size != 2)) {
4717         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4718         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4719         __PYX_ERR(0, 266, __pyx_L1_error)
4720       }
4721       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4722       if (likely(PyTuple_CheckExact(sequence))) {
4723         __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
4724         __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
4725       } else {
4726         __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
4727         __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
4728       }
4729       __Pyx_INCREF(__pyx_t_4);
4730       __Pyx_INCREF(__pyx_t_9);
4731       #else
4732       __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error)
4733       __Pyx_GOTREF(__pyx_t_4);
4734       __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 266, __pyx_L1_error)
4735       __Pyx_GOTREF(__pyx_t_9);
4736       #endif
4737       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4738     } else {
4739       Py_ssize_t index = -1;
4740       __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 266, __pyx_L1_error)
4741       __Pyx_GOTREF(__pyx_t_10);
4742       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4743       __pyx_t_5 = Py_TYPE(__pyx_t_10)->tp_iternext;
4744       index = 0; __pyx_t_4 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed;
4745       __Pyx_GOTREF(__pyx_t_4);
4746       index = 1; __pyx_t_9 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed;
4747       __Pyx_GOTREF(__pyx_t_9);
4748       if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 2) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
4749       __pyx_t_5 = NULL;
4750       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4751       goto __pyx_L13_unpacking_done;
4752       __pyx_L12_unpacking_failed:;
4753       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4754       __pyx_t_5 = NULL;
4755       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4756       __PYX_ERR(0, 266, __pyx_L1_error)
4757       __pyx_L13_unpacking_done:;
4758     }
4759     __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_4);
4760     __pyx_t_4 = 0;
4761     __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
4762     __pyx_t_9 = 0;
4763 
4764     /* "pygame/_sdl2/video.pyx":267
4765  *         _kwarg_to_flag = self._kwarg_to_flag
4766  *         for k, v in kwargs.items():
4767  *             try:             # <<<<<<<<<<<<<<
4768  *                 flag = _kwarg_to_flag[k]
4769  *                 if v:
4770  */
4771     {
4772       __Pyx_PyThreadState_declare
4773       __Pyx_PyThreadState_assign
4774       __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
4775       __Pyx_XGOTREF(__pyx_t_11);
4776       __Pyx_XGOTREF(__pyx_t_12);
4777       __Pyx_XGOTREF(__pyx_t_13);
4778       /*try:*/ {
4779 
4780         /* "pygame/_sdl2/video.pyx":268
4781  *         for k, v in kwargs.items():
4782  *             try:
4783  *                 flag = _kwarg_to_flag[k]             # <<<<<<<<<<<<<<
4784  *                 if v:
4785  *                     flags |= flag
4786  */
4787         __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v__kwarg_to_flag, __pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L14_error)
4788         __Pyx_GOTREF(__pyx_t_2);
4789         __Pyx_XDECREF_SET(__pyx_v_flag, __pyx_t_2);
4790         __pyx_t_2 = 0;
4791 
4792         /* "pygame/_sdl2/video.pyx":269
4793  *             try:
4794  *                 flag = _kwarg_to_flag[k]
4795  *                 if v:             # <<<<<<<<<<<<<<
4796  *                     flags |= flag
4797  *             except KeyError:
4798  */
4799         __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 269, __pyx_L14_error)
4800         if (__pyx_t_3) {
4801 
4802           /* "pygame/_sdl2/video.pyx":270
4803  *                 flag = _kwarg_to_flag[k]
4804  *                 if v:
4805  *                     flags |= flag             # <<<<<<<<<<<<<<
4806  *             except KeyError:
4807  *                 raise TypeError("unknown parameter: %s" % k)
4808  */
4809           __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_v_flag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L14_error)
4810           __Pyx_GOTREF(__pyx_t_2);
4811           __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_2);
4812           __pyx_t_2 = 0;
4813 
4814           /* "pygame/_sdl2/video.pyx":269
4815  *             try:
4816  *                 flag = _kwarg_to_flag[k]
4817  *                 if v:             # <<<<<<<<<<<<<<
4818  *                     flags |= flag
4819  *             except KeyError:
4820  */
4821         }
4822 
4823         /* "pygame/_sdl2/video.pyx":267
4824  *         _kwarg_to_flag = self._kwarg_to_flag
4825  *         for k, v in kwargs.items():
4826  *             try:             # <<<<<<<<<<<<<<
4827  *                 flag = _kwarg_to_flag[k]
4828  *                 if v:
4829  */
4830       }
4831       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
4832       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
4833       __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
4834       goto __pyx_L21_try_end;
4835       __pyx_L14_error:;
4836       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4837       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4838       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4839       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4840 
4841       /* "pygame/_sdl2/video.pyx":271
4842  *                 if v:
4843  *                     flags |= flag
4844  *             except KeyError:             # <<<<<<<<<<<<<<
4845  *                 raise TypeError("unknown parameter: %s" % k)
4846  *
4847  */
4848       __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
4849       if (__pyx_t_14) {
4850         __Pyx_AddTraceback("pygame._sdl2.video.Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4851         if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_4) < 0) __PYX_ERR(0, 271, __pyx_L16_except_error)
4852         __Pyx_GOTREF(__pyx_t_2);
4853         __Pyx_GOTREF(__pyx_t_9);
4854         __Pyx_GOTREF(__pyx_t_4);
4855 
4856         /* "pygame/_sdl2/video.pyx":272
4857  *                     flags |= flag
4858  *             except KeyError:
4859  *                 raise TypeError("unknown parameter: %s" % k)             # <<<<<<<<<<<<<<
4860  *
4861  *         self._win = SDL_CreateWindow(title.encode('utf8'), x, y,
4862  */
4863         __pyx_t_10 = __Pyx_PyString_FormatSafe(__pyx_kp_s_unknown_parameter_s, __pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 272, __pyx_L16_except_error)
4864         __Pyx_GOTREF(__pyx_t_10);
4865         __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_10); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 272, __pyx_L16_except_error)
4866         __Pyx_GOTREF(__pyx_t_15);
4867         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4868         __Pyx_Raise(__pyx_t_15, 0, 0, 0);
4869         __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
4870         __PYX_ERR(0, 272, __pyx_L16_except_error)
4871       }
4872       goto __pyx_L16_except_error;
4873       __pyx_L16_except_error:;
4874 
4875       /* "pygame/_sdl2/video.pyx":267
4876  *         _kwarg_to_flag = self._kwarg_to_flag
4877  *         for k, v in kwargs.items():
4878  *             try:             # <<<<<<<<<<<<<<
4879  *                 flag = _kwarg_to_flag[k]
4880  *                 if v:
4881  */
4882       __Pyx_XGIVEREF(__pyx_t_11);
4883       __Pyx_XGIVEREF(__pyx_t_12);
4884       __Pyx_XGIVEREF(__pyx_t_13);
4885       __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
4886       goto __pyx_L1_error;
4887       __pyx_L21_try_end:;
4888     }
4889 
4890     /* "pygame/_sdl2/video.pyx":266
4891  *
4892  *         _kwarg_to_flag = self._kwarg_to_flag
4893  *         for k, v in kwargs.items():             # <<<<<<<<<<<<<<
4894  *             try:
4895  *                 flag = _kwarg_to_flag[k]
4896  */
4897   }
4898   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4899 
4900   /* "pygame/_sdl2/video.pyx":274
4901  *                 raise TypeError("unknown parameter: %s" % k)
4902  *
4903  *         self._win = SDL_CreateWindow(title.encode('utf8'), x, y,             # <<<<<<<<<<<<<<
4904  *                                      size[0], size[1], flags)
4905  *         self._is_borrowed=0
4906  */
4907   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error)
4908   __Pyx_GOTREF(__pyx_t_4);
4909   __pyx_t_9 = NULL;
4910   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4911     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
4912     if (likely(__pyx_t_9)) {
4913       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4914       __Pyx_INCREF(__pyx_t_9);
4915       __Pyx_INCREF(function);
4916       __Pyx_DECREF_SET(__pyx_t_4, function);
4917     }
4918   }
4919   __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_utf8);
4920   __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4921   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error)
4922   __Pyx_GOTREF(__pyx_t_1);
4923   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4924   __pyx_t_16 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
4925   __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_x); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
4926   __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_y); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error)
4927 
4928   /* "pygame/_sdl2/video.pyx":275
4929  *
4930  *         self._win = SDL_CreateWindow(title.encode('utf8'), x, y,
4931  *                                      size[0], size[1], flags)             # <<<<<<<<<<<<<<
4932  *         self._is_borrowed=0
4933  *         if not self._win:
4934  */
4935   __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
4936   __Pyx_GOTREF(__pyx_t_4);
4937   __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error)
4938   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4939   __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
4940   __Pyx_GOTREF(__pyx_t_4);
4941   __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error)
4942   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4943   __pyx_t_20 = __Pyx_PyInt_As_Uint32(__pyx_v_flags); if (unlikely((__pyx_t_20 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error)
4944 
4945   /* "pygame/_sdl2/video.pyx":274
4946  *                 raise TypeError("unknown parameter: %s" % k)
4947  *
4948  *         self._win = SDL_CreateWindow(title.encode('utf8'), x, y,             # <<<<<<<<<<<<<<
4949  *                                      size[0], size[1], flags)
4950  *         self._is_borrowed=0
4951  */
4952   __pyx_v_self->_win = SDL_CreateWindow(__pyx_t_16, __pyx_t_14, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20);
4953   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4954 
4955   /* "pygame/_sdl2/video.pyx":276
4956  *         self._win = SDL_CreateWindow(title.encode('utf8'), x, y,
4957  *                                      size[0], size[1], flags)
4958  *         self._is_borrowed=0             # <<<<<<<<<<<<<<
4959  *         if not self._win:
4960  *             raise error()
4961  */
4962   __pyx_v_self->_is_borrowed = 0;
4963 
4964   /* "pygame/_sdl2/video.pyx":277
4965  *                                      size[0], size[1], flags)
4966  *         self._is_borrowed=0
4967  *         if not self._win:             # <<<<<<<<<<<<<<
4968  *             raise error()
4969  *         SDL_SetWindowData(self._win, "pg_window", <PyObject*>self)
4970  */
4971   __pyx_t_3 = ((!(__pyx_v_self->_win != 0)) != 0);
4972   if (unlikely(__pyx_t_3)) {
4973 
4974     /* "pygame/_sdl2/video.pyx":278
4975  *         self._is_borrowed=0
4976  *         if not self._win:
4977  *             raise error()             # <<<<<<<<<<<<<<
4978  *         SDL_SetWindowData(self._win, "pg_window", <PyObject*>self)
4979  *
4980  */
4981     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error)
4982     __Pyx_GOTREF(__pyx_t_4);
4983     __pyx_t_9 = NULL;
4984     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4985       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
4986       if (likely(__pyx_t_9)) {
4987         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4988         __Pyx_INCREF(__pyx_t_9);
4989         __Pyx_INCREF(function);
4990         __Pyx_DECREF_SET(__pyx_t_4, function);
4991       }
4992     }
4993     __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
4994     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
4995     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
4996     __Pyx_GOTREF(__pyx_t_1);
4997     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4998     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4999     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5000     __PYX_ERR(0, 278, __pyx_L1_error)
5001 
5002     /* "pygame/_sdl2/video.pyx":277
5003  *                                      size[0], size[1], flags)
5004  *         self._is_borrowed=0
5005  *         if not self._win:             # <<<<<<<<<<<<<<
5006  *             raise error()
5007  *         SDL_SetWindowData(self._win, "pg_window", <PyObject*>self)
5008  */
5009   }
5010 
5011   /* "pygame/_sdl2/video.pyx":279
5012  *         if not self._win:
5013  *             raise error()
5014  *         SDL_SetWindowData(self._win, "pg_window", <PyObject*>self)             # <<<<<<<<<<<<<<
5015  *
5016  *         import pygame.pkgdata
5017  */
5018   (void)(SDL_SetWindowData(__pyx_v_self->_win, ((char const *)"pg_window"), ((PyObject *)__pyx_v_self)));
5019 
5020   /* "pygame/_sdl2/video.pyx":281
5021  *         SDL_SetWindowData(self._win, "pg_window", <PyObject*>self)
5022  *
5023  *         import pygame.pkgdata             # <<<<<<<<<<<<<<
5024  *         surf = pygame.image.load(pygame.pkgdata.getResource(
5025  *                                  'pygame_icon.bmp'))
5026  */
5027   __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame_pkgdata, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
5028   __Pyx_GOTREF(__pyx_t_1);
5029   __pyx_v_pygame = __pyx_t_1;
5030   __pyx_t_1 = 0;
5031 
5032   /* "pygame/_sdl2/video.pyx":282
5033  *
5034  *         import pygame.pkgdata
5035  *         surf = pygame.image.load(pygame.pkgdata.getResource(             # <<<<<<<<<<<<<<
5036  *                                  'pygame_icon.bmp'))
5037  *         surf.set_colorkey(0)
5038  */
5039   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pygame, __pyx_n_s_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
5040   __Pyx_GOTREF(__pyx_t_4);
5041   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_load); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 282, __pyx_L1_error)
5042   __Pyx_GOTREF(__pyx_t_9);
5043   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5044   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pygame, __pyx_n_s_pkgdata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
5045   __Pyx_GOTREF(__pyx_t_2);
5046   __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getResource); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L1_error)
5047   __Pyx_GOTREF(__pyx_t_15);
5048   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5049   __pyx_t_2 = NULL;
5050   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
5051     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15);
5052     if (likely(__pyx_t_2)) {
5053       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
5054       __Pyx_INCREF(__pyx_t_2);
5055       __Pyx_INCREF(function);
5056       __Pyx_DECREF_SET(__pyx_t_15, function);
5057     }
5058   }
5059   __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_2, __pyx_kp_s_pygame_icon_bmp) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_kp_s_pygame_icon_bmp);
5060   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5061   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
5062   __Pyx_GOTREF(__pyx_t_4);
5063   __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5064   __pyx_t_15 = NULL;
5065   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
5066     __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_9);
5067     if (likely(__pyx_t_15)) {
5068       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
5069       __Pyx_INCREF(__pyx_t_15);
5070       __Pyx_INCREF(function);
5071       __Pyx_DECREF_SET(__pyx_t_9, function);
5072     }
5073   }
5074   __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_15, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4);
5075   __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
5076   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5077   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
5078   __Pyx_GOTREF(__pyx_t_1);
5079   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5080   __pyx_v_surf = __pyx_t_1;
5081   __pyx_t_1 = 0;
5082 
5083   /* "pygame/_sdl2/video.pyx":284
5084  *         surf = pygame.image.load(pygame.pkgdata.getResource(
5085  *                                  'pygame_icon.bmp'))
5086  *         surf.set_colorkey(0)             # <<<<<<<<<<<<<<
5087  *         self.set_icon(surf)
5088  *
5089  */
5090   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_set_colorkey); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 284, __pyx_L1_error)
5091   __Pyx_GOTREF(__pyx_t_9);
5092   __pyx_t_4 = NULL;
5093   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
5094     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
5095     if (likely(__pyx_t_4)) {
5096       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
5097       __Pyx_INCREF(__pyx_t_4);
5098       __Pyx_INCREF(function);
5099       __Pyx_DECREF_SET(__pyx_t_9, function);
5100     }
5101   }
5102   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_int_0);
5103   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5104   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
5105   __Pyx_GOTREF(__pyx_t_1);
5106   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5107   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5108 
5109   /* "pygame/_sdl2/video.pyx":285
5110  *                                  'pygame_icon.bmp'))
5111  *         surf.set_colorkey(0)
5112  *         self.set_icon(surf)             # <<<<<<<<<<<<<<
5113  *
5114  *     @property
5115  */
5116   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_icon); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 285, __pyx_L1_error)
5117   __Pyx_GOTREF(__pyx_t_9);
5118   __pyx_t_4 = NULL;
5119   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
5120     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
5121     if (likely(__pyx_t_4)) {
5122       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
5123       __Pyx_INCREF(__pyx_t_4);
5124       __Pyx_INCREF(function);
5125       __Pyx_DECREF_SET(__pyx_t_9, function);
5126     }
5127   }
5128   __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_4, __pyx_v_surf) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_surf);
5129   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5130   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
5131   __Pyx_GOTREF(__pyx_t_1);
5132   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5133   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5134 
5135   /* "pygame/_sdl2/video.pyx":217
5136  *         return self
5137  *
5138  *     def __init__(self, title='pygame',             # <<<<<<<<<<<<<<
5139  *                  size=DEFAULT_SIZE,
5140  *                  position=WINDOWPOS_UNDEFINED,
5141  */
5142 
5143   /* function exit code */
5144   __pyx_r = 0;
5145   goto __pyx_L0;
5146   __pyx_L1_error:;
5147   __Pyx_XDECREF(__pyx_t_1);
5148   __Pyx_XDECREF(__pyx_t_2);
5149   __Pyx_XDECREF(__pyx_t_4);
5150   __Pyx_XDECREF(__pyx_t_9);
5151   __Pyx_XDECREF(__pyx_t_10);
5152   __Pyx_XDECREF(__pyx_t_15);
5153   __Pyx_AddTraceback("pygame._sdl2.video.Window.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5154   __pyx_r = -1;
5155   __pyx_L0:;
5156   __Pyx_XDECREF(__pyx_v_x);
5157   __Pyx_XDECREF(__pyx_v_y);
5158   __Pyx_XDECREF(__pyx_v_flags);
5159   __Pyx_XDECREF(__pyx_v__kwarg_to_flag);
5160   __Pyx_XDECREF(__pyx_v_k);
5161   __Pyx_XDECREF(__pyx_v_v);
5162   __Pyx_XDECREF(__pyx_v_flag);
5163   __Pyx_XDECREF(__pyx_v_pygame);
5164   __Pyx_XDECREF(__pyx_v_surf);
5165   __Pyx_RefNannyFinishContext();
5166   return __pyx_r;
5167 }
5168 
5169 /* "pygame/_sdl2/video.pyx":288
5170  *
5171  *     @property
5172  *     def grab(self):             # <<<<<<<<<<<<<<
5173  *         """ Window's input grab state (``True`` or ``False``).
5174  *
5175  */
5176 
5177 /* Python wrapper */
5178 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(PyObject * __pyx_v_self)5179 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(PyObject *__pyx_v_self) {
5180   PyObject *__pyx_r = 0;
5181   __Pyx_RefNannyDeclarations
5182   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5183   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
5184 
5185   /* function exit code */
5186   __Pyx_RefNannyFinishContext();
5187   return __pyx_r;
5188 }
5189 
__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)5190 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
5191   PyObject *__pyx_r = NULL;
5192   __Pyx_RefNannyDeclarations
5193   PyObject *__pyx_t_1 = NULL;
5194   int __pyx_lineno = 0;
5195   const char *__pyx_filename = NULL;
5196   int __pyx_clineno = 0;
5197   __Pyx_RefNannySetupContext("__get__", 0);
5198 
5199   /* "pygame/_sdl2/video.pyx":299
5200  *         :rtype: bool
5201  *         """
5202  *         return SDL_GetWindowGrab(self._win) != 0             # <<<<<<<<<<<<<<
5203  *
5204  *     @grab.setter
5205  */
5206   __Pyx_XDECREF(__pyx_r);
5207   __pyx_t_1 = __Pyx_PyBool_FromLong((SDL_GetWindowGrab(__pyx_v_self->_win) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
5208   __Pyx_GOTREF(__pyx_t_1);
5209   __pyx_r = __pyx_t_1;
5210   __pyx_t_1 = 0;
5211   goto __pyx_L0;
5212 
5213   /* "pygame/_sdl2/video.pyx":288
5214  *
5215  *     @property
5216  *     def grab(self):             # <<<<<<<<<<<<<<
5217  *         """ Window's input grab state (``True`` or ``False``).
5218  *
5219  */
5220 
5221   /* function exit code */
5222   __pyx_L1_error:;
5223   __Pyx_XDECREF(__pyx_t_1);
5224   __Pyx_AddTraceback("pygame._sdl2.video.Window.grab.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5225   __pyx_r = NULL;
5226   __pyx_L0:;
5227   __Pyx_XGIVEREF(__pyx_r);
5228   __Pyx_RefNannyFinishContext();
5229   return __pyx_r;
5230 }
5231 
5232 /* "pygame/_sdl2/video.pyx":302
5233  *
5234  *     @grab.setter
5235  *     def grab(self, bint grabbed):             # <<<<<<<<<<<<<<
5236  *         # https://wiki.libsdl.org/SDL_SetWindowGrab
5237  *         SDL_SetWindowGrab(self._win, 1 if grabbed else 0)
5238  */
5239 
5240 /* Python wrapper */
5241 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_grabbed); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_arg_grabbed)5242 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_grabbed) {
5243   int __pyx_v_grabbed;
5244   int __pyx_lineno = 0;
5245   const char *__pyx_filename = NULL;
5246   int __pyx_clineno = 0;
5247   int __pyx_r;
5248   __Pyx_RefNannyDeclarations
5249   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
5250   assert(__pyx_arg_grabbed); {
5251     __pyx_v_grabbed = __Pyx_PyObject_IsTrue(__pyx_arg_grabbed); if (unlikely((__pyx_v_grabbed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L3_error)
5252   }
5253   goto __pyx_L4_argument_unpacking_done;
5254   __pyx_L3_error:;
5255   __Pyx_AddTraceback("pygame._sdl2.video.Window.grab.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5256   __Pyx_RefNannyFinishContext();
5257   return -1;
5258   __pyx_L4_argument_unpacking_done:;
5259   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((int)__pyx_v_grabbed));
5260 
5261   /* function exit code */
5262   __Pyx_RefNannyFinishContext();
5263   return __pyx_r;
5264 }
5265 
__pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,int __pyx_v_grabbed)5266 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4grab_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_grabbed) {
5267   int __pyx_r;
5268   __Pyx_RefNannyDeclarations
5269   SDL_bool __pyx_t_1;
5270   __Pyx_RefNannySetupContext("__set__", 0);
5271 
5272   /* "pygame/_sdl2/video.pyx":304
5273  *     def grab(self, bint grabbed):
5274  *         # https://wiki.libsdl.org/SDL_SetWindowGrab
5275  *         SDL_SetWindowGrab(self._win, 1 if grabbed else 0)             # <<<<<<<<<<<<<<
5276  *
5277  *     @property
5278  */
5279   if ((__pyx_v_grabbed != 0)) {
5280     __pyx_t_1 = 1;
5281   } else {
5282     __pyx_t_1 = 0;
5283   }
5284   SDL_SetWindowGrab(__pyx_v_self->_win, __pyx_t_1);
5285 
5286   /* "pygame/_sdl2/video.pyx":302
5287  *
5288  *     @grab.setter
5289  *     def grab(self, bint grabbed):             # <<<<<<<<<<<<<<
5290  *         # https://wiki.libsdl.org/SDL_SetWindowGrab
5291  *         SDL_SetWindowGrab(self._win, 1 if grabbed else 0)
5292  */
5293 
5294   /* function exit code */
5295   __pyx_r = 0;
5296   __Pyx_RefNannyFinishContext();
5297   return __pyx_r;
5298 }
5299 
5300 /* "pygame/_sdl2/video.pyx":307
5301  *
5302  *     @property
5303  *     def relative_mouse(self):             # <<<<<<<<<<<<<<
5304  *         """ Window's relative mouse motion state (``True`` or ``False``).
5305  *
5306  */
5307 
5308 /* Python wrapper */
5309 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(PyObject * __pyx_v_self)5310 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(PyObject *__pyx_v_self) {
5311   PyObject *__pyx_r = 0;
5312   __Pyx_RefNannyDeclarations
5313   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5314   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
5315 
5316   /* function exit code */
5317   __Pyx_RefNannyFinishContext();
5318   return __pyx_r;
5319 }
5320 
__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)5321 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse___get__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
5322   PyObject *__pyx_r = NULL;
5323   __Pyx_RefNannyDeclarations
5324   PyObject *__pyx_t_1 = NULL;
5325   int __pyx_lineno = 0;
5326   const char *__pyx_filename = NULL;
5327   int __pyx_clineno = 0;
5328   __Pyx_RefNannySetupContext("__get__", 0);
5329 
5330   /* "pygame/_sdl2/video.pyx":316
5331  *         :rtype: bool
5332  *         """
5333  *         return SDL_GetRelativeMouseMode()             # <<<<<<<<<<<<<<
5334  *
5335  *
5336  */
5337   __Pyx_XDECREF(__pyx_r);
5338   __pyx_t_1 = __Pyx_PyInt_From_SDL_bool(SDL_GetRelativeMouseMode()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
5339   __Pyx_GOTREF(__pyx_t_1);
5340   __pyx_r = __pyx_t_1;
5341   __pyx_t_1 = 0;
5342   goto __pyx_L0;
5343 
5344   /* "pygame/_sdl2/video.pyx":307
5345  *
5346  *     @property
5347  *     def relative_mouse(self):             # <<<<<<<<<<<<<<
5348  *         """ Window's relative mouse motion state (``True`` or ``False``).
5349  *
5350  */
5351 
5352   /* function exit code */
5353   __pyx_L1_error:;
5354   __Pyx_XDECREF(__pyx_t_1);
5355   __Pyx_AddTraceback("pygame._sdl2.video.Window.relative_mouse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5356   __pyx_r = NULL;
5357   __pyx_L0:;
5358   __Pyx_XGIVEREF(__pyx_r);
5359   __Pyx_RefNannyFinishContext();
5360   return __pyx_r;
5361 }
5362 
5363 /* "pygame/_sdl2/video.pyx":320
5364  *
5365  *     @relative_mouse.setter
5366  *     def relative_mouse(self, bint enable):             # <<<<<<<<<<<<<<
5367  *         # https://wiki.libsdl.org/SDL_SetRelativeMouseMode
5368  *         #SDL_SetWindowGrab(self._win, 1 if enable else 0)
5369  */
5370 
5371 /* Python wrapper */
5372 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_enable); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_arg_enable)5373 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_enable) {
5374   int __pyx_v_enable;
5375   int __pyx_lineno = 0;
5376   const char *__pyx_filename = NULL;
5377   int __pyx_clineno = 0;
5378   int __pyx_r;
5379   __Pyx_RefNannyDeclarations
5380   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
5381   assert(__pyx_arg_enable); {
5382     __pyx_v_enable = __Pyx_PyObject_IsTrue(__pyx_arg_enable); if (unlikely((__pyx_v_enable == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error)
5383   }
5384   goto __pyx_L4_argument_unpacking_done;
5385   __pyx_L3_error:;
5386   __Pyx_AddTraceback("pygame._sdl2.video.Window.relative_mouse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5387   __Pyx_RefNannyFinishContext();
5388   return -1;
5389   __pyx_L4_argument_unpacking_done:;
5390   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((int)__pyx_v_enable));
5391 
5392   /* function exit code */
5393   __Pyx_RefNannyFinishContext();
5394   return __pyx_r;
5395 }
5396 
__pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,int __pyx_v_enable)5397 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_14relative_mouse_2__set__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_enable) {
5398   int __pyx_r;
5399   __Pyx_RefNannyDeclarations
5400   SDL_bool __pyx_t_1;
5401   __Pyx_RefNannySetupContext("__set__", 0);
5402 
5403   /* "pygame/_sdl2/video.pyx":323
5404  *         # https://wiki.libsdl.org/SDL_SetRelativeMouseMode
5405  *         #SDL_SetWindowGrab(self._win, 1 if enable else 0)
5406  *         SDL_SetRelativeMouseMode(1 if enable else 0)             # <<<<<<<<<<<<<<
5407  *
5408  *     def set_windowed(self):
5409  */
5410   if ((__pyx_v_enable != 0)) {
5411     __pyx_t_1 = 1;
5412   } else {
5413     __pyx_t_1 = 0;
5414   }
5415   (void)(SDL_SetRelativeMouseMode(__pyx_t_1));
5416 
5417   /* "pygame/_sdl2/video.pyx":320
5418  *
5419  *     @relative_mouse.setter
5420  *     def relative_mouse(self, bint enable):             # <<<<<<<<<<<<<<
5421  *         # https://wiki.libsdl.org/SDL_SetRelativeMouseMode
5422  *         #SDL_SetWindowGrab(self._win, 1 if enable else 0)
5423  */
5424 
5425   /* function exit code */
5426   __pyx_r = 0;
5427   __Pyx_RefNannyFinishContext();
5428   return __pyx_r;
5429 }
5430 
5431 /* "pygame/_sdl2/video.pyx":325
5432  *         SDL_SetRelativeMouseMode(1 if enable else 0)
5433  *
5434  *     def set_windowed(self):             # <<<<<<<<<<<<<<
5435  *         """ Enable windowed mode
5436  *
5437  */
5438 
5439 /* Python wrapper */
5440 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5441 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_4set_windowed[] = " Enable windowed mode\n\n        .. seealso:: :func:`set_fullscreen`\n\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5442 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5443   PyObject *__pyx_r = 0;
5444   __Pyx_RefNannyDeclarations
5445   __Pyx_RefNannySetupContext("set_windowed (wrapper)", 0);
5446   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
5447 
5448   /* function exit code */
5449   __Pyx_RefNannyFinishContext();
5450   return __pyx_r;
5451 }
5452 
__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)5453 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4set_windowed(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
5454   PyObject *__pyx_r = NULL;
5455   __Pyx_RefNannyDeclarations
5456   int __pyx_t_1;
5457   PyObject *__pyx_t_2 = NULL;
5458   PyObject *__pyx_t_3 = NULL;
5459   PyObject *__pyx_t_4 = NULL;
5460   int __pyx_lineno = 0;
5461   const char *__pyx_filename = NULL;
5462   int __pyx_clineno = 0;
5463   __Pyx_RefNannySetupContext("set_windowed", 0);
5464 
5465   /* "pygame/_sdl2/video.pyx":332
5466  *         """
5467  *         # https://wiki.libsdl.org/SDL_SetWindowFullscreen
5468  *         if SDL_SetWindowFullscreen(self._win, 0):             # <<<<<<<<<<<<<<
5469  *             raise error()
5470  *
5471  */
5472   __pyx_t_1 = (SDL_SetWindowFullscreen(__pyx_v_self->_win, 0) != 0);
5473   if (unlikely(__pyx_t_1)) {
5474 
5475     /* "pygame/_sdl2/video.pyx":333
5476  *         # https://wiki.libsdl.org/SDL_SetWindowFullscreen
5477  *         if SDL_SetWindowFullscreen(self._win, 0):
5478  *             raise error()             # <<<<<<<<<<<<<<
5479  *
5480  *     #TODO: not sure about this...
5481  */
5482     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
5483     __Pyx_GOTREF(__pyx_t_3);
5484     __pyx_t_4 = NULL;
5485     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5486       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5487       if (likely(__pyx_t_4)) {
5488         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5489         __Pyx_INCREF(__pyx_t_4);
5490         __Pyx_INCREF(function);
5491         __Pyx_DECREF_SET(__pyx_t_3, function);
5492       }
5493     }
5494     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5495     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5496     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
5497     __Pyx_GOTREF(__pyx_t_2);
5498     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5499     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5500     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5501     __PYX_ERR(0, 333, __pyx_L1_error)
5502 
5503     /* "pygame/_sdl2/video.pyx":332
5504  *         """
5505  *         # https://wiki.libsdl.org/SDL_SetWindowFullscreen
5506  *         if SDL_SetWindowFullscreen(self._win, 0):             # <<<<<<<<<<<<<<
5507  *             raise error()
5508  *
5509  */
5510   }
5511 
5512   /* "pygame/_sdl2/video.pyx":325
5513  *         SDL_SetRelativeMouseMode(1 if enable else 0)
5514  *
5515  *     def set_windowed(self):             # <<<<<<<<<<<<<<
5516  *         """ Enable windowed mode
5517  *
5518  */
5519 
5520   /* function exit code */
5521   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5522   goto __pyx_L0;
5523   __pyx_L1_error:;
5524   __Pyx_XDECREF(__pyx_t_2);
5525   __Pyx_XDECREF(__pyx_t_3);
5526   __Pyx_XDECREF(__pyx_t_4);
5527   __Pyx_AddTraceback("pygame._sdl2.video.Window.set_windowed", __pyx_clineno, __pyx_lineno, __pyx_filename);
5528   __pyx_r = NULL;
5529   __pyx_L0:;
5530   __Pyx_XGIVEREF(__pyx_r);
5531   __Pyx_RefNannyFinishContext();
5532   return __pyx_r;
5533 }
5534 
5535 /* "pygame/_sdl2/video.pyx":340
5536  *     #     window.fullscreen_desktop = True
5537  *     #     window.windowed = True
5538  *     def set_fullscreen(self, bint desktop=False):             # <<<<<<<<<<<<<<
5539  *         """ Enable fullscreen for the window
5540  *
5541  */
5542 
5543 /* Python wrapper */
5544 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5545 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_6set_fullscreen[] = " Enable fullscreen for the window\n\n        :param bool desktop: If ``True``: use the current desktop resolution.\n                             If ``False``: change the fullscreen resolution to the window size.\n\n        .. seealso:: :func:`set_windowed`\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5546 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5547   int __pyx_v_desktop;
5548   int __pyx_lineno = 0;
5549   const char *__pyx_filename = NULL;
5550   int __pyx_clineno = 0;
5551   PyObject *__pyx_r = 0;
5552   __Pyx_RefNannyDeclarations
5553   __Pyx_RefNannySetupContext("set_fullscreen (wrapper)", 0);
5554   {
5555     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_desktop,0};
5556     PyObject* values[1] = {0};
5557     if (unlikely(__pyx_kwds)) {
5558       Py_ssize_t kw_args;
5559       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5560       switch (pos_args) {
5561         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5562         CYTHON_FALLTHROUGH;
5563         case  0: break;
5564         default: goto __pyx_L5_argtuple_error;
5565       }
5566       kw_args = PyDict_Size(__pyx_kwds);
5567       switch (pos_args) {
5568         case  0:
5569         if (kw_args > 0) {
5570           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_desktop);
5571           if (value) { values[0] = value; kw_args--; }
5572         }
5573       }
5574       if (unlikely(kw_args > 0)) {
5575         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_fullscreen") < 0)) __PYX_ERR(0, 340, __pyx_L3_error)
5576       }
5577     } else {
5578       switch (PyTuple_GET_SIZE(__pyx_args)) {
5579         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5580         CYTHON_FALLTHROUGH;
5581         case  0: break;
5582         default: goto __pyx_L5_argtuple_error;
5583       }
5584     }
5585     if (values[0]) {
5586       __pyx_v_desktop = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_desktop == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L3_error)
5587     } else {
5588       __pyx_v_desktop = ((int)0);
5589     }
5590   }
5591   goto __pyx_L4_argument_unpacking_done;
5592   __pyx_L5_argtuple_error:;
5593   __Pyx_RaiseArgtupleInvalid("set_fullscreen", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 340, __pyx_L3_error)
5594   __pyx_L3_error:;
5595   __Pyx_AddTraceback("pygame._sdl2.video.Window.set_fullscreen", __pyx_clineno, __pyx_lineno, __pyx_filename);
5596   __Pyx_RefNannyFinishContext();
5597   return NULL;
5598   __pyx_L4_argument_unpacking_done:;
5599   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), __pyx_v_desktop);
5600 
5601   /* function exit code */
5602   __Pyx_RefNannyFinishContext();
5603   return __pyx_r;
5604 }
5605 
__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,int __pyx_v_desktop)5606 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_6set_fullscreen(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, int __pyx_v_desktop) {
5607   int __pyx_v_flags;
5608   PyObject *__pyx_r = NULL;
5609   __Pyx_RefNannyDeclarations
5610   int __pyx_t_1;
5611   PyObject *__pyx_t_2 = NULL;
5612   PyObject *__pyx_t_3 = NULL;
5613   PyObject *__pyx_t_4 = NULL;
5614   int __pyx_lineno = 0;
5615   const char *__pyx_filename = NULL;
5616   int __pyx_clineno = 0;
5617   __Pyx_RefNannySetupContext("set_fullscreen", 0);
5618 
5619   /* "pygame/_sdl2/video.pyx":348
5620  *         .. seealso:: :func:`set_windowed`
5621  *         """
5622  *         cdef int flags = 0             # <<<<<<<<<<<<<<
5623  *         if desktop:
5624  *             flags = _SDL_WINDOW_FULLSCREEN_DESKTOP
5625  */
5626   __pyx_v_flags = 0;
5627 
5628   /* "pygame/_sdl2/video.pyx":349
5629  *         """
5630  *         cdef int flags = 0
5631  *         if desktop:             # <<<<<<<<<<<<<<
5632  *             flags = _SDL_WINDOW_FULLSCREEN_DESKTOP
5633  *         else:
5634  */
5635   __pyx_t_1 = (__pyx_v_desktop != 0);
5636   if (__pyx_t_1) {
5637 
5638     /* "pygame/_sdl2/video.pyx":350
5639  *         cdef int flags = 0
5640  *         if desktop:
5641  *             flags = _SDL_WINDOW_FULLSCREEN_DESKTOP             # <<<<<<<<<<<<<<
5642  *         else:
5643  *             flags = _SDL_WINDOW_FULLSCREEN
5644  */
5645     __pyx_v_flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
5646 
5647     /* "pygame/_sdl2/video.pyx":349
5648  *         """
5649  *         cdef int flags = 0
5650  *         if desktop:             # <<<<<<<<<<<<<<
5651  *             flags = _SDL_WINDOW_FULLSCREEN_DESKTOP
5652  *         else:
5653  */
5654     goto __pyx_L3;
5655   }
5656 
5657   /* "pygame/_sdl2/video.pyx":352
5658  *             flags = _SDL_WINDOW_FULLSCREEN_DESKTOP
5659  *         else:
5660  *             flags = _SDL_WINDOW_FULLSCREEN             # <<<<<<<<<<<<<<
5661  *         if SDL_SetWindowFullscreen(self._win, flags):
5662  *             raise error()
5663  */
5664   /*else*/ {
5665     __pyx_v_flags = SDL_WINDOW_FULLSCREEN;
5666   }
5667   __pyx_L3:;
5668 
5669   /* "pygame/_sdl2/video.pyx":353
5670  *         else:
5671  *             flags = _SDL_WINDOW_FULLSCREEN
5672  *         if SDL_SetWindowFullscreen(self._win, flags):             # <<<<<<<<<<<<<<
5673  *             raise error()
5674  *
5675  */
5676   __pyx_t_1 = (SDL_SetWindowFullscreen(__pyx_v_self->_win, __pyx_v_flags) != 0);
5677   if (unlikely(__pyx_t_1)) {
5678 
5679     /* "pygame/_sdl2/video.pyx":354
5680  *             flags = _SDL_WINDOW_FULLSCREEN
5681  *         if SDL_SetWindowFullscreen(self._win, flags):
5682  *             raise error()             # <<<<<<<<<<<<<<
5683  *
5684  *     @property
5685  */
5686     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error)
5687     __Pyx_GOTREF(__pyx_t_3);
5688     __pyx_t_4 = NULL;
5689     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5690       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5691       if (likely(__pyx_t_4)) {
5692         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5693         __Pyx_INCREF(__pyx_t_4);
5694         __Pyx_INCREF(function);
5695         __Pyx_DECREF_SET(__pyx_t_3, function);
5696       }
5697     }
5698     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5699     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5700     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
5701     __Pyx_GOTREF(__pyx_t_2);
5702     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5703     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5704     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5705     __PYX_ERR(0, 354, __pyx_L1_error)
5706 
5707     /* "pygame/_sdl2/video.pyx":353
5708  *         else:
5709  *             flags = _SDL_WINDOW_FULLSCREEN
5710  *         if SDL_SetWindowFullscreen(self._win, flags):             # <<<<<<<<<<<<<<
5711  *             raise error()
5712  *
5713  */
5714   }
5715 
5716   /* "pygame/_sdl2/video.pyx":340
5717  *     #     window.fullscreen_desktop = True
5718  *     #     window.windowed = True
5719  *     def set_fullscreen(self, bint desktop=False):             # <<<<<<<<<<<<<<
5720  *         """ Enable fullscreen for the window
5721  *
5722  */
5723 
5724   /* function exit code */
5725   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5726   goto __pyx_L0;
5727   __pyx_L1_error:;
5728   __Pyx_XDECREF(__pyx_t_2);
5729   __Pyx_XDECREF(__pyx_t_3);
5730   __Pyx_XDECREF(__pyx_t_4);
5731   __Pyx_AddTraceback("pygame._sdl2.video.Window.set_fullscreen", __pyx_clineno, __pyx_lineno, __pyx_filename);
5732   __pyx_r = NULL;
5733   __pyx_L0:;
5734   __Pyx_XGIVEREF(__pyx_r);
5735   __Pyx_RefNannyFinishContext();
5736   return __pyx_r;
5737 }
5738 
5739 /* "pygame/_sdl2/video.pyx":357
5740  *
5741  *     @property
5742  *     def title(self):             # <<<<<<<<<<<<<<
5743  *         """ The title of the window or u"" if there is none.
5744  *         """
5745  */
5746 
5747 /* Python wrapper */
5748 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(PyObject * __pyx_v_self)5749 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(PyObject *__pyx_v_self) {
5750   PyObject *__pyx_r = 0;
5751   __Pyx_RefNannyDeclarations
5752   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5753   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
5754 
5755   /* function exit code */
5756   __Pyx_RefNannyFinishContext();
5757   return __pyx_r;
5758 }
5759 
__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)5760 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_5title___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
5761   PyObject *__pyx_r = NULL;
5762   __Pyx_RefNannyDeclarations
5763   char const *__pyx_t_1;
5764   PyObject *__pyx_t_2 = NULL;
5765   int __pyx_lineno = 0;
5766   const char *__pyx_filename = NULL;
5767   int __pyx_clineno = 0;
5768   __Pyx_RefNannySetupContext("__get__", 0);
5769 
5770   /* "pygame/_sdl2/video.pyx":361
5771  *         """
5772  *         # https://wiki.libsdl.org/SDL_GetWindowTitle
5773  *         return SDL_GetWindowTitle(self._win).decode('utf8')             # <<<<<<<<<<<<<<
5774  *
5775  *     @title.setter
5776  */
5777   __Pyx_XDECREF(__pyx_r);
5778   __pyx_t_1 = SDL_GetWindowTitle(__pyx_v_self->_win);
5779   __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
5780   __Pyx_GOTREF(__pyx_t_2);
5781   __Pyx_INCREF(__pyx_t_2);
5782   __pyx_r = __pyx_t_2;
5783   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5784   goto __pyx_L0;
5785 
5786   /* "pygame/_sdl2/video.pyx":357
5787  *
5788  *     @property
5789  *     def title(self):             # <<<<<<<<<<<<<<
5790  *         """ The title of the window or u"" if there is none.
5791  *         """
5792  */
5793 
5794   /* function exit code */
5795   __pyx_L1_error:;
5796   __Pyx_XDECREF(__pyx_t_2);
5797   __Pyx_AddTraceback("pygame._sdl2.video.Window.title.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5798   __pyx_r = NULL;
5799   __pyx_L0:;
5800   __Pyx_XGIVEREF(__pyx_r);
5801   __Pyx_RefNannyFinishContext();
5802   return __pyx_r;
5803 }
5804 
5805 /* "pygame/_sdl2/video.pyx":364
5806  *
5807  *     @title.setter
5808  *     def title(self, title):             # <<<<<<<<<<<<<<
5809  *         """ Set the window title.
5810  *
5811  */
5812 
5813 /* Python wrapper */
5814 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_title); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_title)5815 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_title) {
5816   int __pyx_r;
5817   __Pyx_RefNannyDeclarations
5818   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
5819   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_title));
5820 
5821   /* function exit code */
5822   __Pyx_RefNannyFinishContext();
5823   return __pyx_r;
5824 }
5825 
__pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_title)5826 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_5title_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_title) {
5827   int __pyx_r;
5828   __Pyx_RefNannyDeclarations
5829   PyObject *__pyx_t_1 = NULL;
5830   PyObject *__pyx_t_2 = NULL;
5831   PyObject *__pyx_t_3 = NULL;
5832   char const *__pyx_t_4;
5833   int __pyx_lineno = 0;
5834   const char *__pyx_filename = NULL;
5835   int __pyx_clineno = 0;
5836   __Pyx_RefNannySetupContext("__set__", 0);
5837 
5838   /* "pygame/_sdl2/video.pyx":370
5839  *         """
5840  *         # https://wiki.libsdl.org/SDL_SetWindowTitle
5841  *         SDL_SetWindowTitle(self._win, title.encode('utf8'))             # <<<<<<<<<<<<<<
5842  *
5843  *     def destroy(self):
5844  */
5845   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_title, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error)
5846   __Pyx_GOTREF(__pyx_t_2);
5847   __pyx_t_3 = NULL;
5848   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5849     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5850     if (likely(__pyx_t_3)) {
5851       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5852       __Pyx_INCREF(__pyx_t_3);
5853       __Pyx_INCREF(function);
5854       __Pyx_DECREF_SET(__pyx_t_2, function);
5855     }
5856   }
5857   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_utf8);
5858   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5859   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
5860   __Pyx_GOTREF(__pyx_t_1);
5861   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5862   __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error)
5863   SDL_SetWindowTitle(__pyx_v_self->_win, __pyx_t_4);
5864   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5865 
5866   /* "pygame/_sdl2/video.pyx":364
5867  *
5868  *     @title.setter
5869  *     def title(self, title):             # <<<<<<<<<<<<<<
5870  *         """ Set the window title.
5871  *
5872  */
5873 
5874   /* function exit code */
5875   __pyx_r = 0;
5876   goto __pyx_L0;
5877   __pyx_L1_error:;
5878   __Pyx_XDECREF(__pyx_t_1);
5879   __Pyx_XDECREF(__pyx_t_2);
5880   __Pyx_XDECREF(__pyx_t_3);
5881   __Pyx_AddTraceback("pygame._sdl2.video.Window.title.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5882   __pyx_r = -1;
5883   __pyx_L0:;
5884   __Pyx_RefNannyFinishContext();
5885   return __pyx_r;
5886 }
5887 
5888 /* "pygame/_sdl2/video.pyx":372
5889  *         SDL_SetWindowTitle(self._win, title.encode('utf8'))
5890  *
5891  *     def destroy(self):             # <<<<<<<<<<<<<<
5892  *         """ Destroys the window.
5893  *         """
5894  */
5895 
5896 /* Python wrapper */
5897 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5898 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_8destroy[] = " Destroys the window.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5899 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5900   PyObject *__pyx_r = 0;
5901   __Pyx_RefNannyDeclarations
5902   __Pyx_RefNannySetupContext("destroy (wrapper)", 0);
5903   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
5904 
5905   /* function exit code */
5906   __Pyx_RefNannyFinishContext();
5907   return __pyx_r;
5908 }
5909 
__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)5910 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8destroy(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
5911   PyObject *__pyx_r = NULL;
5912   __Pyx_RefNannyDeclarations
5913   int __pyx_t_1;
5914   __Pyx_RefNannySetupContext("destroy", 0);
5915 
5916   /* "pygame/_sdl2/video.pyx":376
5917  *         """
5918  *         # https://wiki.libsdl.org/SDL_DestroyWindow
5919  *         if self._win:             # <<<<<<<<<<<<<<
5920  *             SDL_DestroyWindow(self._win)
5921  *             self._win = NULL
5922  */
5923   __pyx_t_1 = (__pyx_v_self->_win != 0);
5924   if (__pyx_t_1) {
5925 
5926     /* "pygame/_sdl2/video.pyx":377
5927  *         # https://wiki.libsdl.org/SDL_DestroyWindow
5928  *         if self._win:
5929  *             SDL_DestroyWindow(self._win)             # <<<<<<<<<<<<<<
5930  *             self._win = NULL
5931  *
5932  */
5933     SDL_DestroyWindow(__pyx_v_self->_win);
5934 
5935     /* "pygame/_sdl2/video.pyx":378
5936  *         if self._win:
5937  *             SDL_DestroyWindow(self._win)
5938  *             self._win = NULL             # <<<<<<<<<<<<<<
5939  *
5940  *     def hide(self):
5941  */
5942     __pyx_v_self->_win = NULL;
5943 
5944     /* "pygame/_sdl2/video.pyx":376
5945  *         """
5946  *         # https://wiki.libsdl.org/SDL_DestroyWindow
5947  *         if self._win:             # <<<<<<<<<<<<<<
5948  *             SDL_DestroyWindow(self._win)
5949  *             self._win = NULL
5950  */
5951   }
5952 
5953   /* "pygame/_sdl2/video.pyx":372
5954  *         SDL_SetWindowTitle(self._win, title.encode('utf8'))
5955  *
5956  *     def destroy(self):             # <<<<<<<<<<<<<<
5957  *         """ Destroys the window.
5958  *         """
5959  */
5960 
5961   /* function exit code */
5962   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5963   __Pyx_XGIVEREF(__pyx_r);
5964   __Pyx_RefNannyFinishContext();
5965   return __pyx_r;
5966 }
5967 
5968 /* "pygame/_sdl2/video.pyx":380
5969  *             self._win = NULL
5970  *
5971  *     def hide(self):             # <<<<<<<<<<<<<<
5972  *         """ Hide the window.
5973  *         """
5974  */
5975 
5976 /* Python wrapper */
5977 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5978 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_10hide[] = " Hide the window.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5979 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5980   PyObject *__pyx_r = 0;
5981   __Pyx_RefNannyDeclarations
5982   __Pyx_RefNannySetupContext("hide (wrapper)", 0);
5983   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
5984 
5985   /* function exit code */
5986   __Pyx_RefNannyFinishContext();
5987   return __pyx_r;
5988 }
5989 
__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)5990 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10hide(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
5991   PyObject *__pyx_r = NULL;
5992   __Pyx_RefNannyDeclarations
5993   __Pyx_RefNannySetupContext("hide", 0);
5994 
5995   /* "pygame/_sdl2/video.pyx":384
5996  *         """
5997  *         # https://wiki.libsdl.org/SDL_HideWindow
5998  *         SDL_HideWindow(self._win)             # <<<<<<<<<<<<<<
5999  *
6000  *     def show(self):
6001  */
6002   SDL_HideWindow(__pyx_v_self->_win);
6003 
6004   /* "pygame/_sdl2/video.pyx":380
6005  *             self._win = NULL
6006  *
6007  *     def hide(self):             # <<<<<<<<<<<<<<
6008  *         """ Hide the window.
6009  *         """
6010  */
6011 
6012   /* function exit code */
6013   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6014   __Pyx_XGIVEREF(__pyx_r);
6015   __Pyx_RefNannyFinishContext();
6016   return __pyx_r;
6017 }
6018 
6019 /* "pygame/_sdl2/video.pyx":386
6020  *         SDL_HideWindow(self._win)
6021  *
6022  *     def show(self):             # <<<<<<<<<<<<<<
6023  *         """ Show the window.
6024  *         """
6025  */
6026 
6027 /* Python wrapper */
6028 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13show(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6029 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_12show[] = " Show the window.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_13show(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6030 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13show(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6031   PyObject *__pyx_r = 0;
6032   __Pyx_RefNannyDeclarations
6033   __Pyx_RefNannySetupContext("show (wrapper)", 0);
6034   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_12show(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6035 
6036   /* function exit code */
6037   __Pyx_RefNannyFinishContext();
6038   return __pyx_r;
6039 }
6040 
__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6041 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_12show(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6042   PyObject *__pyx_r = NULL;
6043   __Pyx_RefNannyDeclarations
6044   __Pyx_RefNannySetupContext("show", 0);
6045 
6046   /* "pygame/_sdl2/video.pyx":390
6047  *         """
6048  *         # https://wiki.libsdl.org/SDL_ShowWindow
6049  *         SDL_ShowWindow(self._win)             # <<<<<<<<<<<<<<
6050  *
6051  *     def focus(self, input_only=False):
6052  */
6053   SDL_ShowWindow(__pyx_v_self->_win);
6054 
6055   /* "pygame/_sdl2/video.pyx":386
6056  *         SDL_HideWindow(self._win)
6057  *
6058  *     def show(self):             # <<<<<<<<<<<<<<
6059  *         """ Show the window.
6060  *         """
6061  */
6062 
6063   /* function exit code */
6064   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6065   __Pyx_XGIVEREF(__pyx_r);
6066   __Pyx_RefNannyFinishContext();
6067   return __pyx_r;
6068 }
6069 
6070 /* "pygame/_sdl2/video.pyx":392
6071  *         SDL_ShowWindow(self._win)
6072  *
6073  *     def focus(self, input_only=False):             # <<<<<<<<<<<<<<
6074  *         """ Raise the window above other windows and set the input focus.
6075  *
6076  */
6077 
6078 /* Python wrapper */
6079 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6080 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_14focus[] = " Raise the window above other windows and set the input focus.\n\n        :param bool input_only: if ``True``, the window will be given input focus\n                                but may be completely obscured by other windows.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6081 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6082   PyObject *__pyx_v_input_only = 0;
6083   int __pyx_lineno = 0;
6084   const char *__pyx_filename = NULL;
6085   int __pyx_clineno = 0;
6086   PyObject *__pyx_r = 0;
6087   __Pyx_RefNannyDeclarations
6088   __Pyx_RefNannySetupContext("focus (wrapper)", 0);
6089   {
6090     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input_only,0};
6091     PyObject* values[1] = {0};
6092     values[0] = ((PyObject *)Py_False);
6093     if (unlikely(__pyx_kwds)) {
6094       Py_ssize_t kw_args;
6095       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6096       switch (pos_args) {
6097         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6098         CYTHON_FALLTHROUGH;
6099         case  0: break;
6100         default: goto __pyx_L5_argtuple_error;
6101       }
6102       kw_args = PyDict_Size(__pyx_kwds);
6103       switch (pos_args) {
6104         case  0:
6105         if (kw_args > 0) {
6106           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input_only);
6107           if (value) { values[0] = value; kw_args--; }
6108         }
6109       }
6110       if (unlikely(kw_args > 0)) {
6111         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "focus") < 0)) __PYX_ERR(0, 392, __pyx_L3_error)
6112       }
6113     } else {
6114       switch (PyTuple_GET_SIZE(__pyx_args)) {
6115         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6116         CYTHON_FALLTHROUGH;
6117         case  0: break;
6118         default: goto __pyx_L5_argtuple_error;
6119       }
6120     }
6121     __pyx_v_input_only = values[0];
6122   }
6123   goto __pyx_L4_argument_unpacking_done;
6124   __pyx_L5_argtuple_error:;
6125   __Pyx_RaiseArgtupleInvalid("focus", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 392, __pyx_L3_error)
6126   __pyx_L3_error:;
6127   __Pyx_AddTraceback("pygame._sdl2.video.Window.focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
6128   __Pyx_RefNannyFinishContext();
6129   return NULL;
6130   __pyx_L4_argument_unpacking_done:;
6131   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), __pyx_v_input_only);
6132 
6133   /* function exit code */
6134   __Pyx_RefNannyFinishContext();
6135   return __pyx_r;
6136 }
6137 
__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_input_only)6138 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_14focus(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_input_only) {
6139   PyObject *__pyx_r = NULL;
6140   __Pyx_RefNannyDeclarations
6141   int __pyx_t_1;
6142   PyObject *__pyx_t_2 = NULL;
6143   PyObject *__pyx_t_3 = NULL;
6144   PyObject *__pyx_t_4 = NULL;
6145   int __pyx_lineno = 0;
6146   const char *__pyx_filename = NULL;
6147   int __pyx_clineno = 0;
6148   __Pyx_RefNannySetupContext("focus", 0);
6149 
6150   /* "pygame/_sdl2/video.pyx":399
6151  *         """
6152  *         # https://wiki.libsdl.org/SDL_RaiseWindow
6153  *         if input_only:             # <<<<<<<<<<<<<<
6154  *             if SDL_SetWindowInputFocus(self._win):
6155  *                 raise error()
6156  */
6157   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_input_only); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
6158   if (__pyx_t_1) {
6159 
6160     /* "pygame/_sdl2/video.pyx":400
6161  *         # https://wiki.libsdl.org/SDL_RaiseWindow
6162  *         if input_only:
6163  *             if SDL_SetWindowInputFocus(self._win):             # <<<<<<<<<<<<<<
6164  *                 raise error()
6165  *         else:
6166  */
6167     __pyx_t_1 = (SDL_SetWindowInputFocus(__pyx_v_self->_win) != 0);
6168     if (unlikely(__pyx_t_1)) {
6169 
6170       /* "pygame/_sdl2/video.pyx":401
6171  *         if input_only:
6172  *             if SDL_SetWindowInputFocus(self._win):
6173  *                 raise error()             # <<<<<<<<<<<<<<
6174  *         else:
6175  *             SDL_RaiseWindow(self._win)
6176  */
6177       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error)
6178       __Pyx_GOTREF(__pyx_t_3);
6179       __pyx_t_4 = NULL;
6180       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6181         __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
6182         if (likely(__pyx_t_4)) {
6183           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6184           __Pyx_INCREF(__pyx_t_4);
6185           __Pyx_INCREF(function);
6186           __Pyx_DECREF_SET(__pyx_t_3, function);
6187         }
6188       }
6189       __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
6190       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6191       if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
6192       __Pyx_GOTREF(__pyx_t_2);
6193       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6194       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
6195       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6196       __PYX_ERR(0, 401, __pyx_L1_error)
6197 
6198       /* "pygame/_sdl2/video.pyx":400
6199  *         # https://wiki.libsdl.org/SDL_RaiseWindow
6200  *         if input_only:
6201  *             if SDL_SetWindowInputFocus(self._win):             # <<<<<<<<<<<<<<
6202  *                 raise error()
6203  *         else:
6204  */
6205     }
6206 
6207     /* "pygame/_sdl2/video.pyx":399
6208  *         """
6209  *         # https://wiki.libsdl.org/SDL_RaiseWindow
6210  *         if input_only:             # <<<<<<<<<<<<<<
6211  *             if SDL_SetWindowInputFocus(self._win):
6212  *                 raise error()
6213  */
6214     goto __pyx_L3;
6215   }
6216 
6217   /* "pygame/_sdl2/video.pyx":403
6218  *                 raise error()
6219  *         else:
6220  *             SDL_RaiseWindow(self._win)             # <<<<<<<<<<<<<<
6221  *
6222  *     def restore(self):
6223  */
6224   /*else*/ {
6225     SDL_RaiseWindow(__pyx_v_self->_win);
6226   }
6227   __pyx_L3:;
6228 
6229   /* "pygame/_sdl2/video.pyx":392
6230  *         SDL_ShowWindow(self._win)
6231  *
6232  *     def focus(self, input_only=False):             # <<<<<<<<<<<<<<
6233  *         """ Raise the window above other windows and set the input focus.
6234  *
6235  */
6236 
6237   /* function exit code */
6238   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6239   goto __pyx_L0;
6240   __pyx_L1_error:;
6241   __Pyx_XDECREF(__pyx_t_2);
6242   __Pyx_XDECREF(__pyx_t_3);
6243   __Pyx_XDECREF(__pyx_t_4);
6244   __Pyx_AddTraceback("pygame._sdl2.video.Window.focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
6245   __pyx_r = NULL;
6246   __pyx_L0:;
6247   __Pyx_XGIVEREF(__pyx_r);
6248   __Pyx_RefNannyFinishContext();
6249   return __pyx_r;
6250 }
6251 
6252 /* "pygame/_sdl2/video.pyx":405
6253  *             SDL_RaiseWindow(self._win)
6254  *
6255  *     def restore(self):             # <<<<<<<<<<<<<<
6256  *         """ Restore the size and position of a minimized or maximized window.
6257  *         """
6258  */
6259 
6260 /* Python wrapper */
6261 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6262 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_16restore[] = " Restore the size and position of a minimized or maximized window.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6263 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6264   PyObject *__pyx_r = 0;
6265   __Pyx_RefNannyDeclarations
6266   __Pyx_RefNannySetupContext("restore (wrapper)", 0);
6267   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6268 
6269   /* function exit code */
6270   __Pyx_RefNannyFinishContext();
6271   return __pyx_r;
6272 }
6273 
__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6274 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_16restore(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6275   PyObject *__pyx_r = NULL;
6276   __Pyx_RefNannyDeclarations
6277   __Pyx_RefNannySetupContext("restore", 0);
6278 
6279   /* "pygame/_sdl2/video.pyx":408
6280  *         """ Restore the size and position of a minimized or maximized window.
6281  *         """
6282  *         SDL_RestoreWindow(self._win)             # <<<<<<<<<<<<<<
6283  *
6284  *     def maximize(self):
6285  */
6286   SDL_RestoreWindow(__pyx_v_self->_win);
6287 
6288   /* "pygame/_sdl2/video.pyx":405
6289  *             SDL_RaiseWindow(self._win)
6290  *
6291  *     def restore(self):             # <<<<<<<<<<<<<<
6292  *         """ Restore the size and position of a minimized or maximized window.
6293  *         """
6294  */
6295 
6296   /* function exit code */
6297   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6298   __Pyx_XGIVEREF(__pyx_r);
6299   __Pyx_RefNannyFinishContext();
6300   return __pyx_r;
6301 }
6302 
6303 /* "pygame/_sdl2/video.pyx":410
6304  *         SDL_RestoreWindow(self._win)
6305  *
6306  *     def maximize(self):             # <<<<<<<<<<<<<<
6307  *         """ Maximize the window.
6308  *         """
6309  */
6310 
6311 /* Python wrapper */
6312 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6313 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_18maximize[] = " Maximize the window.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6314 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6315   PyObject *__pyx_r = 0;
6316   __Pyx_RefNannyDeclarations
6317   __Pyx_RefNannySetupContext("maximize (wrapper)", 0);
6318   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6319 
6320   /* function exit code */
6321   __Pyx_RefNannyFinishContext();
6322   return __pyx_r;
6323 }
6324 
__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6325 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_18maximize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6326   PyObject *__pyx_r = NULL;
6327   __Pyx_RefNannyDeclarations
6328   __Pyx_RefNannySetupContext("maximize", 0);
6329 
6330   /* "pygame/_sdl2/video.pyx":413
6331  *         """ Maximize the window.
6332  *         """
6333  *         SDL_MaximizeWindow(self._win)             # <<<<<<<<<<<<<<
6334  *
6335  *     def minimize(self):
6336  */
6337   SDL_MaximizeWindow(__pyx_v_self->_win);
6338 
6339   /* "pygame/_sdl2/video.pyx":410
6340  *         SDL_RestoreWindow(self._win)
6341  *
6342  *     def maximize(self):             # <<<<<<<<<<<<<<
6343  *         """ Maximize the window.
6344  *         """
6345  */
6346 
6347   /* function exit code */
6348   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6349   __Pyx_XGIVEREF(__pyx_r);
6350   __Pyx_RefNannyFinishContext();
6351   return __pyx_r;
6352 }
6353 
6354 /* "pygame/_sdl2/video.pyx":415
6355  *         SDL_MaximizeWindow(self._win)
6356  *
6357  *     def minimize(self):             # <<<<<<<<<<<<<<
6358  *         """ Minimize the window.
6359  *         """
6360  */
6361 
6362 /* Python wrapper */
6363 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6364 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_20minimize[] = " Minimize the window.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6365 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6366   PyObject *__pyx_r = 0;
6367   __Pyx_RefNannyDeclarations
6368   __Pyx_RefNannySetupContext("minimize (wrapper)", 0);
6369   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6370 
6371   /* function exit code */
6372   __Pyx_RefNannyFinishContext();
6373   return __pyx_r;
6374 }
6375 
__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6376 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_20minimize(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6377   PyObject *__pyx_r = NULL;
6378   __Pyx_RefNannyDeclarations
6379   __Pyx_RefNannySetupContext("minimize", 0);
6380 
6381   /* "pygame/_sdl2/video.pyx":418
6382  *         """ Minimize the window.
6383  *         """
6384  *         SDL_MinimizeWindow(self._win)             # <<<<<<<<<<<<<<
6385  *
6386  *     @property
6387  */
6388   SDL_MinimizeWindow(__pyx_v_self->_win);
6389 
6390   /* "pygame/_sdl2/video.pyx":415
6391  *         SDL_MaximizeWindow(self._win)
6392  *
6393  *     def minimize(self):             # <<<<<<<<<<<<<<
6394  *         """ Minimize the window.
6395  *         """
6396  */
6397 
6398   /* function exit code */
6399   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6400   __Pyx_XGIVEREF(__pyx_r);
6401   __Pyx_RefNannyFinishContext();
6402   return __pyx_r;
6403 }
6404 
6405 /* "pygame/_sdl2/video.pyx":421
6406  *
6407  *     @property
6408  *     def resizable(self):             # <<<<<<<<<<<<<<
6409  *         """ Sets whether the window is resizable.
6410  *         """
6411  */
6412 
6413 /* Python wrapper */
6414 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(PyObject * __pyx_v_self)6415 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(PyObject *__pyx_v_self) {
6416   PyObject *__pyx_r = 0;
6417   __Pyx_RefNannyDeclarations
6418   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6419   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6420 
6421   /* function exit code */
6422   __Pyx_RefNannyFinishContext();
6423   return __pyx_r;
6424 }
6425 
__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6426 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6427   PyObject *__pyx_r = NULL;
6428   __Pyx_RefNannyDeclarations
6429   PyObject *__pyx_t_1 = NULL;
6430   int __pyx_lineno = 0;
6431   const char *__pyx_filename = NULL;
6432   int __pyx_clineno = 0;
6433   __Pyx_RefNannySetupContext("__get__", 0);
6434 
6435   /* "pygame/_sdl2/video.pyx":424
6436  *         """ Sets whether the window is resizable.
6437  *         """
6438  *         return SDL_GetWindowFlags(self._win) & _SDL_WINDOW_RESIZABLE != 0             # <<<<<<<<<<<<<<
6439  *
6440  *     @resizable.setter
6441  */
6442   __Pyx_XDECREF(__pyx_r);
6443   __pyx_t_1 = __Pyx_PyBool_FromLong(((SDL_GetWindowFlags(__pyx_v_self->_win) & SDL_WINDOW_RESIZABLE) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
6444   __Pyx_GOTREF(__pyx_t_1);
6445   __pyx_r = __pyx_t_1;
6446   __pyx_t_1 = 0;
6447   goto __pyx_L0;
6448 
6449   /* "pygame/_sdl2/video.pyx":421
6450  *
6451  *     @property
6452  *     def resizable(self):             # <<<<<<<<<<<<<<
6453  *         """ Sets whether the window is resizable.
6454  *         """
6455  */
6456 
6457   /* function exit code */
6458   __pyx_L1_error:;
6459   __Pyx_XDECREF(__pyx_t_1);
6460   __Pyx_AddTraceback("pygame._sdl2.video.Window.resizable.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6461   __pyx_r = NULL;
6462   __pyx_L0:;
6463   __Pyx_XGIVEREF(__pyx_r);
6464   __Pyx_RefNannyFinishContext();
6465   return __pyx_r;
6466 }
6467 
6468 /* "pygame/_sdl2/video.pyx":427
6469  *
6470  *     @resizable.setter
6471  *     def resizable(self, enabled):             # <<<<<<<<<<<<<<
6472  *         SDL_SetWindowResizable(self._win, 1 if enabled else 0)
6473  *
6474  */
6475 
6476 /* Python wrapper */
6477 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_enabled)6478 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
6479   int __pyx_r;
6480   __Pyx_RefNannyDeclarations
6481   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
6482   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_enabled));
6483 
6484   /* function exit code */
6485   __Pyx_RefNannyFinishContext();
6486   return __pyx_r;
6487 }
6488 
__pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_enabled)6489 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_9resizable_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled) {
6490   int __pyx_r;
6491   __Pyx_RefNannyDeclarations
6492   SDL_bool __pyx_t_1;
6493   int __pyx_t_2;
6494   int __pyx_lineno = 0;
6495   const char *__pyx_filename = NULL;
6496   int __pyx_clineno = 0;
6497   __Pyx_RefNannySetupContext("__set__", 0);
6498 
6499   /* "pygame/_sdl2/video.pyx":428
6500  *     @resizable.setter
6501  *     def resizable(self, enabled):
6502  *         SDL_SetWindowResizable(self._win, 1 if enabled else 0)             # <<<<<<<<<<<<<<
6503  *
6504  *     @property
6505  */
6506   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 428, __pyx_L1_error)
6507   if (__pyx_t_2) {
6508     __pyx_t_1 = 1;
6509   } else {
6510     __pyx_t_1 = 0;
6511   }
6512   SDL_SetWindowResizable(__pyx_v_self->_win, __pyx_t_1);
6513 
6514   /* "pygame/_sdl2/video.pyx":427
6515  *
6516  *     @resizable.setter
6517  *     def resizable(self, enabled):             # <<<<<<<<<<<<<<
6518  *         SDL_SetWindowResizable(self._win, 1 if enabled else 0)
6519  *
6520  */
6521 
6522   /* function exit code */
6523   __pyx_r = 0;
6524   goto __pyx_L0;
6525   __pyx_L1_error:;
6526   __Pyx_AddTraceback("pygame._sdl2.video.Window.resizable.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6527   __pyx_r = -1;
6528   __pyx_L0:;
6529   __Pyx_RefNannyFinishContext();
6530   return __pyx_r;
6531 }
6532 
6533 /* "pygame/_sdl2/video.pyx":431
6534  *
6535  *     @property
6536  *     def borderless(self):             # <<<<<<<<<<<<<<
6537  *         """ Add or remove the border from the actual window.
6538  *
6539  */
6540 
6541 /* Python wrapper */
6542 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(PyObject * __pyx_v_self)6543 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(PyObject *__pyx_v_self) {
6544   PyObject *__pyx_r = 0;
6545   __Pyx_RefNannyDeclarations
6546   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6547   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6548 
6549   /* function exit code */
6550   __Pyx_RefNannyFinishContext();
6551   return __pyx_r;
6552 }
6553 
__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6554 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6555   PyObject *__pyx_r = NULL;
6556   __Pyx_RefNannyDeclarations
6557   PyObject *__pyx_t_1 = NULL;
6558   int __pyx_lineno = 0;
6559   const char *__pyx_filename = NULL;
6560   int __pyx_clineno = 0;
6561   __Pyx_RefNannySetupContext("__get__", 0);
6562 
6563   /* "pygame/_sdl2/video.pyx":436
6564  *         .. note:: You can't change the border state of a fullscreen window.
6565  *         """
6566  *         return SDL_GetWindowFlags(self._win) & _SDL_WINDOW_BORDERLESS != 0             # <<<<<<<<<<<<<<
6567  *
6568  *     @borderless.setter
6569  */
6570   __Pyx_XDECREF(__pyx_r);
6571   __pyx_t_1 = __Pyx_PyBool_FromLong(((SDL_GetWindowFlags(__pyx_v_self->_win) & SDL_WINDOW_BORDERLESS) != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error)
6572   __Pyx_GOTREF(__pyx_t_1);
6573   __pyx_r = __pyx_t_1;
6574   __pyx_t_1 = 0;
6575   goto __pyx_L0;
6576 
6577   /* "pygame/_sdl2/video.pyx":431
6578  *
6579  *     @property
6580  *     def borderless(self):             # <<<<<<<<<<<<<<
6581  *         """ Add or remove the border from the actual window.
6582  *
6583  */
6584 
6585   /* function exit code */
6586   __pyx_L1_error:;
6587   __Pyx_XDECREF(__pyx_t_1);
6588   __Pyx_AddTraceback("pygame._sdl2.video.Window.borderless.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6589   __pyx_r = NULL;
6590   __pyx_L0:;
6591   __Pyx_XGIVEREF(__pyx_r);
6592   __Pyx_RefNannyFinishContext();
6593   return __pyx_r;
6594 }
6595 
6596 /* "pygame/_sdl2/video.pyx":439
6597  *
6598  *     @borderless.setter
6599  *     def borderless(self, enabled):             # <<<<<<<<<<<<<<
6600  *         SDL_SetWindowBordered(self._win, 1 if enabled else 0)
6601  *
6602  */
6603 
6604 /* Python wrapper */
6605 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_enabled)6606 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_enabled) {
6607   int __pyx_r;
6608   __Pyx_RefNannyDeclarations
6609   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
6610   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_enabled));
6611 
6612   /* function exit code */
6613   __Pyx_RefNannyFinishContext();
6614   return __pyx_r;
6615 }
6616 
__pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_enabled)6617 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10borderless_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_enabled) {
6618   int __pyx_r;
6619   __Pyx_RefNannyDeclarations
6620   SDL_bool __pyx_t_1;
6621   int __pyx_t_2;
6622   int __pyx_lineno = 0;
6623   const char *__pyx_filename = NULL;
6624   int __pyx_clineno = 0;
6625   __Pyx_RefNannySetupContext("__set__", 0);
6626 
6627   /* "pygame/_sdl2/video.pyx":440
6628  *     @borderless.setter
6629  *     def borderless(self, enabled):
6630  *         SDL_SetWindowBordered(self._win, 1 if enabled else 0)             # <<<<<<<<<<<<<<
6631  *
6632  *     def set_icon(self, surface):
6633  */
6634   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enabled); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 440, __pyx_L1_error)
6635   if (__pyx_t_2) {
6636     __pyx_t_1 = 1;
6637   } else {
6638     __pyx_t_1 = 0;
6639   }
6640   SDL_SetWindowBordered(__pyx_v_self->_win, __pyx_t_1);
6641 
6642   /* "pygame/_sdl2/video.pyx":439
6643  *
6644  *     @borderless.setter
6645  *     def borderless(self, enabled):             # <<<<<<<<<<<<<<
6646  *         SDL_SetWindowBordered(self._win, 1 if enabled else 0)
6647  *
6648  */
6649 
6650   /* function exit code */
6651   __pyx_r = 0;
6652   goto __pyx_L0;
6653   __pyx_L1_error:;
6654   __Pyx_AddTraceback("pygame._sdl2.video.Window.borderless.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6655   __pyx_r = -1;
6656   __pyx_L0:;
6657   __Pyx_RefNannyFinishContext();
6658   return __pyx_r;
6659 }
6660 
6661 /* "pygame/_sdl2/video.pyx":442
6662  *         SDL_SetWindowBordered(self._win, 1 if enabled else 0)
6663  *
6664  *     def set_icon(self, surface):             # <<<<<<<<<<<<<<
6665  *         """ Set the icon for the window.
6666  *
6667  */
6668 
6669 /* Python wrapper */
6670 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon(PyObject *__pyx_v_self, PyObject *__pyx_v_surface); /*proto*/
6671 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_22set_icon[] = " Set the icon for the window.\n\n        :param pygame.Surface surface: A Surface to use as the icon.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon(PyObject * __pyx_v_self,PyObject * __pyx_v_surface)6672 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon(PyObject *__pyx_v_self, PyObject *__pyx_v_surface) {
6673   PyObject *__pyx_r = 0;
6674   __Pyx_RefNannyDeclarations
6675   __Pyx_RefNannySetupContext("set_icon (wrapper)", 0);
6676   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_surface));
6677 
6678   /* function exit code */
6679   __Pyx_RefNannyFinishContext();
6680   return __pyx_r;
6681 }
6682 
__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_surface)6683 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_22set_icon(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_surface) {
6684   PyObject *__pyx_r = NULL;
6685   __Pyx_RefNannyDeclarations
6686   int __pyx_t_1;
6687   PyObject *__pyx_t_2 = NULL;
6688   int __pyx_lineno = 0;
6689   const char *__pyx_filename = NULL;
6690   int __pyx_clineno = 0;
6691   __Pyx_RefNannySetupContext("set_icon", 0);
6692 
6693   /* "pygame/_sdl2/video.pyx":447
6694  *         :param pygame.Surface surface: A Surface to use as the icon.
6695  *         """
6696  *         if not pgSurface_Check(surface):             # <<<<<<<<<<<<<<
6697  *             raise TypeError('surface must be a Surface object')
6698  *         SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))
6699  */
6700   __pyx_t_1 = ((!(pgSurface_Check(__pyx_v_surface) != 0)) != 0);
6701   if (unlikely(__pyx_t_1)) {
6702 
6703     /* "pygame/_sdl2/video.pyx":448
6704  *         """
6705  *         if not pgSurface_Check(surface):
6706  *             raise TypeError('surface must be a Surface object')             # <<<<<<<<<<<<<<
6707  *         SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))
6708  *
6709  */
6710     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error)
6711     __Pyx_GOTREF(__pyx_t_2);
6712     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
6713     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6714     __PYX_ERR(0, 448, __pyx_L1_error)
6715 
6716     /* "pygame/_sdl2/video.pyx":447
6717  *         :param pygame.Surface surface: A Surface to use as the icon.
6718  *         """
6719  *         if not pgSurface_Check(surface):             # <<<<<<<<<<<<<<
6720  *             raise TypeError('surface must be a Surface object')
6721  *         SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))
6722  */
6723   }
6724 
6725   /* "pygame/_sdl2/video.pyx":449
6726  *         if not pgSurface_Check(surface):
6727  *             raise TypeError('surface must be a Surface object')
6728  *         SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))             # <<<<<<<<<<<<<<
6729  *
6730  *     @property
6731  */
6732   SDL_SetWindowIcon(__pyx_v_self->_win, pgSurface_AsSurface(__pyx_v_surface));
6733 
6734   /* "pygame/_sdl2/video.pyx":442
6735  *         SDL_SetWindowBordered(self._win, 1 if enabled else 0)
6736  *
6737  *     def set_icon(self, surface):             # <<<<<<<<<<<<<<
6738  *         """ Set the icon for the window.
6739  *
6740  */
6741 
6742   /* function exit code */
6743   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6744   goto __pyx_L0;
6745   __pyx_L1_error:;
6746   __Pyx_XDECREF(__pyx_t_2);
6747   __Pyx_AddTraceback("pygame._sdl2.video.Window.set_icon", __pyx_clineno, __pyx_lineno, __pyx_filename);
6748   __pyx_r = NULL;
6749   __pyx_L0:;
6750   __Pyx_XGIVEREF(__pyx_r);
6751   __Pyx_RefNannyFinishContext();
6752   return __pyx_r;
6753 }
6754 
6755 /* "pygame/_sdl2/video.pyx":452
6756  *
6757  *     @property
6758  *     def id(self):             # <<<<<<<<<<<<<<
6759  *         """ A unique window ID. *Read-only*.
6760  *
6761  */
6762 
6763 /* Python wrapper */
6764 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(PyObject * __pyx_v_self)6765 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(PyObject *__pyx_v_self) {
6766   PyObject *__pyx_r = 0;
6767   __Pyx_RefNannyDeclarations
6768   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6769   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6770 
6771   /* function exit code */
6772   __Pyx_RefNannyFinishContext();
6773   return __pyx_r;
6774 }
6775 
__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6776 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_2id___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6777   PyObject *__pyx_r = NULL;
6778   __Pyx_RefNannyDeclarations
6779   PyObject *__pyx_t_1 = NULL;
6780   int __pyx_lineno = 0;
6781   const char *__pyx_filename = NULL;
6782   int __pyx_clineno = 0;
6783   __Pyx_RefNannySetupContext("__get__", 0);
6784 
6785   /* "pygame/_sdl2/video.pyx":457
6786  *         :rtype: int
6787  *         """
6788  *         return SDL_GetWindowID(self._win)             # <<<<<<<<<<<<<<
6789  *
6790  *     @property
6791  */
6792   __Pyx_XDECREF(__pyx_r);
6793   __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_GetWindowID(__pyx_v_self->_win)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error)
6794   __Pyx_GOTREF(__pyx_t_1);
6795   __pyx_r = __pyx_t_1;
6796   __pyx_t_1 = 0;
6797   goto __pyx_L0;
6798 
6799   /* "pygame/_sdl2/video.pyx":452
6800  *
6801  *     @property
6802  *     def id(self):             # <<<<<<<<<<<<<<
6803  *         """ A unique window ID. *Read-only*.
6804  *
6805  */
6806 
6807   /* function exit code */
6808   __pyx_L1_error:;
6809   __Pyx_XDECREF(__pyx_t_1);
6810   __Pyx_AddTraceback("pygame._sdl2.video.Window.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6811   __pyx_r = NULL;
6812   __pyx_L0:;
6813   __Pyx_XGIVEREF(__pyx_r);
6814   __Pyx_RefNannyFinishContext();
6815   return __pyx_r;
6816 }
6817 
6818 /* "pygame/_sdl2/video.pyx":460
6819  *
6820  *     @property
6821  *     def size(self):             # <<<<<<<<<<<<<<
6822  *         """ The size of the window's client area."""
6823  *         cdef int w, h
6824  */
6825 
6826 /* Python wrapper */
6827 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(PyObject * __pyx_v_self)6828 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(PyObject *__pyx_v_self) {
6829   PyObject *__pyx_r = 0;
6830   __Pyx_RefNannyDeclarations
6831   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6832   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6833 
6834   /* function exit code */
6835   __Pyx_RefNannyFinishContext();
6836   return __pyx_r;
6837 }
6838 
__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6839 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_4size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6840   int __pyx_v_w;
6841   int __pyx_v_h;
6842   PyObject *__pyx_r = NULL;
6843   __Pyx_RefNannyDeclarations
6844   PyObject *__pyx_t_1 = NULL;
6845   PyObject *__pyx_t_2 = NULL;
6846   PyObject *__pyx_t_3 = NULL;
6847   int __pyx_lineno = 0;
6848   const char *__pyx_filename = NULL;
6849   int __pyx_clineno = 0;
6850   __Pyx_RefNannySetupContext("__get__", 0);
6851 
6852   /* "pygame/_sdl2/video.pyx":463
6853  *         """ The size of the window's client area."""
6854  *         cdef int w, h
6855  *         SDL_GetWindowSize(self._win, &w, &h)             # <<<<<<<<<<<<<<
6856  *         return (w, h)
6857  *
6858  */
6859   SDL_GetWindowSize(__pyx_v_self->_win, (&__pyx_v_w), (&__pyx_v_h));
6860 
6861   /* "pygame/_sdl2/video.pyx":464
6862  *         cdef int w, h
6863  *         SDL_GetWindowSize(self._win, &w, &h)
6864  *         return (w, h)             # <<<<<<<<<<<<<<
6865  *
6866  *     @size.setter
6867  */
6868   __Pyx_XDECREF(__pyx_r);
6869   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error)
6870   __Pyx_GOTREF(__pyx_t_1);
6871   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error)
6872   __Pyx_GOTREF(__pyx_t_2);
6873   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error)
6874   __Pyx_GOTREF(__pyx_t_3);
6875   __Pyx_GIVEREF(__pyx_t_1);
6876   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
6877   __Pyx_GIVEREF(__pyx_t_2);
6878   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
6879   __pyx_t_1 = 0;
6880   __pyx_t_2 = 0;
6881   __pyx_r = __pyx_t_3;
6882   __pyx_t_3 = 0;
6883   goto __pyx_L0;
6884 
6885   /* "pygame/_sdl2/video.pyx":460
6886  *
6887  *     @property
6888  *     def size(self):             # <<<<<<<<<<<<<<
6889  *         """ The size of the window's client area."""
6890  *         cdef int w, h
6891  */
6892 
6893   /* function exit code */
6894   __pyx_L1_error:;
6895   __Pyx_XDECREF(__pyx_t_1);
6896   __Pyx_XDECREF(__pyx_t_2);
6897   __Pyx_XDECREF(__pyx_t_3);
6898   __Pyx_AddTraceback("pygame._sdl2.video.Window.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6899   __pyx_r = NULL;
6900   __pyx_L0:;
6901   __Pyx_XGIVEREF(__pyx_r);
6902   __Pyx_RefNannyFinishContext();
6903   return __pyx_r;
6904 }
6905 
6906 /* "pygame/_sdl2/video.pyx":467
6907  *
6908  *     @size.setter
6909  *     def size(self, size):             # <<<<<<<<<<<<<<
6910  *         SDL_SetWindowSize(self._win, size[0], size[1])
6911  *
6912  */
6913 
6914 /* Python wrapper */
6915 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_size)6916 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
6917   int __pyx_r;
6918   __Pyx_RefNannyDeclarations
6919   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
6920   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_size));
6921 
6922   /* function exit code */
6923   __Pyx_RefNannyFinishContext();
6924   return __pyx_r;
6925 }
6926 
__pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_size)6927 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_4size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_size) {
6928   int __pyx_r;
6929   __Pyx_RefNannyDeclarations
6930   PyObject *__pyx_t_1 = NULL;
6931   int __pyx_t_2;
6932   int __pyx_t_3;
6933   int __pyx_lineno = 0;
6934   const char *__pyx_filename = NULL;
6935   int __pyx_clineno = 0;
6936   __Pyx_RefNannySetupContext("__set__", 0);
6937 
6938   /* "pygame/_sdl2/video.pyx":468
6939  *     @size.setter
6940  *     def size(self, size):
6941  *         SDL_SetWindowSize(self._win, size[0], size[1])             # <<<<<<<<<<<<<<
6942  *
6943  *     @property
6944  */
6945   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
6946   __Pyx_GOTREF(__pyx_t_1);
6947   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 468, __pyx_L1_error)
6948   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6949   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
6950   __Pyx_GOTREF(__pyx_t_1);
6951   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 468, __pyx_L1_error)
6952   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6953   SDL_SetWindowSize(__pyx_v_self->_win, __pyx_t_2, __pyx_t_3);
6954 
6955   /* "pygame/_sdl2/video.pyx":467
6956  *
6957  *     @size.setter
6958  *     def size(self, size):             # <<<<<<<<<<<<<<
6959  *         SDL_SetWindowSize(self._win, size[0], size[1])
6960  *
6961  */
6962 
6963   /* function exit code */
6964   __pyx_r = 0;
6965   goto __pyx_L0;
6966   __pyx_L1_error:;
6967   __Pyx_XDECREF(__pyx_t_1);
6968   __Pyx_AddTraceback("pygame._sdl2.video.Window.size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6969   __pyx_r = -1;
6970   __pyx_L0:;
6971   __Pyx_RefNannyFinishContext();
6972   return __pyx_r;
6973 }
6974 
6975 /* "pygame/_sdl2/video.pyx":471
6976  *
6977  *     @property
6978  *     def position(self):             # <<<<<<<<<<<<<<
6979  *         """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
6980  *         cdef int x, y
6981  */
6982 
6983 /* Python wrapper */
6984 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(PyObject * __pyx_v_self)6985 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(PyObject *__pyx_v_self) {
6986   PyObject *__pyx_r = 0;
6987   __Pyx_RefNannyDeclarations
6988   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6989   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
6990 
6991   /* function exit code */
6992   __Pyx_RefNannyFinishContext();
6993   return __pyx_r;
6994 }
6995 
__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)6996 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_8position___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
6997   int __pyx_v_x;
6998   int __pyx_v_y;
6999   PyObject *__pyx_r = NULL;
7000   __Pyx_RefNannyDeclarations
7001   PyObject *__pyx_t_1 = NULL;
7002   PyObject *__pyx_t_2 = NULL;
7003   PyObject *__pyx_t_3 = NULL;
7004   int __pyx_lineno = 0;
7005   const char *__pyx_filename = NULL;
7006   int __pyx_clineno = 0;
7007   __Pyx_RefNannySetupContext("__get__", 0);
7008 
7009   /* "pygame/_sdl2/video.pyx":474
7010  *         """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
7011  *         cdef int x, y
7012  *         SDL_GetWindowPosition(self._win, &x, &y)             # <<<<<<<<<<<<<<
7013  *         return (x, y)
7014  *
7015  */
7016   SDL_GetWindowPosition(__pyx_v_self->_win, (&__pyx_v_x), (&__pyx_v_y));
7017 
7018   /* "pygame/_sdl2/video.pyx":475
7019  *         cdef int x, y
7020  *         SDL_GetWindowPosition(self._win, &x, &y)
7021  *         return (x, y)             # <<<<<<<<<<<<<<
7022  *
7023  *     @position.setter
7024  */
7025   __Pyx_XDECREF(__pyx_r);
7026   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
7027   __Pyx_GOTREF(__pyx_t_1);
7028   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
7029   __Pyx_GOTREF(__pyx_t_2);
7030   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __pyx_L1_error)
7031   __Pyx_GOTREF(__pyx_t_3);
7032   __Pyx_GIVEREF(__pyx_t_1);
7033   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
7034   __Pyx_GIVEREF(__pyx_t_2);
7035   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
7036   __pyx_t_1 = 0;
7037   __pyx_t_2 = 0;
7038   __pyx_r = __pyx_t_3;
7039   __pyx_t_3 = 0;
7040   goto __pyx_L0;
7041 
7042   /* "pygame/_sdl2/video.pyx":471
7043  *
7044  *     @property
7045  *     def position(self):             # <<<<<<<<<<<<<<
7046  *         """ Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED"""
7047  *         cdef int x, y
7048  */
7049 
7050   /* function exit code */
7051   __pyx_L1_error:;
7052   __Pyx_XDECREF(__pyx_t_1);
7053   __Pyx_XDECREF(__pyx_t_2);
7054   __Pyx_XDECREF(__pyx_t_3);
7055   __Pyx_AddTraceback("pygame._sdl2.video.Window.position.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7056   __pyx_r = NULL;
7057   __pyx_L0:;
7058   __Pyx_XGIVEREF(__pyx_r);
7059   __Pyx_RefNannyFinishContext();
7060   return __pyx_r;
7061 }
7062 
7063 /* "pygame/_sdl2/video.pyx":478
7064  *
7065  *     @position.setter
7066  *     def position(self, position):             # <<<<<<<<<<<<<<
7067  *         cdef int x, y
7068  *         if position == WINDOWPOS_UNDEFINED:
7069  */
7070 
7071 /* Python wrapper */
7072 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_position); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_position)7073 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_position) {
7074   int __pyx_r;
7075   __Pyx_RefNannyDeclarations
7076   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
7077   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_position));
7078 
7079   /* function exit code */
7080   __Pyx_RefNannyFinishContext();
7081   return __pyx_r;
7082 }
7083 
__pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_position)7084 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_8position_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_position) {
7085   int __pyx_v_x;
7086   int __pyx_v_y;
7087   int __pyx_r;
7088   __Pyx_RefNannyDeclarations
7089   PyObject *__pyx_t_1 = NULL;
7090   PyObject *__pyx_t_2 = NULL;
7091   int __pyx_t_3;
7092   int __pyx_t_4;
7093   int __pyx_t_5;
7094   PyObject *__pyx_t_6 = NULL;
7095   PyObject *(*__pyx_t_7)(PyObject *);
7096   int __pyx_lineno = 0;
7097   const char *__pyx_filename = NULL;
7098   int __pyx_clineno = 0;
7099   __Pyx_RefNannySetupContext("__set__", 0);
7100 
7101   /* "pygame/_sdl2/video.pyx":480
7102  *     def position(self, position):
7103  *         cdef int x, y
7104  *         if position == WINDOWPOS_UNDEFINED:             # <<<<<<<<<<<<<<
7105  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
7106  *         elif position == WINDOWPOS_CENTERED:
7107  */
7108   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
7109   __Pyx_GOTREF(__pyx_t_1);
7110   __pyx_t_2 = PyObject_RichCompare(__pyx_v_position, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
7111   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7112   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 480, __pyx_L1_error)
7113   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7114   if (__pyx_t_3) {
7115 
7116     /* "pygame/_sdl2/video.pyx":481
7117  *         cdef int x, y
7118  *         if position == WINDOWPOS_UNDEFINED:
7119  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED             # <<<<<<<<<<<<<<
7120  *         elif position == WINDOWPOS_CENTERED:
7121  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
7122  */
7123     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
7124     __Pyx_GOTREF(__pyx_t_2);
7125     __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L1_error)
7126     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7127     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
7128     __Pyx_GOTREF(__pyx_t_2);
7129     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L1_error)
7130     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7131     __pyx_v_x = __pyx_t_4;
7132     __pyx_v_y = __pyx_t_5;
7133 
7134     /* "pygame/_sdl2/video.pyx":480
7135  *     def position(self, position):
7136  *         cdef int x, y
7137  *         if position == WINDOWPOS_UNDEFINED:             # <<<<<<<<<<<<<<
7138  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
7139  *         elif position == WINDOWPOS_CENTERED:
7140  */
7141     goto __pyx_L3;
7142   }
7143 
7144   /* "pygame/_sdl2/video.pyx":482
7145  *         if position == WINDOWPOS_UNDEFINED:
7146  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
7147  *         elif position == WINDOWPOS_CENTERED:             # <<<<<<<<<<<<<<
7148  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
7149  *         else:
7150  */
7151   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error)
7152   __Pyx_GOTREF(__pyx_t_2);
7153   __pyx_t_1 = PyObject_RichCompare(__pyx_v_position, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error)
7154   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7155   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
7156   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7157   if (__pyx_t_3) {
7158 
7159     /* "pygame/_sdl2/video.pyx":483
7160  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
7161  *         elif position == WINDOWPOS_CENTERED:
7162  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED             # <<<<<<<<<<<<<<
7163  *         else:
7164  *             x, y = position
7165  */
7166     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
7167     __Pyx_GOTREF(__pyx_t_1);
7168     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
7169     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7170     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
7171     __Pyx_GOTREF(__pyx_t_1);
7172     __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
7173     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7174     __pyx_v_x = __pyx_t_5;
7175     __pyx_v_y = __pyx_t_4;
7176 
7177     /* "pygame/_sdl2/video.pyx":482
7178  *         if position == WINDOWPOS_UNDEFINED:
7179  *             x, y = WINDOWPOS_UNDEFINED, WINDOWPOS_UNDEFINED
7180  *         elif position == WINDOWPOS_CENTERED:             # <<<<<<<<<<<<<<
7181  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
7182  *         else:
7183  */
7184     goto __pyx_L3;
7185   }
7186 
7187   /* "pygame/_sdl2/video.pyx":485
7188  *             x, y = WINDOWPOS_CENTERED, WINDOWPOS_CENTERED
7189  *         else:
7190  *             x, y = position             # <<<<<<<<<<<<<<
7191  *         SDL_SetWindowPosition(self._win, x, y)
7192  *
7193  */
7194   /*else*/ {
7195     if ((likely(PyTuple_CheckExact(__pyx_v_position))) || (PyList_CheckExact(__pyx_v_position))) {
7196       PyObject* sequence = __pyx_v_position;
7197       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7198       if (unlikely(size != 2)) {
7199         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7200         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7201         __PYX_ERR(0, 485, __pyx_L1_error)
7202       }
7203       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7204       if (likely(PyTuple_CheckExact(sequence))) {
7205         __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
7206         __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
7207       } else {
7208         __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
7209         __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
7210       }
7211       __Pyx_INCREF(__pyx_t_1);
7212       __Pyx_INCREF(__pyx_t_2);
7213       #else
7214       __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
7215       __Pyx_GOTREF(__pyx_t_1);
7216       __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error)
7217       __Pyx_GOTREF(__pyx_t_2);
7218       #endif
7219     } else {
7220       Py_ssize_t index = -1;
7221       __pyx_t_6 = PyObject_GetIter(__pyx_v_position); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 485, __pyx_L1_error)
7222       __Pyx_GOTREF(__pyx_t_6);
7223       __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
7224       index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
7225       __Pyx_GOTREF(__pyx_t_1);
7226       index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
7227       __Pyx_GOTREF(__pyx_t_2);
7228       if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 485, __pyx_L1_error)
7229       __pyx_t_7 = NULL;
7230       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7231       goto __pyx_L5_unpacking_done;
7232       __pyx_L4_unpacking_failed:;
7233       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7234       __pyx_t_7 = NULL;
7235       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7236       __PYX_ERR(0, 485, __pyx_L1_error)
7237       __pyx_L5_unpacking_done:;
7238     }
7239     __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 485, __pyx_L1_error)
7240     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7241     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 485, __pyx_L1_error)
7242     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7243     __pyx_v_x = __pyx_t_4;
7244     __pyx_v_y = __pyx_t_5;
7245   }
7246   __pyx_L3:;
7247 
7248   /* "pygame/_sdl2/video.pyx":486
7249  *         else:
7250  *             x, y = position
7251  *         SDL_SetWindowPosition(self._win, x, y)             # <<<<<<<<<<<<<<
7252  *
7253  *     @property
7254  */
7255   SDL_SetWindowPosition(__pyx_v_self->_win, __pyx_v_x, __pyx_v_y);
7256 
7257   /* "pygame/_sdl2/video.pyx":478
7258  *
7259  *     @position.setter
7260  *     def position(self, position):             # <<<<<<<<<<<<<<
7261  *         cdef int x, y
7262  *         if position == WINDOWPOS_UNDEFINED:
7263  */
7264 
7265   /* function exit code */
7266   __pyx_r = 0;
7267   goto __pyx_L0;
7268   __pyx_L1_error:;
7269   __Pyx_XDECREF(__pyx_t_1);
7270   __Pyx_XDECREF(__pyx_t_2);
7271   __Pyx_XDECREF(__pyx_t_6);
7272   __Pyx_AddTraceback("pygame._sdl2.video.Window.position.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7273   __pyx_r = -1;
7274   __pyx_L0:;
7275   __Pyx_RefNannyFinishContext();
7276   return __pyx_r;
7277 }
7278 
7279 /* "pygame/_sdl2/video.pyx":489
7280  *
7281  *     @property
7282  *     def opacity(self):             # <<<<<<<<<<<<<<
7283  *         """ Window opacity. It ranges between 0.0 (fully transparent)
7284  *         and 1.0 (fully opaque)."""
7285  */
7286 
7287 /* Python wrapper */
7288 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(PyObject * __pyx_v_self)7289 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(PyObject *__pyx_v_self) {
7290   PyObject *__pyx_r = 0;
7291   __Pyx_RefNannyDeclarations
7292   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7293   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
7294 
7295   /* function exit code */
7296   __Pyx_RefNannyFinishContext();
7297   return __pyx_r;
7298 }
7299 
__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)7300 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
7301   float __pyx_v_opacity;
7302   PyObject *__pyx_r = NULL;
7303   __Pyx_RefNannyDeclarations
7304   int __pyx_t_1;
7305   PyObject *__pyx_t_2 = NULL;
7306   PyObject *__pyx_t_3 = NULL;
7307   PyObject *__pyx_t_4 = NULL;
7308   int __pyx_lineno = 0;
7309   const char *__pyx_filename = NULL;
7310   int __pyx_clineno = 0;
7311   __Pyx_RefNannySetupContext("__get__", 0);
7312 
7313   /* "pygame/_sdl2/video.pyx":493
7314  *         and 1.0 (fully opaque)."""
7315  *         cdef float opacity
7316  *         if SDL_GetWindowOpacity(self._win, &opacity):             # <<<<<<<<<<<<<<
7317  *             raise error()
7318  *         return opacity
7319  */
7320   __pyx_t_1 = (SDL_GetWindowOpacity(__pyx_v_self->_win, (&__pyx_v_opacity)) != 0);
7321   if (unlikely(__pyx_t_1)) {
7322 
7323     /* "pygame/_sdl2/video.pyx":494
7324  *         cdef float opacity
7325  *         if SDL_GetWindowOpacity(self._win, &opacity):
7326  *             raise error()             # <<<<<<<<<<<<<<
7327  *         return opacity
7328  *
7329  */
7330     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error)
7331     __Pyx_GOTREF(__pyx_t_3);
7332     __pyx_t_4 = NULL;
7333     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7334       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7335       if (likely(__pyx_t_4)) {
7336         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7337         __Pyx_INCREF(__pyx_t_4);
7338         __Pyx_INCREF(function);
7339         __Pyx_DECREF_SET(__pyx_t_3, function);
7340       }
7341     }
7342     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7343     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7344     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
7345     __Pyx_GOTREF(__pyx_t_2);
7346     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7347     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7348     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7349     __PYX_ERR(0, 494, __pyx_L1_error)
7350 
7351     /* "pygame/_sdl2/video.pyx":493
7352  *         and 1.0 (fully opaque)."""
7353  *         cdef float opacity
7354  *         if SDL_GetWindowOpacity(self._win, &opacity):             # <<<<<<<<<<<<<<
7355  *             raise error()
7356  *         return opacity
7357  */
7358   }
7359 
7360   /* "pygame/_sdl2/video.pyx":495
7361  *         if SDL_GetWindowOpacity(self._win, &opacity):
7362  *             raise error()
7363  *         return opacity             # <<<<<<<<<<<<<<
7364  *
7365  *     @opacity.setter
7366  */
7367   __Pyx_XDECREF(__pyx_r);
7368   __pyx_t_2 = PyFloat_FromDouble(__pyx_v_opacity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
7369   __Pyx_GOTREF(__pyx_t_2);
7370   __pyx_r = __pyx_t_2;
7371   __pyx_t_2 = 0;
7372   goto __pyx_L0;
7373 
7374   /* "pygame/_sdl2/video.pyx":489
7375  *
7376  *     @property
7377  *     def opacity(self):             # <<<<<<<<<<<<<<
7378  *         """ Window opacity. It ranges between 0.0 (fully transparent)
7379  *         and 1.0 (fully opaque)."""
7380  */
7381 
7382   /* function exit code */
7383   __pyx_L1_error:;
7384   __Pyx_XDECREF(__pyx_t_2);
7385   __Pyx_XDECREF(__pyx_t_3);
7386   __Pyx_XDECREF(__pyx_t_4);
7387   __Pyx_AddTraceback("pygame._sdl2.video.Window.opacity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7388   __pyx_r = NULL;
7389   __pyx_L0:;
7390   __Pyx_XGIVEREF(__pyx_r);
7391   __Pyx_RefNannyFinishContext();
7392   return __pyx_r;
7393 }
7394 
7395 /* "pygame/_sdl2/video.pyx":498
7396  *
7397  *     @opacity.setter
7398  *     def opacity(self, opacity):             # <<<<<<<<<<<<<<
7399  *         if SDL_SetWindowOpacity(self._win, opacity):
7400  *             raise error()
7401  */
7402 
7403 /* Python wrapper */
7404 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_opacity); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_opacity)7405 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_opacity) {
7406   int __pyx_r;
7407   __Pyx_RefNannyDeclarations
7408   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
7409   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v_opacity));
7410 
7411   /* function exit code */
7412   __Pyx_RefNannyFinishContext();
7413   return __pyx_r;
7414 }
7415 
__pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,PyObject * __pyx_v_opacity)7416 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_7opacity_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, PyObject *__pyx_v_opacity) {
7417   int __pyx_r;
7418   __Pyx_RefNannyDeclarations
7419   float __pyx_t_1;
7420   int __pyx_t_2;
7421   PyObject *__pyx_t_3 = NULL;
7422   PyObject *__pyx_t_4 = NULL;
7423   PyObject *__pyx_t_5 = NULL;
7424   int __pyx_lineno = 0;
7425   const char *__pyx_filename = NULL;
7426   int __pyx_clineno = 0;
7427   __Pyx_RefNannySetupContext("__set__", 0);
7428 
7429   /* "pygame/_sdl2/video.pyx":499
7430  *     @opacity.setter
7431  *     def opacity(self, opacity):
7432  *         if SDL_SetWindowOpacity(self._win, opacity):             # <<<<<<<<<<<<<<
7433  *             raise error()
7434  *
7435  */
7436   __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_opacity); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L1_error)
7437   __pyx_t_2 = (SDL_SetWindowOpacity(__pyx_v_self->_win, __pyx_t_1) != 0);
7438   if (unlikely(__pyx_t_2)) {
7439 
7440     /* "pygame/_sdl2/video.pyx":500
7441  *     def opacity(self, opacity):
7442  *         if SDL_SetWindowOpacity(self._win, opacity):
7443  *             raise error()             # <<<<<<<<<<<<<<
7444  *
7445  *     @property
7446  */
7447     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 500, __pyx_L1_error)
7448     __Pyx_GOTREF(__pyx_t_4);
7449     __pyx_t_5 = NULL;
7450     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
7451       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
7452       if (likely(__pyx_t_5)) {
7453         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7454         __Pyx_INCREF(__pyx_t_5);
7455         __Pyx_INCREF(function);
7456         __Pyx_DECREF_SET(__pyx_t_4, function);
7457       }
7458     }
7459     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
7460     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7461     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error)
7462     __Pyx_GOTREF(__pyx_t_3);
7463     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7464     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7465     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7466     __PYX_ERR(0, 500, __pyx_L1_error)
7467 
7468     /* "pygame/_sdl2/video.pyx":499
7469  *     @opacity.setter
7470  *     def opacity(self, opacity):
7471  *         if SDL_SetWindowOpacity(self._win, opacity):             # <<<<<<<<<<<<<<
7472  *             raise error()
7473  *
7474  */
7475   }
7476 
7477   /* "pygame/_sdl2/video.pyx":498
7478  *
7479  *     @opacity.setter
7480  *     def opacity(self, opacity):             # <<<<<<<<<<<<<<
7481  *         if SDL_SetWindowOpacity(self._win, opacity):
7482  *             raise error()
7483  */
7484 
7485   /* function exit code */
7486   __pyx_r = 0;
7487   goto __pyx_L0;
7488   __pyx_L1_error:;
7489   __Pyx_XDECREF(__pyx_t_3);
7490   __Pyx_XDECREF(__pyx_t_4);
7491   __Pyx_XDECREF(__pyx_t_5);
7492   __Pyx_AddTraceback("pygame._sdl2.video.Window.opacity.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7493   __pyx_r = -1;
7494   __pyx_L0:;
7495   __Pyx_RefNannyFinishContext();
7496   return __pyx_r;
7497 }
7498 
7499 /* "pygame/_sdl2/video.pyx":503
7500  *
7501  *     @property
7502  *     def brightness(self):             # <<<<<<<<<<<<<<
7503  *         """ The brightness (gamma multiplier) for the display that owns a given window.
7504  *         0.0 is completely dark and 1.0 is normal brightness."""
7505  */
7506 
7507 /* Python wrapper */
7508 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_1__get__(PyObject * __pyx_v_self)7509 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_1__get__(PyObject *__pyx_v_self) {
7510   PyObject *__pyx_r = 0;
7511   __Pyx_RefNannyDeclarations
7512   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7513   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
7514 
7515   /* function exit code */
7516   __Pyx_RefNannyFinishContext();
7517   return __pyx_r;
7518 }
7519 
__pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)7520 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
7521   PyObject *__pyx_r = NULL;
7522   __Pyx_RefNannyDeclarations
7523   PyObject *__pyx_t_1 = NULL;
7524   int __pyx_lineno = 0;
7525   const char *__pyx_filename = NULL;
7526   int __pyx_clineno = 0;
7527   __Pyx_RefNannySetupContext("__get__", 0);
7528 
7529   /* "pygame/_sdl2/video.pyx":506
7530  *         """ The brightness (gamma multiplier) for the display that owns a given window.
7531  *         0.0 is completely dark and 1.0 is normal brightness."""
7532  *         return SDL_GetWindowBrightness(self._win)             # <<<<<<<<<<<<<<
7533  *
7534  *     @brightness.setter
7535  */
7536   __Pyx_XDECREF(__pyx_r);
7537   __pyx_t_1 = PyFloat_FromDouble(SDL_GetWindowBrightness(__pyx_v_self->_win)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
7538   __Pyx_GOTREF(__pyx_t_1);
7539   __pyx_r = __pyx_t_1;
7540   __pyx_t_1 = 0;
7541   goto __pyx_L0;
7542 
7543   /* "pygame/_sdl2/video.pyx":503
7544  *
7545  *     @property
7546  *     def brightness(self):             # <<<<<<<<<<<<<<
7547  *         """ The brightness (gamma multiplier) for the display that owns a given window.
7548  *         0.0 is completely dark and 1.0 is normal brightness."""
7549  */
7550 
7551   /* function exit code */
7552   __pyx_L1_error:;
7553   __Pyx_XDECREF(__pyx_t_1);
7554   __Pyx_AddTraceback("pygame._sdl2.video.Window.brightness.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7555   __pyx_r = NULL;
7556   __pyx_L0:;
7557   __Pyx_XGIVEREF(__pyx_r);
7558   __Pyx_RefNannyFinishContext();
7559   return __pyx_r;
7560 }
7561 
7562 /* "pygame/_sdl2/video.pyx":509
7563  *
7564  *     @brightness.setter
7565  *     def brightness(self, float value):             # <<<<<<<<<<<<<<
7566  *         if SDL_SetWindowBrightness(self._win, value):
7567  *             raise error()
7568  */
7569 
7570 /* Python wrapper */
7571 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_arg_value)7572 static int __pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
7573   float __pyx_v_value;
7574   int __pyx_lineno = 0;
7575   const char *__pyx_filename = NULL;
7576   int __pyx_clineno = 0;
7577   int __pyx_r;
7578   __Pyx_RefNannyDeclarations
7579   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
7580   assert(__pyx_arg_value); {
7581     __pyx_v_value = __pyx_PyFloat_AsFloat(__pyx_arg_value); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L3_error)
7582   }
7583   goto __pyx_L4_argument_unpacking_done;
7584   __pyx_L3_error:;
7585   __Pyx_AddTraceback("pygame._sdl2.video.Window.brightness.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7586   __Pyx_RefNannyFinishContext();
7587   return -1;
7588   __pyx_L4_argument_unpacking_done:;
7589   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((float)__pyx_v_value));
7590 
7591   /* function exit code */
7592   __Pyx_RefNannyFinishContext();
7593   return __pyx_r;
7594 }
7595 
__pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,float __pyx_v_value)7596 static int __pyx_pf_6pygame_5_sdl2_5video_6Window_10brightness_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, float __pyx_v_value) {
7597   int __pyx_r;
7598   __Pyx_RefNannyDeclarations
7599   int __pyx_t_1;
7600   PyObject *__pyx_t_2 = NULL;
7601   PyObject *__pyx_t_3 = NULL;
7602   PyObject *__pyx_t_4 = NULL;
7603   int __pyx_lineno = 0;
7604   const char *__pyx_filename = NULL;
7605   int __pyx_clineno = 0;
7606   __Pyx_RefNannySetupContext("__set__", 0);
7607 
7608   /* "pygame/_sdl2/video.pyx":510
7609  *     @brightness.setter
7610  *     def brightness(self, float value):
7611  *         if SDL_SetWindowBrightness(self._win, value):             # <<<<<<<<<<<<<<
7612  *             raise error()
7613  *
7614  */
7615   __pyx_t_1 = (SDL_SetWindowBrightness(__pyx_v_self->_win, __pyx_v_value) != 0);
7616   if (unlikely(__pyx_t_1)) {
7617 
7618     /* "pygame/_sdl2/video.pyx":511
7619  *     def brightness(self, float value):
7620  *         if SDL_SetWindowBrightness(self._win, value):
7621  *             raise error()             # <<<<<<<<<<<<<<
7622  *
7623  *     @property
7624  */
7625     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error)
7626     __Pyx_GOTREF(__pyx_t_3);
7627     __pyx_t_4 = NULL;
7628     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7629       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7630       if (likely(__pyx_t_4)) {
7631         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7632         __Pyx_INCREF(__pyx_t_4);
7633         __Pyx_INCREF(function);
7634         __Pyx_DECREF_SET(__pyx_t_3, function);
7635       }
7636     }
7637     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7638     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7639     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
7640     __Pyx_GOTREF(__pyx_t_2);
7641     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7642     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7643     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7644     __PYX_ERR(0, 511, __pyx_L1_error)
7645 
7646     /* "pygame/_sdl2/video.pyx":510
7647  *     @brightness.setter
7648  *     def brightness(self, float value):
7649  *         if SDL_SetWindowBrightness(self._win, value):             # <<<<<<<<<<<<<<
7650  *             raise error()
7651  *
7652  */
7653   }
7654 
7655   /* "pygame/_sdl2/video.pyx":509
7656  *
7657  *     @brightness.setter
7658  *     def brightness(self, float value):             # <<<<<<<<<<<<<<
7659  *         if SDL_SetWindowBrightness(self._win, value):
7660  *             raise error()
7661  */
7662 
7663   /* function exit code */
7664   __pyx_r = 0;
7665   goto __pyx_L0;
7666   __pyx_L1_error:;
7667   __Pyx_XDECREF(__pyx_t_2);
7668   __Pyx_XDECREF(__pyx_t_3);
7669   __Pyx_XDECREF(__pyx_t_4);
7670   __Pyx_AddTraceback("pygame._sdl2.video.Window.brightness.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7671   __pyx_r = -1;
7672   __pyx_L0:;
7673   __Pyx_RefNannyFinishContext();
7674   return __pyx_r;
7675 }
7676 
7677 /* "pygame/_sdl2/video.pyx":514
7678  *
7679  *     @property
7680  *     def display_index(self):             # <<<<<<<<<<<<<<
7681  *         """ The index of the display associated with the window. *Read-only*.
7682  *
7683  */
7684 
7685 /* Python wrapper */
7686 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(PyObject * __pyx_v_self)7687 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(PyObject *__pyx_v_self) {
7688   PyObject *__pyx_r = 0;
7689   __Pyx_RefNannyDeclarations
7690   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
7691   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
7692 
7693   /* function exit code */
7694   __Pyx_RefNannyFinishContext();
7695   return __pyx_r;
7696 }
7697 
__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)7698 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_13display_index___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
7699   int __pyx_v_index;
7700   PyObject *__pyx_r = NULL;
7701   __Pyx_RefNannyDeclarations
7702   int __pyx_t_1;
7703   PyObject *__pyx_t_2 = NULL;
7704   PyObject *__pyx_t_3 = NULL;
7705   PyObject *__pyx_t_4 = NULL;
7706   int __pyx_lineno = 0;
7707   const char *__pyx_filename = NULL;
7708   int __pyx_clineno = 0;
7709   __Pyx_RefNannySetupContext("__get__", 0);
7710 
7711   /* "pygame/_sdl2/video.pyx":519
7712  *         :rtype: int
7713  *         """
7714  *         cdef int index = SDL_GetWindowDisplayIndex(self._win)             # <<<<<<<<<<<<<<
7715  *         if index < 0:
7716  *             raise error()
7717  */
7718   __pyx_v_index = SDL_GetWindowDisplayIndex(__pyx_v_self->_win);
7719 
7720   /* "pygame/_sdl2/video.pyx":520
7721  *         """
7722  *         cdef int index = SDL_GetWindowDisplayIndex(self._win)
7723  *         if index < 0:             # <<<<<<<<<<<<<<
7724  *             raise error()
7725  *         return index
7726  */
7727   __pyx_t_1 = ((__pyx_v_index < 0) != 0);
7728   if (unlikely(__pyx_t_1)) {
7729 
7730     /* "pygame/_sdl2/video.pyx":521
7731  *         cdef int index = SDL_GetWindowDisplayIndex(self._win)
7732  *         if index < 0:
7733  *             raise error()             # <<<<<<<<<<<<<<
7734  *         return index
7735  *
7736  */
7737     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error)
7738     __Pyx_GOTREF(__pyx_t_3);
7739     __pyx_t_4 = NULL;
7740     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7741       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7742       if (likely(__pyx_t_4)) {
7743         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7744         __Pyx_INCREF(__pyx_t_4);
7745         __Pyx_INCREF(function);
7746         __Pyx_DECREF_SET(__pyx_t_3, function);
7747       }
7748     }
7749     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7750     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7751     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error)
7752     __Pyx_GOTREF(__pyx_t_2);
7753     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7754     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7755     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7756     __PYX_ERR(0, 521, __pyx_L1_error)
7757 
7758     /* "pygame/_sdl2/video.pyx":520
7759  *         """
7760  *         cdef int index = SDL_GetWindowDisplayIndex(self._win)
7761  *         if index < 0:             # <<<<<<<<<<<<<<
7762  *             raise error()
7763  *         return index
7764  */
7765   }
7766 
7767   /* "pygame/_sdl2/video.pyx":522
7768  *         if index < 0:
7769  *             raise error()
7770  *         return index             # <<<<<<<<<<<<<<
7771  *
7772  *     def set_modal_for(self, Window parent):
7773  */
7774   __Pyx_XDECREF(__pyx_r);
7775   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
7776   __Pyx_GOTREF(__pyx_t_2);
7777   __pyx_r = __pyx_t_2;
7778   __pyx_t_2 = 0;
7779   goto __pyx_L0;
7780 
7781   /* "pygame/_sdl2/video.pyx":514
7782  *
7783  *     @property
7784  *     def display_index(self):             # <<<<<<<<<<<<<<
7785  *         """ The index of the display associated with the window. *Read-only*.
7786  *
7787  */
7788 
7789   /* function exit code */
7790   __pyx_L1_error:;
7791   __Pyx_XDECREF(__pyx_t_2);
7792   __Pyx_XDECREF(__pyx_t_3);
7793   __Pyx_XDECREF(__pyx_t_4);
7794   __Pyx_AddTraceback("pygame._sdl2.video.Window.display_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7795   __pyx_r = NULL;
7796   __pyx_L0:;
7797   __Pyx_XGIVEREF(__pyx_r);
7798   __Pyx_RefNannyFinishContext();
7799   return __pyx_r;
7800 }
7801 
7802 /* "pygame/_sdl2/video.pyx":524
7803  *         return index
7804  *
7805  *     def set_modal_for(self, Window parent):             # <<<<<<<<<<<<<<
7806  *         """set the window as a modal for a parent window
7807  *         This function is only supported on X11."""
7808  */
7809 
7810 /* Python wrapper */
7811 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
7812 static char __pyx_doc_6pygame_5_sdl2_5video_6Window_24set_modal_for[] = "set the window as a modal for a parent window\n        This function is only supported on X11.";
__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for(PyObject * __pyx_v_self,PyObject * __pyx_v_parent)7813 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
7814   int __pyx_lineno = 0;
7815   const char *__pyx_filename = NULL;
7816   int __pyx_clineno = 0;
7817   PyObject *__pyx_r = 0;
7818   __Pyx_RefNannyDeclarations
7819   __Pyx_RefNannySetupContext("set_modal_for (wrapper)", 0);
7820   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "parent", 0))) __PYX_ERR(0, 524, __pyx_L1_error)
7821   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_parent));
7822 
7823   /* function exit code */
7824   goto __pyx_L0;
7825   __pyx_L1_error:;
7826   __pyx_r = NULL;
7827   __pyx_L0:;
7828   __Pyx_RefNannyFinishContext();
7829   return __pyx_r;
7830 }
7831 
__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_parent)7832 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_24set_modal_for(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_parent) {
7833   PyObject *__pyx_r = NULL;
7834   __Pyx_RefNannyDeclarations
7835   int __pyx_t_1;
7836   PyObject *__pyx_t_2 = NULL;
7837   PyObject *__pyx_t_3 = NULL;
7838   PyObject *__pyx_t_4 = NULL;
7839   int __pyx_lineno = 0;
7840   const char *__pyx_filename = NULL;
7841   int __pyx_clineno = 0;
7842   __Pyx_RefNannySetupContext("set_modal_for", 0);
7843 
7844   /* "pygame/_sdl2/video.pyx":527
7845  *         """set the window as a modal for a parent window
7846  *         This function is only supported on X11."""
7847  *         if SDL_SetWindowModalFor(self._win, parent._win):             # <<<<<<<<<<<<<<
7848  *             raise error()
7849  *
7850  */
7851   __pyx_t_1 = (SDL_SetWindowModalFor(__pyx_v_self->_win, __pyx_v_parent->_win) != 0);
7852   if (unlikely(__pyx_t_1)) {
7853 
7854     /* "pygame/_sdl2/video.pyx":528
7855  *         This function is only supported on X11."""
7856  *         if SDL_SetWindowModalFor(self._win, parent._win):
7857  *             raise error()             # <<<<<<<<<<<<<<
7858  *
7859  *     def __dealloc__(self):
7860  */
7861     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
7862     __Pyx_GOTREF(__pyx_t_3);
7863     __pyx_t_4 = NULL;
7864     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7865       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7866       if (likely(__pyx_t_4)) {
7867         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7868         __Pyx_INCREF(__pyx_t_4);
7869         __Pyx_INCREF(function);
7870         __Pyx_DECREF_SET(__pyx_t_3, function);
7871       }
7872     }
7873     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7874     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7875     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error)
7876     __Pyx_GOTREF(__pyx_t_2);
7877     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7878     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7879     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7880     __PYX_ERR(0, 528, __pyx_L1_error)
7881 
7882     /* "pygame/_sdl2/video.pyx":527
7883  *         """set the window as a modal for a parent window
7884  *         This function is only supported on X11."""
7885  *         if SDL_SetWindowModalFor(self._win, parent._win):             # <<<<<<<<<<<<<<
7886  *             raise error()
7887  *
7888  */
7889   }
7890 
7891   /* "pygame/_sdl2/video.pyx":524
7892  *         return index
7893  *
7894  *     def set_modal_for(self, Window parent):             # <<<<<<<<<<<<<<
7895  *         """set the window as a modal for a parent window
7896  *         This function is only supported on X11."""
7897  */
7898 
7899   /* function exit code */
7900   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7901   goto __pyx_L0;
7902   __pyx_L1_error:;
7903   __Pyx_XDECREF(__pyx_t_2);
7904   __Pyx_XDECREF(__pyx_t_3);
7905   __Pyx_XDECREF(__pyx_t_4);
7906   __Pyx_AddTraceback("pygame._sdl2.video.Window.set_modal_for", __pyx_clineno, __pyx_lineno, __pyx_filename);
7907   __pyx_r = NULL;
7908   __pyx_L0:;
7909   __Pyx_XGIVEREF(__pyx_r);
7910   __Pyx_RefNannyFinishContext();
7911   return __pyx_r;
7912 }
7913 
7914 /* "pygame/_sdl2/video.pyx":530
7915  *             raise error()
7916  *
7917  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
7918  *         if self._is_borrowed:
7919  *             return
7920  */
7921 
7922 /* Python wrapper */
7923 static void __pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(PyObject * __pyx_v_self)7924 static void __pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(PyObject *__pyx_v_self) {
7925   __Pyx_RefNannyDeclarations
7926   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7927   __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
7928 
7929   /* function exit code */
7930   __Pyx_RefNannyFinishContext();
7931 }
7932 
__pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)7933 static void __pyx_pf_6pygame_5_sdl2_5video_6Window_26__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
7934   __Pyx_RefNannyDeclarations
7935   int __pyx_t_1;
7936   PyObject *__pyx_t_2 = NULL;
7937   PyObject *__pyx_t_3 = NULL;
7938   PyObject *__pyx_t_4 = NULL;
7939   int __pyx_lineno = 0;
7940   const char *__pyx_filename = NULL;
7941   int __pyx_clineno = 0;
7942   __Pyx_RefNannySetupContext("__dealloc__", 0);
7943 
7944   /* "pygame/_sdl2/video.pyx":531
7945  *
7946  *     def __dealloc__(self):
7947  *         if self._is_borrowed:             # <<<<<<<<<<<<<<
7948  *             return
7949  *         self.destroy()
7950  */
7951   __pyx_t_1 = (__pyx_v_self->_is_borrowed != 0);
7952   if (__pyx_t_1) {
7953 
7954     /* "pygame/_sdl2/video.pyx":532
7955  *     def __dealloc__(self):
7956  *         if self._is_borrowed:
7957  *             return             # <<<<<<<<<<<<<<
7958  *         self.destroy()
7959  *
7960  */
7961     goto __pyx_L0;
7962 
7963     /* "pygame/_sdl2/video.pyx":531
7964  *
7965  *     def __dealloc__(self):
7966  *         if self._is_borrowed:             # <<<<<<<<<<<<<<
7967  *             return
7968  *         self.destroy()
7969  */
7970   }
7971 
7972   /* "pygame/_sdl2/video.pyx":533
7973  *         if self._is_borrowed:
7974  *             return
7975  *         self.destroy()             # <<<<<<<<<<<<<<
7976  *
7977  * cdef Uint32 format_from_depth(int depth):
7978  */
7979   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 533, __pyx_L1_error)
7980   __Pyx_GOTREF(__pyx_t_3);
7981   __pyx_t_4 = NULL;
7982   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7983     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7984     if (likely(__pyx_t_4)) {
7985       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7986       __Pyx_INCREF(__pyx_t_4);
7987       __Pyx_INCREF(function);
7988       __Pyx_DECREF_SET(__pyx_t_3, function);
7989     }
7990   }
7991   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
7992   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7993   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
7994   __Pyx_GOTREF(__pyx_t_2);
7995   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7996   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7997 
7998   /* "pygame/_sdl2/video.pyx":530
7999  *             raise error()
8000  *
8001  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
8002  *         if self._is_borrowed:
8003  *             return
8004  */
8005 
8006   /* function exit code */
8007   goto __pyx_L0;
8008   __pyx_L1_error:;
8009   __Pyx_XDECREF(__pyx_t_2);
8010   __Pyx_XDECREF(__pyx_t_3);
8011   __Pyx_XDECREF(__pyx_t_4);
8012   __Pyx_WriteUnraisable("pygame._sdl2.video.Window.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
8013   __pyx_L0:;
8014   __Pyx_RefNannyFinishContext();
8015 }
8016 
8017 /* "(tree fragment)":1
8018  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8019  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8020  * def __setstate_cython__(self, __pyx_state):
8021  */
8022 
8023 /* Python wrapper */
8024 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8025 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8026   PyObject *__pyx_r = 0;
8027   __Pyx_RefNannyDeclarations
8028   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8029   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self));
8030 
8031   /* function exit code */
8032   __Pyx_RefNannyFinishContext();
8033   return __pyx_r;
8034 }
8035 
__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self)8036 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self) {
8037   PyObject *__pyx_r = NULL;
8038   __Pyx_RefNannyDeclarations
8039   PyObject *__pyx_t_1 = NULL;
8040   int __pyx_lineno = 0;
8041   const char *__pyx_filename = NULL;
8042   int __pyx_clineno = 0;
8043   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8044 
8045   /* "(tree fragment)":2
8046  * def __reduce_cython__(self):
8047  *     raise TypeError("self._win cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
8048  * def __setstate_cython__(self, __pyx_state):
8049  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8050  */
8051   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8052   __Pyx_GOTREF(__pyx_t_1);
8053   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8054   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8055   __PYX_ERR(1, 2, __pyx_L1_error)
8056 
8057   /* "(tree fragment)":1
8058  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8059  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8060  * def __setstate_cython__(self, __pyx_state):
8061  */
8062 
8063   /* function exit code */
8064   __pyx_L1_error:;
8065   __Pyx_XDECREF(__pyx_t_1);
8066   __Pyx_AddTraceback("pygame._sdl2.video.Window.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8067   __pyx_r = NULL;
8068   __Pyx_XGIVEREF(__pyx_r);
8069   __Pyx_RefNannyFinishContext();
8070   return __pyx_r;
8071 }
8072 
8073 /* "(tree fragment)":3
8074  * def __reduce_cython__(self):
8075  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8076  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8077  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8078  */
8079 
8080 /* Python wrapper */
8081 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8082 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8083   PyObject *__pyx_r = 0;
8084   __Pyx_RefNannyDeclarations
8085   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8086   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8087 
8088   /* function exit code */
8089   __Pyx_RefNannyFinishContext();
8090   return __pyx_r;
8091 }
8092 
__pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8093 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_6Window_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8094   PyObject *__pyx_r = NULL;
8095   __Pyx_RefNannyDeclarations
8096   PyObject *__pyx_t_1 = NULL;
8097   int __pyx_lineno = 0;
8098   const char *__pyx_filename = NULL;
8099   int __pyx_clineno = 0;
8100   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8101 
8102   /* "(tree fragment)":4
8103  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8104  * def __setstate_cython__(self, __pyx_state):
8105  *     raise TypeError("self._win cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
8106  */
8107   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8108   __Pyx_GOTREF(__pyx_t_1);
8109   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8110   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8111   __PYX_ERR(1, 4, __pyx_L1_error)
8112 
8113   /* "(tree fragment)":3
8114  * def __reduce_cython__(self):
8115  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8116  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8117  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
8118  */
8119 
8120   /* function exit code */
8121   __pyx_L1_error:;
8122   __Pyx_XDECREF(__pyx_t_1);
8123   __Pyx_AddTraceback("pygame._sdl2.video.Window.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8124   __pyx_r = NULL;
8125   __Pyx_XGIVEREF(__pyx_r);
8126   __Pyx_RefNannyFinishContext();
8127   return __pyx_r;
8128 }
8129 
8130 /* "pygame/_sdl2/video.pyx":535
8131  *         self.destroy()
8132  *
8133  * cdef Uint32 format_from_depth(int depth):             # <<<<<<<<<<<<<<
8134  *     cdef Uint32 Rmask, Gmask, Bmask, Amask
8135  *     if depth == 16:
8136  */
8137 
__pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth)8138 static Uint32 __pyx_f_6pygame_5_sdl2_5video_format_from_depth(int __pyx_v_depth) {
8139   Uint32 __pyx_v_Rmask;
8140   Uint32 __pyx_v_Gmask;
8141   Uint32 __pyx_v_Bmask;
8142   Uint32 __pyx_v_Amask;
8143   Uint32 __pyx_r;
8144   __Pyx_RefNannyDeclarations
8145   PyObject *__pyx_t_1 = NULL;
8146   int __pyx_lineno = 0;
8147   const char *__pyx_filename = NULL;
8148   int __pyx_clineno = 0;
8149   __Pyx_RefNannySetupContext("format_from_depth", 0);
8150 
8151   /* "pygame/_sdl2/video.pyx":537
8152  * cdef Uint32 format_from_depth(int depth):
8153  *     cdef Uint32 Rmask, Gmask, Bmask, Amask
8154  *     if depth == 16:             # <<<<<<<<<<<<<<
8155  *         Rmask = 0xF << 8
8156  *         Gmask = 0xF << 4
8157  */
8158   switch (__pyx_v_depth) {
8159     case 16:
8160 
8161     /* "pygame/_sdl2/video.pyx":538
8162  *     cdef Uint32 Rmask, Gmask, Bmask, Amask
8163  *     if depth == 16:
8164  *         Rmask = 0xF << 8             # <<<<<<<<<<<<<<
8165  *         Gmask = 0xF << 4
8166  *         Bmask = 0xF
8167  */
8168     __pyx_v_Rmask = 0xF00;
8169 
8170     /* "pygame/_sdl2/video.pyx":539
8171  *     if depth == 16:
8172  *         Rmask = 0xF << 8
8173  *         Gmask = 0xF << 4             # <<<<<<<<<<<<<<
8174  *         Bmask = 0xF
8175  *         Amask = 0xF << 12
8176  */
8177     __pyx_v_Gmask = 0xF0;
8178 
8179     /* "pygame/_sdl2/video.pyx":540
8180  *         Rmask = 0xF << 8
8181  *         Gmask = 0xF << 4
8182  *         Bmask = 0xF             # <<<<<<<<<<<<<<
8183  *         Amask = 0xF << 12
8184  *     elif depth in (0, 32):
8185  */
8186     __pyx_v_Bmask = 0xF;
8187 
8188     /* "pygame/_sdl2/video.pyx":541
8189  *         Gmask = 0xF << 4
8190  *         Bmask = 0xF
8191  *         Amask = 0xF << 12             # <<<<<<<<<<<<<<
8192  *     elif depth in (0, 32):
8193  *         Rmask = 0xFF << 16
8194  */
8195     __pyx_v_Amask = 0xF000;
8196 
8197     /* "pygame/_sdl2/video.pyx":537
8198  * cdef Uint32 format_from_depth(int depth):
8199  *     cdef Uint32 Rmask, Gmask, Bmask, Amask
8200  *     if depth == 16:             # <<<<<<<<<<<<<<
8201  *         Rmask = 0xF << 8
8202  *         Gmask = 0xF << 4
8203  */
8204     break;
8205     case 0:
8206 
8207     /* "pygame/_sdl2/video.pyx":542
8208  *         Bmask = 0xF
8209  *         Amask = 0xF << 12
8210  *     elif depth in (0, 32):             # <<<<<<<<<<<<<<
8211  *         Rmask = 0xFF << 16
8212  *         Gmask = 0xFF << 8
8213  */
8214     case 32:
8215 
8216     /* "pygame/_sdl2/video.pyx":543
8217  *         Amask = 0xF << 12
8218  *     elif depth in (0, 32):
8219  *         Rmask = 0xFF << 16             # <<<<<<<<<<<<<<
8220  *         Gmask = 0xFF << 8
8221  *         Bmask = 0xFF
8222  */
8223     __pyx_v_Rmask = 0xFF0000;
8224 
8225     /* "pygame/_sdl2/video.pyx":544
8226  *     elif depth in (0, 32):
8227  *         Rmask = 0xFF << 16
8228  *         Gmask = 0xFF << 8             # <<<<<<<<<<<<<<
8229  *         Bmask = 0xFF
8230  *         Amask = 0xFF << 24
8231  */
8232     __pyx_v_Gmask = 0xFF00;
8233 
8234     /* "pygame/_sdl2/video.pyx":545
8235  *         Rmask = 0xFF << 16
8236  *         Gmask = 0xFF << 8
8237  *         Bmask = 0xFF             # <<<<<<<<<<<<<<
8238  *         Amask = 0xFF << 24
8239  *     else:
8240  */
8241     __pyx_v_Bmask = 0xFF;
8242 
8243     /* "pygame/_sdl2/video.pyx":546
8244  *         Gmask = 0xFF << 8
8245  *         Bmask = 0xFF
8246  *         Amask = 0xFF << 24             # <<<<<<<<<<<<<<
8247  *     else:
8248  *         raise ValueError("no standard masks exist for given bitdepth with alpha")
8249  */
8250     __pyx_v_Amask = 0xFF000000;
8251 
8252     /* "pygame/_sdl2/video.pyx":542
8253  *         Bmask = 0xF
8254  *         Amask = 0xF << 12
8255  *     elif depth in (0, 32):             # <<<<<<<<<<<<<<
8256  *         Rmask = 0xFF << 16
8257  *         Gmask = 0xFF << 8
8258  */
8259     break;
8260     default:
8261 
8262     /* "pygame/_sdl2/video.pyx":548
8263  *         Amask = 0xFF << 24
8264  *     else:
8265  *         raise ValueError("no standard masks exist for given bitdepth with alpha")             # <<<<<<<<<<<<<<
8266  *     return SDL_MasksToPixelFormatEnum(depth,
8267  *                                       Rmask, Gmask, Bmask, Amask)
8268  */
8269     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
8270     __Pyx_GOTREF(__pyx_t_1);
8271     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8272     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8273     __PYX_ERR(0, 548, __pyx_L1_error)
8274     break;
8275   }
8276 
8277   /* "pygame/_sdl2/video.pyx":549
8278  *     else:
8279  *         raise ValueError("no standard masks exist for given bitdepth with alpha")
8280  *     return SDL_MasksToPixelFormatEnum(depth,             # <<<<<<<<<<<<<<
8281  *                                       Rmask, Gmask, Bmask, Amask)
8282  *
8283  */
8284   __pyx_r = SDL_MasksToPixelFormatEnum(__pyx_v_depth, __pyx_v_Rmask, __pyx_v_Gmask, __pyx_v_Bmask, __pyx_v_Amask);
8285   goto __pyx_L0;
8286 
8287   /* "pygame/_sdl2/video.pyx":535
8288  *         self.destroy()
8289  *
8290  * cdef Uint32 format_from_depth(int depth):             # <<<<<<<<<<<<<<
8291  *     cdef Uint32 Rmask, Gmask, Bmask, Amask
8292  *     if depth == 16:
8293  */
8294 
8295   /* function exit code */
8296   __pyx_L1_error:;
8297   __Pyx_XDECREF(__pyx_t_1);
8298   __Pyx_WriteUnraisable("pygame._sdl2.video.format_from_depth", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
8299   __pyx_r = 0;
8300   __pyx_L0:;
8301   __Pyx_RefNannyFinishContext();
8302   return __pyx_r;
8303 }
8304 
8305 /* "pygame/_sdl2/video.pyx":554
8306  *
8307  * cdef class Texture:
8308  *     def __cinit__(self):             # <<<<<<<<<<<<<<
8309  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
8310  *         self._color = pgColor_NewLength(defaultColor, 3)
8311  */
8312 
8313 /* Python wrapper */
8314 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8315 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8316   int __pyx_r;
8317   __Pyx_RefNannyDeclarations
8318   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
8319   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
8320     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
8321   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
8322   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
8323 
8324   /* function exit code */
8325   __Pyx_RefNannyFinishContext();
8326   return __pyx_r;
8327 }
8328 
__pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)8329 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
8330   Uint8 __pyx_v_defaultColor[4];
8331   int __pyx_r;
8332   __Pyx_RefNannyDeclarations
8333   Uint8 __pyx_t_1[4];
8334   PyObject *__pyx_t_2 = NULL;
8335   int __pyx_lineno = 0;
8336   const char *__pyx_filename = NULL;
8337   int __pyx_clineno = 0;
8338   __Pyx_RefNannySetupContext("__cinit__", 0);
8339 
8340   /* "pygame/_sdl2/video.pyx":555
8341  * cdef class Texture:
8342  *     def __cinit__(self):
8343  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]             # <<<<<<<<<<<<<<
8344  *         self._color = pgColor_NewLength(defaultColor, 3)
8345  *
8346  */
8347   __pyx_t_1[0] = 0xFF;
8348   __pyx_t_1[1] = 0xFF;
8349   __pyx_t_1[2] = 0xFF;
8350   __pyx_t_1[3] = 0xFF;
8351   memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_1, sizeof(__pyx_v_defaultColor[0]) * (4));
8352 
8353   /* "pygame/_sdl2/video.pyx":556
8354  *     def __cinit__(self):
8355  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
8356  *         self._color = pgColor_NewLength(defaultColor, 3)             # <<<<<<<<<<<<<<
8357  *
8358  *     def __init__(self,
8359  */
8360   __pyx_t_2 = pgColor_NewLength(__pyx_v_defaultColor, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error)
8361   __Pyx_GOTREF(__pyx_t_2);
8362   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 556, __pyx_L1_error)
8363   __Pyx_GIVEREF(__pyx_t_2);
8364   __Pyx_GOTREF(__pyx_v_self->_color);
8365   __Pyx_DECREF(((PyObject *)__pyx_v_self->_color));
8366   __pyx_v_self->_color = ((pgColorObject *)__pyx_t_2);
8367   __pyx_t_2 = 0;
8368 
8369   /* "pygame/_sdl2/video.pyx":554
8370  *
8371  * cdef class Texture:
8372  *     def __cinit__(self):             # <<<<<<<<<<<<<<
8373  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
8374  *         self._color = pgColor_NewLength(defaultColor, 3)
8375  */
8376 
8377   /* function exit code */
8378   __pyx_r = 0;
8379   goto __pyx_L0;
8380   __pyx_L1_error:;
8381   __Pyx_XDECREF(__pyx_t_2);
8382   __Pyx_AddTraceback("pygame._sdl2.video.Texture.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8383   __pyx_r = -1;
8384   __pyx_L0:;
8385   __Pyx_RefNannyFinishContext();
8386   return __pyx_r;
8387 }
8388 
8389 /* "pygame/_sdl2/video.pyx":558
8390  *         self._color = pgColor_NewLength(defaultColor, 3)
8391  *
8392  *     def __init__(self,             # <<<<<<<<<<<<<<
8393  *                  Renderer renderer,
8394  *                  size, int depth=0,
8395  */
8396 
8397 /* Python wrapper */
8398 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8399 static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_2__init__[] = " Create an empty texture.\n\n        :param Renderer renderer: Rendering context for the texture.\n        :param tuple size: The width and height of the texture.\n        :param int depth: The pixel format (0 to use the default).\n\n        One of ``static``, ``streaming``, or ``target`` can be set\n        to ``True``. If all are ``False``, then ``static`` is used.\n\n        :param bool static: Changes rarely, not lockable.\n        :param bool streaming: Changes frequently, lockable.\n        :param bool target: Can be used as a render target.\n        ";
8400 #if CYTHON_COMPILING_IN_CPYTHON
8401 struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__;
8402 #endif
__pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8403 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8404   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer = 0;
8405   PyObject *__pyx_v_size = 0;
8406   int __pyx_v_depth;
8407   PyObject *__pyx_v_static = 0;
8408   PyObject *__pyx_v_streaming = 0;
8409   PyObject *__pyx_v_target = 0;
8410   int __pyx_lineno = 0;
8411   const char *__pyx_filename = NULL;
8412   int __pyx_clineno = 0;
8413   int __pyx_r;
8414   __Pyx_RefNannyDeclarations
8415   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8416   {
8417     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_renderer,&__pyx_n_s_size,&__pyx_n_s_depth,&__pyx_n_s_static,&__pyx_n_s_streaming,&__pyx_n_s_target,0};
8418     PyObject* values[6] = {0,0,0,0,0,0};
8419 
8420     /* "pygame/_sdl2/video.pyx":561
8421  *                  Renderer renderer,
8422  *                  size, int depth=0,
8423  *                  static=False, streaming=False,             # <<<<<<<<<<<<<<
8424  *                  target=False):
8425  *         """ Create an empty texture.
8426  */
8427     values[3] = ((PyObject *)Py_False);
8428     values[4] = ((PyObject *)Py_False);
8429 
8430     /* "pygame/_sdl2/video.pyx":562
8431  *                  size, int depth=0,
8432  *                  static=False, streaming=False,
8433  *                  target=False):             # <<<<<<<<<<<<<<
8434  *         """ Create an empty texture.
8435  *
8436  */
8437     values[5] = ((PyObject *)Py_False);
8438     if (unlikely(__pyx_kwds)) {
8439       Py_ssize_t kw_args;
8440       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8441       switch (pos_args) {
8442         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8443         CYTHON_FALLTHROUGH;
8444         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8445         CYTHON_FALLTHROUGH;
8446         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8447         CYTHON_FALLTHROUGH;
8448         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8449         CYTHON_FALLTHROUGH;
8450         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8451         CYTHON_FALLTHROUGH;
8452         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8453         CYTHON_FALLTHROUGH;
8454         case  0: break;
8455         default: goto __pyx_L5_argtuple_error;
8456       }
8457       kw_args = PyDict_Size(__pyx_kwds);
8458       switch (pos_args) {
8459         case  0:
8460         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_renderer)) != 0)) kw_args--;
8461         else goto __pyx_L5_argtuple_error;
8462         CYTHON_FALLTHROUGH;
8463         case  1:
8464         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
8465         else {
8466           __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 6, 1); __PYX_ERR(0, 558, __pyx_L3_error)
8467         }
8468         CYTHON_FALLTHROUGH;
8469         case  2:
8470         if (kw_args > 0) {
8471           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_depth);
8472           if (value) { values[2] = value; kw_args--; }
8473         }
8474         CYTHON_FALLTHROUGH;
8475         case  3:
8476         if (kw_args > 0) {
8477           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_static);
8478           if (value) { values[3] = value; kw_args--; }
8479         }
8480         CYTHON_FALLTHROUGH;
8481         case  4:
8482         if (kw_args > 0) {
8483           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_streaming);
8484           if (value) { values[4] = value; kw_args--; }
8485         }
8486         CYTHON_FALLTHROUGH;
8487         case  5:
8488         if (kw_args > 0) {
8489           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target);
8490           if (value) { values[5] = value; kw_args--; }
8491         }
8492       }
8493       if (unlikely(kw_args > 0)) {
8494         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 558, __pyx_L3_error)
8495       }
8496     } else {
8497       switch (PyTuple_GET_SIZE(__pyx_args)) {
8498         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8499         CYTHON_FALLTHROUGH;
8500         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8501         CYTHON_FALLTHROUGH;
8502         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8503         CYTHON_FALLTHROUGH;
8504         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8505         CYTHON_FALLTHROUGH;
8506         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8507         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8508         break;
8509         default: goto __pyx_L5_argtuple_error;
8510       }
8511     }
8512     __pyx_v_renderer = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)values[0]);
8513     __pyx_v_size = values[1];
8514     if (values[2]) {
8515       __pyx_v_depth = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_depth == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L3_error)
8516     } else {
8517       __pyx_v_depth = ((int)0);
8518     }
8519     __pyx_v_static = values[3];
8520     __pyx_v_streaming = values[4];
8521     __pyx_v_target = values[5];
8522   }
8523   goto __pyx_L4_argument_unpacking_done;
8524   __pyx_L5_argtuple_error:;
8525   __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 558, __pyx_L3_error)
8526   __pyx_L3_error:;
8527   __Pyx_AddTraceback("pygame._sdl2.video.Texture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8528   __Pyx_RefNannyFinishContext();
8529   return -1;
8530   __pyx_L4_argument_unpacking_done:;
8531   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_renderer), __pyx_ptype_6pygame_5_sdl2_5video_Renderer, 1, "renderer", 0))) __PYX_ERR(0, 559, __pyx_L1_error)
8532   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_renderer, __pyx_v_size, __pyx_v_depth, __pyx_v_static, __pyx_v_streaming, __pyx_v_target);
8533 
8534   /* "pygame/_sdl2/video.pyx":558
8535  *         self._color = pgColor_NewLength(defaultColor, 3)
8536  *
8537  *     def __init__(self,             # <<<<<<<<<<<<<<
8538  *                  Renderer renderer,
8539  *                  size, int depth=0,
8540  */
8541 
8542   /* function exit code */
8543   goto __pyx_L0;
8544   __pyx_L1_error:;
8545   __pyx_r = -1;
8546   __pyx_L0:;
8547   __Pyx_RefNannyFinishContext();
8548   return __pyx_r;
8549 }
8550 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_renderer,PyObject * __pyx_v_size,int __pyx_v_depth,PyObject * __pyx_v_static,PyObject * __pyx_v_streaming,PyObject * __pyx_v_target)8551 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer, PyObject *__pyx_v_size, int __pyx_v_depth, PyObject *__pyx_v_static, PyObject *__pyx_v_streaming, PyObject *__pyx_v_target) {
8552   Uint32 __pyx_v_format;
8553   PyObject *__pyx_v_e = NULL;
8554   int __pyx_v_width;
8555   int __pyx_v_height;
8556   int __pyx_v_access;
8557   SDL_Renderer *__pyx_v__renderer;
8558   int __pyx_r;
8559   __Pyx_RefNannyDeclarations
8560   PyObject *__pyx_t_1 = NULL;
8561   PyObject *__pyx_t_2 = NULL;
8562   PyObject *__pyx_t_3 = NULL;
8563   Py_ssize_t __pyx_t_4;
8564   int __pyx_t_5;
8565   PyObject *__pyx_t_6 = NULL;
8566   int __pyx_t_7;
8567   int __pyx_t_8;
8568   int __pyx_t_9;
8569   SDL_Renderer *__pyx_t_10;
8570   PyObject *__pyx_t_11 = NULL;
8571   PyObject *__pyx_t_12 = NULL;
8572   int __pyx_lineno = 0;
8573   const char *__pyx_filename = NULL;
8574   int __pyx_clineno = 0;
8575   __Pyx_RefNannySetupContext("__init__", 0);
8576 
8577   /* "pygame/_sdl2/video.pyx":579
8578  *         # TODO: masks
8579  *         cdef Uint32 format
8580  *         try:             # <<<<<<<<<<<<<<
8581  *             format = format_from_depth(depth)
8582  *         except ValueError as e:
8583  */
8584   {
8585     (void)__pyx_t_1; (void)__pyx_t_2; (void)__pyx_t_3; /* mark used */
8586     /*try:*/ {
8587 
8588       /* "pygame/_sdl2/video.pyx":580
8589  *         cdef Uint32 format
8590  *         try:
8591  *             format = format_from_depth(depth)             # <<<<<<<<<<<<<<
8592  *         except ValueError as e:
8593  *             raise e
8594  */
8595       __pyx_v_format = __pyx_f_6pygame_5_sdl2_5video_format_from_depth(__pyx_v_depth);
8596 
8597       /* "pygame/_sdl2/video.pyx":579
8598  *         # TODO: masks
8599  *         cdef Uint32 format
8600  *         try:             # <<<<<<<<<<<<<<
8601  *             format = format_from_depth(depth)
8602  *         except ValueError as e:
8603  */
8604     }
8605   }
8606 
8607   /* "pygame/_sdl2/video.pyx":585
8608  *
8609  *         cdef int width, height
8610  *         if len(size) != 2:             # <<<<<<<<<<<<<<
8611  *             raise ValueError('size must have two elements')
8612  *         width, height = size[0], size[1]
8613  */
8614   __pyx_t_4 = PyObject_Length(__pyx_v_size); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 585, __pyx_L1_error)
8615   __pyx_t_5 = ((__pyx_t_4 != 2) != 0);
8616   if (unlikely(__pyx_t_5)) {
8617 
8618     /* "pygame/_sdl2/video.pyx":586
8619  *         cdef int width, height
8620  *         if len(size) != 2:
8621  *             raise ValueError('size must have two elements')             # <<<<<<<<<<<<<<
8622  *         width, height = size[0], size[1]
8623  *         if width <= 0 or height <= 0:
8624  */
8625     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 586, __pyx_L1_error)
8626     __Pyx_GOTREF(__pyx_t_6);
8627     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8628     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8629     __PYX_ERR(0, 586, __pyx_L1_error)
8630 
8631     /* "pygame/_sdl2/video.pyx":585
8632  *
8633  *         cdef int width, height
8634  *         if len(size) != 2:             # <<<<<<<<<<<<<<
8635  *             raise ValueError('size must have two elements')
8636  *         width, height = size[0], size[1]
8637  */
8638   }
8639 
8640   /* "pygame/_sdl2/video.pyx":587
8641  *         if len(size) != 2:
8642  *             raise ValueError('size must have two elements')
8643  *         width, height = size[0], size[1]             # <<<<<<<<<<<<<<
8644  *         if width <= 0 or height <= 0:
8645  *             raise ValueError('size must contain two positive values')
8646  */
8647   __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 587, __pyx_L1_error)
8648   __Pyx_GOTREF(__pyx_t_6);
8649   __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L1_error)
8650   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8651   __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 587, __pyx_L1_error)
8652   __Pyx_GOTREF(__pyx_t_6);
8653   __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 587, __pyx_L1_error)
8654   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8655   __pyx_v_width = __pyx_t_7;
8656   __pyx_v_height = __pyx_t_8;
8657 
8658   /* "pygame/_sdl2/video.pyx":588
8659  *             raise ValueError('size must have two elements')
8660  *         width, height = size[0], size[1]
8661  *         if width <= 0 or height <= 0:             # <<<<<<<<<<<<<<
8662  *             raise ValueError('size must contain two positive values')
8663  *
8664  */
8665   __pyx_t_9 = ((__pyx_v_width <= 0) != 0);
8666   if (!__pyx_t_9) {
8667   } else {
8668     __pyx_t_5 = __pyx_t_9;
8669     goto __pyx_L11_bool_binop_done;
8670   }
8671   __pyx_t_9 = ((__pyx_v_height <= 0) != 0);
8672   __pyx_t_5 = __pyx_t_9;
8673   __pyx_L11_bool_binop_done:;
8674   if (unlikely(__pyx_t_5)) {
8675 
8676     /* "pygame/_sdl2/video.pyx":589
8677  *         width, height = size[0], size[1]
8678  *         if width <= 0 or height <= 0:
8679  *             raise ValueError('size must contain two positive values')             # <<<<<<<<<<<<<<
8680  *
8681  *         cdef int access
8682  */
8683     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 589, __pyx_L1_error)
8684     __Pyx_GOTREF(__pyx_t_6);
8685     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8686     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8687     __PYX_ERR(0, 589, __pyx_L1_error)
8688 
8689     /* "pygame/_sdl2/video.pyx":588
8690  *             raise ValueError('size must have two elements')
8691  *         width, height = size[0], size[1]
8692  *         if width <= 0 or height <= 0:             # <<<<<<<<<<<<<<
8693  *             raise ValueError('size must contain two positive values')
8694  *
8695  */
8696   }
8697 
8698   /* "pygame/_sdl2/video.pyx":592
8699  *
8700  *         cdef int access
8701  *         if static:             # <<<<<<<<<<<<<<
8702  *             if streaming or target:
8703  *                 raise ValueError('only one of static, streaming, or target can be true')
8704  */
8705   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
8706   if (__pyx_t_5) {
8707 
8708     /* "pygame/_sdl2/video.pyx":593
8709  *         cdef int access
8710  *         if static:
8711  *             if streaming or target:             # <<<<<<<<<<<<<<
8712  *                 raise ValueError('only one of static, streaming, or target can be true')
8713  *             access = _SDL_TEXTUREACCESS_STATIC
8714  */
8715     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 593, __pyx_L1_error)
8716     if (!__pyx_t_9) {
8717     } else {
8718       __pyx_t_5 = __pyx_t_9;
8719       goto __pyx_L15_bool_binop_done;
8720     }
8721     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 593, __pyx_L1_error)
8722     __pyx_t_5 = __pyx_t_9;
8723     __pyx_L15_bool_binop_done:;
8724     if (unlikely(__pyx_t_5)) {
8725 
8726       /* "pygame/_sdl2/video.pyx":594
8727  *         if static:
8728  *             if streaming or target:
8729  *                 raise ValueError('only one of static, streaming, or target can be true')             # <<<<<<<<<<<<<<
8730  *             access = _SDL_TEXTUREACCESS_STATIC
8731  *         elif streaming:
8732  */
8733       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error)
8734       __Pyx_GOTREF(__pyx_t_6);
8735       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8736       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8737       __PYX_ERR(0, 594, __pyx_L1_error)
8738 
8739       /* "pygame/_sdl2/video.pyx":593
8740  *         cdef int access
8741  *         if static:
8742  *             if streaming or target:             # <<<<<<<<<<<<<<
8743  *                 raise ValueError('only one of static, streaming, or target can be true')
8744  *             access = _SDL_TEXTUREACCESS_STATIC
8745  */
8746     }
8747 
8748     /* "pygame/_sdl2/video.pyx":595
8749  *             if streaming or target:
8750  *                 raise ValueError('only one of static, streaming, or target can be true')
8751  *             access = _SDL_TEXTUREACCESS_STATIC             # <<<<<<<<<<<<<<
8752  *         elif streaming:
8753  *             if static or target:
8754  */
8755     __pyx_v_access = SDL_TEXTUREACCESS_STATIC;
8756 
8757     /* "pygame/_sdl2/video.pyx":592
8758  *
8759  *         cdef int access
8760  *         if static:             # <<<<<<<<<<<<<<
8761  *             if streaming or target:
8762  *                 raise ValueError('only one of static, streaming, or target can be true')
8763  */
8764     goto __pyx_L13;
8765   }
8766 
8767   /* "pygame/_sdl2/video.pyx":596
8768  *                 raise ValueError('only one of static, streaming, or target can be true')
8769  *             access = _SDL_TEXTUREACCESS_STATIC
8770  *         elif streaming:             # <<<<<<<<<<<<<<
8771  *             if static or target:
8772  *                 raise ValueError('only one of static, streaming, or target can be true')
8773  */
8774   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 596, __pyx_L1_error)
8775   if (__pyx_t_5) {
8776 
8777     /* "pygame/_sdl2/video.pyx":597
8778  *             access = _SDL_TEXTUREACCESS_STATIC
8779  *         elif streaming:
8780  *             if static or target:             # <<<<<<<<<<<<<<
8781  *                 raise ValueError('only one of static, streaming, or target can be true')
8782  *             access = _SDL_TEXTUREACCESS_STREAMING
8783  */
8784     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 597, __pyx_L1_error)
8785     if (!__pyx_t_9) {
8786     } else {
8787       __pyx_t_5 = __pyx_t_9;
8788       goto __pyx_L18_bool_binop_done;
8789     }
8790     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 597, __pyx_L1_error)
8791     __pyx_t_5 = __pyx_t_9;
8792     __pyx_L18_bool_binop_done:;
8793     if (unlikely(__pyx_t_5)) {
8794 
8795       /* "pygame/_sdl2/video.pyx":598
8796  *         elif streaming:
8797  *             if static or target:
8798  *                 raise ValueError('only one of static, streaming, or target can be true')             # <<<<<<<<<<<<<<
8799  *             access = _SDL_TEXTUREACCESS_STREAMING
8800  *         elif target:
8801  */
8802       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 598, __pyx_L1_error)
8803       __Pyx_GOTREF(__pyx_t_6);
8804       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8805       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8806       __PYX_ERR(0, 598, __pyx_L1_error)
8807 
8808       /* "pygame/_sdl2/video.pyx":597
8809  *             access = _SDL_TEXTUREACCESS_STATIC
8810  *         elif streaming:
8811  *             if static or target:             # <<<<<<<<<<<<<<
8812  *                 raise ValueError('only one of static, streaming, or target can be true')
8813  *             access = _SDL_TEXTUREACCESS_STREAMING
8814  */
8815     }
8816 
8817     /* "pygame/_sdl2/video.pyx":599
8818  *             if static or target:
8819  *                 raise ValueError('only one of static, streaming, or target can be true')
8820  *             access = _SDL_TEXTUREACCESS_STREAMING             # <<<<<<<<<<<<<<
8821  *         elif target:
8822  *             if streaming or static:
8823  */
8824     __pyx_v_access = SDL_TEXTUREACCESS_STREAMING;
8825 
8826     /* "pygame/_sdl2/video.pyx":596
8827  *                 raise ValueError('only one of static, streaming, or target can be true')
8828  *             access = _SDL_TEXTUREACCESS_STATIC
8829  *         elif streaming:             # <<<<<<<<<<<<<<
8830  *             if static or target:
8831  *                 raise ValueError('only one of static, streaming, or target can be true')
8832  */
8833     goto __pyx_L13;
8834   }
8835 
8836   /* "pygame/_sdl2/video.pyx":600
8837  *                 raise ValueError('only one of static, streaming, or target can be true')
8838  *             access = _SDL_TEXTUREACCESS_STREAMING
8839  *         elif target:             # <<<<<<<<<<<<<<
8840  *             if streaming or static:
8841  *                 raise ValueError('only one of static, streaming, or target can be true')
8842  */
8843   __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_target); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 600, __pyx_L1_error)
8844   if (__pyx_t_5) {
8845 
8846     /* "pygame/_sdl2/video.pyx":601
8847  *             access = _SDL_TEXTUREACCESS_STREAMING
8848  *         elif target:
8849  *             if streaming or static:             # <<<<<<<<<<<<<<
8850  *                 raise ValueError('only one of static, streaming, or target can be true')
8851  *             access = _SDL_TEXTUREACCESS_TARGET
8852  */
8853     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_streaming); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 601, __pyx_L1_error)
8854     if (!__pyx_t_9) {
8855     } else {
8856       __pyx_t_5 = __pyx_t_9;
8857       goto __pyx_L21_bool_binop_done;
8858     }
8859     __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_static); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 601, __pyx_L1_error)
8860     __pyx_t_5 = __pyx_t_9;
8861     __pyx_L21_bool_binop_done:;
8862     if (unlikely(__pyx_t_5)) {
8863 
8864       /* "pygame/_sdl2/video.pyx":602
8865  *         elif target:
8866  *             if streaming or static:
8867  *                 raise ValueError('only one of static, streaming, or target can be true')             # <<<<<<<<<<<<<<
8868  *             access = _SDL_TEXTUREACCESS_TARGET
8869  *         else:
8870  */
8871       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 602, __pyx_L1_error)
8872       __Pyx_GOTREF(__pyx_t_6);
8873       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8874       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8875       __PYX_ERR(0, 602, __pyx_L1_error)
8876 
8877       /* "pygame/_sdl2/video.pyx":601
8878  *             access = _SDL_TEXTUREACCESS_STREAMING
8879  *         elif target:
8880  *             if streaming or static:             # <<<<<<<<<<<<<<
8881  *                 raise ValueError('only one of static, streaming, or target can be true')
8882  *             access = _SDL_TEXTUREACCESS_TARGET
8883  */
8884     }
8885 
8886     /* "pygame/_sdl2/video.pyx":603
8887  *             if streaming or static:
8888  *                 raise ValueError('only one of static, streaming, or target can be true')
8889  *             access = _SDL_TEXTUREACCESS_TARGET             # <<<<<<<<<<<<<<
8890  *         else:
8891  *             # Create static texture by default.
8892  */
8893     __pyx_v_access = SDL_TEXTUREACCESS_TARGET;
8894 
8895     /* "pygame/_sdl2/video.pyx":600
8896  *                 raise ValueError('only one of static, streaming, or target can be true')
8897  *             access = _SDL_TEXTUREACCESS_STREAMING
8898  *         elif target:             # <<<<<<<<<<<<<<
8899  *             if streaming or static:
8900  *                 raise ValueError('only one of static, streaming, or target can be true')
8901  */
8902     goto __pyx_L13;
8903   }
8904 
8905   /* "pygame/_sdl2/video.pyx":606
8906  *         else:
8907  *             # Create static texture by default.
8908  *             access = _SDL_TEXTUREACCESS_STATIC             # <<<<<<<<<<<<<<
8909  *
8910  *         self.renderer = renderer
8911  */
8912   /*else*/ {
8913     __pyx_v_access = SDL_TEXTUREACCESS_STATIC;
8914   }
8915   __pyx_L13:;
8916 
8917   /* "pygame/_sdl2/video.pyx":608
8918  *             access = _SDL_TEXTUREACCESS_STATIC
8919  *
8920  *         self.renderer = renderer             # <<<<<<<<<<<<<<
8921  *         cdef SDL_Renderer* _renderer = renderer._renderer
8922  *         self._tex = SDL_CreateTexture(_renderer,
8923  */
8924   __Pyx_INCREF(((PyObject *)__pyx_v_renderer));
8925   __Pyx_GIVEREF(((PyObject *)__pyx_v_renderer));
8926   __Pyx_GOTREF(__pyx_v_self->renderer);
8927   __Pyx_DECREF(((PyObject *)__pyx_v_self->renderer));
8928   __pyx_v_self->renderer = __pyx_v_renderer;
8929 
8930   /* "pygame/_sdl2/video.pyx":609
8931  *
8932  *         self.renderer = renderer
8933  *         cdef SDL_Renderer* _renderer = renderer._renderer             # <<<<<<<<<<<<<<
8934  *         self._tex = SDL_CreateTexture(_renderer,
8935  *                                       format,
8936  */
8937   __pyx_t_10 = __pyx_v_renderer->_renderer;
8938   __pyx_v__renderer = __pyx_t_10;
8939 
8940   /* "pygame/_sdl2/video.pyx":610
8941  *         self.renderer = renderer
8942  *         cdef SDL_Renderer* _renderer = renderer._renderer
8943  *         self._tex = SDL_CreateTexture(_renderer,             # <<<<<<<<<<<<<<
8944  *                                       format,
8945  *                                       access,
8946  */
8947   __pyx_v_self->_tex = SDL_CreateTexture(__pyx_v__renderer, __pyx_v_format, __pyx_v_access, __pyx_v_width, __pyx_v_height);
8948 
8949   /* "pygame/_sdl2/video.pyx":614
8950  *                                       access,
8951  *                                       width, height)
8952  *         if not self._tex:             # <<<<<<<<<<<<<<
8953  *             raise error()
8954  *         self.width, self.height = width, height
8955  */
8956   __pyx_t_5 = ((!(__pyx_v_self->_tex != 0)) != 0);
8957   if (unlikely(__pyx_t_5)) {
8958 
8959     /* "pygame/_sdl2/video.pyx":615
8960  *                                       width, height)
8961  *         if not self._tex:
8962  *             raise error()             # <<<<<<<<<<<<<<
8963  *         self.width, self.height = width, height
8964  *
8965  */
8966     __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_error); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 615, __pyx_L1_error)
8967     __Pyx_GOTREF(__pyx_t_11);
8968     __pyx_t_12 = NULL;
8969     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
8970       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
8971       if (likely(__pyx_t_12)) {
8972         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
8973         __Pyx_INCREF(__pyx_t_12);
8974         __Pyx_INCREF(function);
8975         __Pyx_DECREF_SET(__pyx_t_11, function);
8976       }
8977     }
8978     __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
8979     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
8980     if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 615, __pyx_L1_error)
8981     __Pyx_GOTREF(__pyx_t_6);
8982     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8983     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8984     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8985     __PYX_ERR(0, 615, __pyx_L1_error)
8986 
8987     /* "pygame/_sdl2/video.pyx":614
8988  *                                       access,
8989  *                                       width, height)
8990  *         if not self._tex:             # <<<<<<<<<<<<<<
8991  *             raise error()
8992  *         self.width, self.height = width, height
8993  */
8994   }
8995 
8996   /* "pygame/_sdl2/video.pyx":616
8997  *         if not self._tex:
8998  *             raise error()
8999  *         self.width, self.height = width, height             # <<<<<<<<<<<<<<
9000  *
9001  *     @staticmethod
9002  */
9003   __pyx_t_8 = __pyx_v_width;
9004   __pyx_t_7 = __pyx_v_height;
9005   __pyx_v_self->width = __pyx_t_8;
9006   __pyx_v_self->height = __pyx_t_7;
9007 
9008   /* "pygame/_sdl2/video.pyx":558
9009  *         self._color = pgColor_NewLength(defaultColor, 3)
9010  *
9011  *     def __init__(self,             # <<<<<<<<<<<<<<
9012  *                  Renderer renderer,
9013  *                  size, int depth=0,
9014  */
9015 
9016   /* function exit code */
9017   __pyx_r = 0;
9018   goto __pyx_L0;
9019   __pyx_L1_error:;
9020   __Pyx_XDECREF(__pyx_t_6);
9021   __Pyx_XDECREF(__pyx_t_11);
9022   __Pyx_XDECREF(__pyx_t_12);
9023   __Pyx_AddTraceback("pygame._sdl2.video.Texture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9024   __pyx_r = -1;
9025   __pyx_L0:;
9026   __Pyx_XDECREF(__pyx_v_e);
9027   __Pyx_RefNannyFinishContext();
9028   return __pyx_r;
9029 }
9030 
9031 /* "pygame/_sdl2/video.pyx":619
9032  *
9033  *     @staticmethod
9034  *     def from_surface(Renderer renderer, surface):             # <<<<<<<<<<<<<<
9035  *         """ Create a texture from an existing surface.
9036  *
9037  */
9038 
9039 /* Python wrapper */
9040 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9041 static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_4from_surface[] = " Create a texture from an existing surface.\n\n        :param Renderer renderer: Rendering context for the texture.\n        :param pygame.Surface surface: The surface to create a texture from.\n        ";
9042 static PyMethodDef __pyx_mdef_6pygame_5_sdl2_5video_7Texture_5from_surface = {"from_surface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7Texture_4from_surface};
__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)9043 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9044   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer = 0;
9045   PyObject *__pyx_v_surface = 0;
9046   int __pyx_lineno = 0;
9047   const char *__pyx_filename = NULL;
9048   int __pyx_clineno = 0;
9049   PyObject *__pyx_r = 0;
9050   __Pyx_RefNannyDeclarations
9051   __Pyx_RefNannySetupContext("from_surface (wrapper)", 0);
9052   {
9053     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_renderer,&__pyx_n_s_surface,0};
9054     PyObject* values[2] = {0,0};
9055     if (unlikely(__pyx_kwds)) {
9056       Py_ssize_t kw_args;
9057       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9058       switch (pos_args) {
9059         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9060         CYTHON_FALLTHROUGH;
9061         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9062         CYTHON_FALLTHROUGH;
9063         case  0: break;
9064         default: goto __pyx_L5_argtuple_error;
9065       }
9066       kw_args = PyDict_Size(__pyx_kwds);
9067       switch (pos_args) {
9068         case  0:
9069         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_renderer)) != 0)) kw_args--;
9070         else goto __pyx_L5_argtuple_error;
9071         CYTHON_FALLTHROUGH;
9072         case  1:
9073         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
9074         else {
9075           __Pyx_RaiseArgtupleInvalid("from_surface", 1, 2, 2, 1); __PYX_ERR(0, 619, __pyx_L3_error)
9076         }
9077       }
9078       if (unlikely(kw_args > 0)) {
9079         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "from_surface") < 0)) __PYX_ERR(0, 619, __pyx_L3_error)
9080       }
9081     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
9082       goto __pyx_L5_argtuple_error;
9083     } else {
9084       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9085       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9086     }
9087     __pyx_v_renderer = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)values[0]);
9088     __pyx_v_surface = values[1];
9089   }
9090   goto __pyx_L4_argument_unpacking_done;
9091   __pyx_L5_argtuple_error:;
9092   __Pyx_RaiseArgtupleInvalid("from_surface", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 619, __pyx_L3_error)
9093   __pyx_L3_error:;
9094   __Pyx_AddTraceback("pygame._sdl2.video.Texture.from_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
9095   __Pyx_RefNannyFinishContext();
9096   return NULL;
9097   __pyx_L4_argument_unpacking_done:;
9098   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_renderer), __pyx_ptype_6pygame_5_sdl2_5video_Renderer, 1, "renderer", 0))) __PYX_ERR(0, 619, __pyx_L1_error)
9099   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(__pyx_v_renderer, __pyx_v_surface);
9100 
9101   /* function exit code */
9102   goto __pyx_L0;
9103   __pyx_L1_error:;
9104   __pyx_r = NULL;
9105   __pyx_L0:;
9106   __Pyx_RefNannyFinishContext();
9107   return __pyx_r;
9108 }
9109 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_renderer,PyObject * __pyx_v_surface)9110 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_4from_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_renderer, PyObject *__pyx_v_surface) {
9111   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self = 0;
9112   SDL_Renderer *__pyx_v__renderer;
9113   SDL_Surface *__pyx_v_surf_ptr;
9114   PyObject *__pyx_r = NULL;
9115   __Pyx_RefNannyDeclarations
9116   int __pyx_t_1;
9117   PyObject *__pyx_t_2 = NULL;
9118   SDL_Renderer *__pyx_t_3;
9119   PyObject *__pyx_t_4 = NULL;
9120   PyObject *__pyx_t_5 = NULL;
9121   int __pyx_t_6;
9122   int __pyx_lineno = 0;
9123   const char *__pyx_filename = NULL;
9124   int __pyx_clineno = 0;
9125   __Pyx_RefNannySetupContext("from_surface", 0);
9126 
9127   /* "pygame/_sdl2/video.pyx":626
9128  *         """
9129  *         # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
9130  *         if not pgSurface_Check(surface):             # <<<<<<<<<<<<<<
9131  *             raise TypeError('2nd argument must be a surface')
9132  *         cdef Texture self = Texture.__new__(Texture)
9133  */
9134   __pyx_t_1 = ((!(pgSurface_Check(__pyx_v_surface) != 0)) != 0);
9135   if (unlikely(__pyx_t_1)) {
9136 
9137     /* "pygame/_sdl2/video.pyx":627
9138  *         # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
9139  *         if not pgSurface_Check(surface):
9140  *             raise TypeError('2nd argument must be a surface')             # <<<<<<<<<<<<<<
9141  *         cdef Texture self = Texture.__new__(Texture)
9142  *         self.renderer = renderer
9143  */
9144     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
9145     __Pyx_GOTREF(__pyx_t_2);
9146     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9147     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9148     __PYX_ERR(0, 627, __pyx_L1_error)
9149 
9150     /* "pygame/_sdl2/video.pyx":626
9151  *         """
9152  *         # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
9153  *         if not pgSurface_Check(surface):             # <<<<<<<<<<<<<<
9154  *             raise TypeError('2nd argument must be a surface')
9155  *         cdef Texture self = Texture.__new__(Texture)
9156  */
9157   }
9158 
9159   /* "pygame/_sdl2/video.pyx":628
9160  *         if not pgSurface_Check(surface):
9161  *             raise TypeError('2nd argument must be a surface')
9162  *         cdef Texture self = Texture.__new__(Texture)             # <<<<<<<<<<<<<<
9163  *         self.renderer = renderer
9164  *         cdef SDL_Renderer* _renderer = renderer._renderer
9165  */
9166   __pyx_t_2 = ((PyObject *)__pyx_tp_new_6pygame_5_sdl2_5video_Texture(((PyTypeObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
9167   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
9168   __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_2);
9169   __pyx_t_2 = 0;
9170 
9171   /* "pygame/_sdl2/video.pyx":629
9172  *             raise TypeError('2nd argument must be a surface')
9173  *         cdef Texture self = Texture.__new__(Texture)
9174  *         self.renderer = renderer             # <<<<<<<<<<<<<<
9175  *         cdef SDL_Renderer* _renderer = renderer._renderer
9176  *         cdef SDL_Surface *surf_ptr = pgSurface_AsSurface(surface)
9177  */
9178   __Pyx_INCREF(((PyObject *)__pyx_v_renderer));
9179   __Pyx_GIVEREF(((PyObject *)__pyx_v_renderer));
9180   __Pyx_GOTREF(__pyx_v_self->renderer);
9181   __Pyx_DECREF(((PyObject *)__pyx_v_self->renderer));
9182   __pyx_v_self->renderer = __pyx_v_renderer;
9183 
9184   /* "pygame/_sdl2/video.pyx":630
9185  *         cdef Texture self = Texture.__new__(Texture)
9186  *         self.renderer = renderer
9187  *         cdef SDL_Renderer* _renderer = renderer._renderer             # <<<<<<<<<<<<<<
9188  *         cdef SDL_Surface *surf_ptr = pgSurface_AsSurface(surface)
9189  *         self._tex = SDL_CreateTextureFromSurface(_renderer,
9190  */
9191   __pyx_t_3 = __pyx_v_renderer->_renderer;
9192   __pyx_v__renderer = __pyx_t_3;
9193 
9194   /* "pygame/_sdl2/video.pyx":631
9195  *         self.renderer = renderer
9196  *         cdef SDL_Renderer* _renderer = renderer._renderer
9197  *         cdef SDL_Surface *surf_ptr = pgSurface_AsSurface(surface)             # <<<<<<<<<<<<<<
9198  *         self._tex = SDL_CreateTextureFromSurface(_renderer,
9199  *                                                  surf_ptr)
9200  */
9201   __pyx_v_surf_ptr = pgSurface_AsSurface(__pyx_v_surface);
9202 
9203   /* "pygame/_sdl2/video.pyx":632
9204  *         cdef SDL_Renderer* _renderer = renderer._renderer
9205  *         cdef SDL_Surface *surf_ptr = pgSurface_AsSurface(surface)
9206  *         self._tex = SDL_CreateTextureFromSurface(_renderer,             # <<<<<<<<<<<<<<
9207  *                                                  surf_ptr)
9208  *         if not self._tex:
9209  */
9210   __pyx_v_self->_tex = SDL_CreateTextureFromSurface(__pyx_v__renderer, __pyx_v_surf_ptr);
9211 
9212   /* "pygame/_sdl2/video.pyx":634
9213  *         self._tex = SDL_CreateTextureFromSurface(_renderer,
9214  *                                                  surf_ptr)
9215  *         if not self._tex:             # <<<<<<<<<<<<<<
9216  *             raise error()
9217  *         self.width = surface.get_width()
9218  */
9219   __pyx_t_1 = ((!(__pyx_v_self->_tex != 0)) != 0);
9220   if (unlikely(__pyx_t_1)) {
9221 
9222     /* "pygame/_sdl2/video.pyx":635
9223  *                                                  surf_ptr)
9224  *         if not self._tex:
9225  *             raise error()             # <<<<<<<<<<<<<<
9226  *         self.width = surface.get_width()
9227  *         self.height = surface.get_height()
9228  */
9229     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error)
9230     __Pyx_GOTREF(__pyx_t_4);
9231     __pyx_t_5 = NULL;
9232     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9233       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9234       if (likely(__pyx_t_5)) {
9235         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9236         __Pyx_INCREF(__pyx_t_5);
9237         __Pyx_INCREF(function);
9238         __Pyx_DECREF_SET(__pyx_t_4, function);
9239       }
9240     }
9241     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9242     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9243     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error)
9244     __Pyx_GOTREF(__pyx_t_2);
9245     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9246     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9247     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9248     __PYX_ERR(0, 635, __pyx_L1_error)
9249 
9250     /* "pygame/_sdl2/video.pyx":634
9251  *         self._tex = SDL_CreateTextureFromSurface(_renderer,
9252  *                                                  surf_ptr)
9253  *         if not self._tex:             # <<<<<<<<<<<<<<
9254  *             raise error()
9255  *         self.width = surface.get_width()
9256  */
9257   }
9258 
9259   /* "pygame/_sdl2/video.pyx":636
9260  *         if not self._tex:
9261  *             raise error()
9262  *         self.width = surface.get_width()             # <<<<<<<<<<<<<<
9263  *         self.height = surface.get_height()
9264  *         return self
9265  */
9266   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error)
9267   __Pyx_GOTREF(__pyx_t_4);
9268   __pyx_t_5 = NULL;
9269   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9270     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9271     if (likely(__pyx_t_5)) {
9272       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9273       __Pyx_INCREF(__pyx_t_5);
9274       __Pyx_INCREF(function);
9275       __Pyx_DECREF_SET(__pyx_t_4, function);
9276     }
9277   }
9278   __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9279   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9280   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error)
9281   __Pyx_GOTREF(__pyx_t_2);
9282   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9283   __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 636, __pyx_L1_error)
9284   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9285   __pyx_v_self->width = __pyx_t_6;
9286 
9287   /* "pygame/_sdl2/video.pyx":637
9288  *             raise error()
9289  *         self.width = surface.get_width()
9290  *         self.height = surface.get_height()             # <<<<<<<<<<<<<<
9291  *         return self
9292  *
9293  */
9294   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
9295   __Pyx_GOTREF(__pyx_t_4);
9296   __pyx_t_5 = NULL;
9297   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9298     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9299     if (likely(__pyx_t_5)) {
9300       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9301       __Pyx_INCREF(__pyx_t_5);
9302       __Pyx_INCREF(function);
9303       __Pyx_DECREF_SET(__pyx_t_4, function);
9304     }
9305   }
9306   __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9307   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9308   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error)
9309   __Pyx_GOTREF(__pyx_t_2);
9310   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9311   __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L1_error)
9312   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9313   __pyx_v_self->height = __pyx_t_6;
9314 
9315   /* "pygame/_sdl2/video.pyx":638
9316  *         self.width = surface.get_width()
9317  *         self.height = surface.get_height()
9318  *         return self             # <<<<<<<<<<<<<<
9319  *
9320  *     def __dealloc__(self):
9321  */
9322   __Pyx_XDECREF(__pyx_r);
9323   __Pyx_INCREF(((PyObject *)__pyx_v_self));
9324   __pyx_r = ((PyObject *)__pyx_v_self);
9325   goto __pyx_L0;
9326 
9327   /* "pygame/_sdl2/video.pyx":619
9328  *
9329  *     @staticmethod
9330  *     def from_surface(Renderer renderer, surface):             # <<<<<<<<<<<<<<
9331  *         """ Create a texture from an existing surface.
9332  *
9333  */
9334 
9335   /* function exit code */
9336   __pyx_L1_error:;
9337   __Pyx_XDECREF(__pyx_t_2);
9338   __Pyx_XDECREF(__pyx_t_4);
9339   __Pyx_XDECREF(__pyx_t_5);
9340   __Pyx_AddTraceback("pygame._sdl2.video.Texture.from_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
9341   __pyx_r = NULL;
9342   __pyx_L0:;
9343   __Pyx_XDECREF((PyObject *)__pyx_v_self);
9344   __Pyx_XGIVEREF(__pyx_r);
9345   __Pyx_RefNannyFinishContext();
9346   return __pyx_r;
9347 }
9348 
9349 /* "pygame/_sdl2/video.pyx":640
9350  *         return self
9351  *
9352  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
9353  *         if self._tex:
9354  *             SDL_DestroyTexture(self._tex)
9355  */
9356 
9357 /* Python wrapper */
9358 static void __pyx_pw_6pygame_5_sdl2_5video_7Texture_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_7__dealloc__(PyObject * __pyx_v_self)9359 static void __pyx_pw_6pygame_5_sdl2_5video_7Texture_7__dealloc__(PyObject *__pyx_v_self) {
9360   __Pyx_RefNannyDeclarations
9361   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
9362   __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
9363 
9364   /* function exit code */
9365   __Pyx_RefNannyFinishContext();
9366 }
9367 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)9368 static void __pyx_pf_6pygame_5_sdl2_5video_7Texture_6__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
9369   __Pyx_RefNannyDeclarations
9370   int __pyx_t_1;
9371   __Pyx_RefNannySetupContext("__dealloc__", 0);
9372 
9373   /* "pygame/_sdl2/video.pyx":641
9374  *
9375  *     def __dealloc__(self):
9376  *         if self._tex:             # <<<<<<<<<<<<<<
9377  *             SDL_DestroyTexture(self._tex)
9378  *
9379  */
9380   __pyx_t_1 = (__pyx_v_self->_tex != 0);
9381   if (__pyx_t_1) {
9382 
9383     /* "pygame/_sdl2/video.pyx":642
9384  *     def __dealloc__(self):
9385  *         if self._tex:
9386  *             SDL_DestroyTexture(self._tex)             # <<<<<<<<<<<<<<
9387  *
9388  *     @property
9389  */
9390     SDL_DestroyTexture(__pyx_v_self->_tex);
9391 
9392     /* "pygame/_sdl2/video.pyx":641
9393  *
9394  *     def __dealloc__(self):
9395  *         if self._tex:             # <<<<<<<<<<<<<<
9396  *             SDL_DestroyTexture(self._tex)
9397  *
9398  */
9399   }
9400 
9401   /* "pygame/_sdl2/video.pyx":640
9402  *         return self
9403  *
9404  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
9405  *         if self._tex:
9406  *             SDL_DestroyTexture(self._tex)
9407  */
9408 
9409   /* function exit code */
9410   __Pyx_RefNannyFinishContext();
9411 }
9412 
9413 /* "pygame/_sdl2/video.pyx":645
9414  *
9415  *     @property
9416  *     def alpha(self):             # <<<<<<<<<<<<<<
9417  *         # https://wiki.libsdl.org/SDL_GetTextureAlphaMod
9418  *         cdef Uint8 alpha
9419  */
9420 
9421 /* Python wrapper */
9422 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_1__get__(PyObject * __pyx_v_self)9423 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_1__get__(PyObject *__pyx_v_self) {
9424   PyObject *__pyx_r = 0;
9425   __Pyx_RefNannyDeclarations
9426   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9427   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
9428 
9429   /* function exit code */
9430   __Pyx_RefNannyFinishContext();
9431   return __pyx_r;
9432 }
9433 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)9434 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
9435   Uint8 __pyx_v_alpha;
9436   int __pyx_v_res;
9437   PyObject *__pyx_r = NULL;
9438   __Pyx_RefNannyDeclarations
9439   int __pyx_t_1;
9440   PyObject *__pyx_t_2 = NULL;
9441   PyObject *__pyx_t_3 = NULL;
9442   PyObject *__pyx_t_4 = NULL;
9443   int __pyx_lineno = 0;
9444   const char *__pyx_filename = NULL;
9445   int __pyx_clineno = 0;
9446   __Pyx_RefNannySetupContext("__get__", 0);
9447 
9448   /* "pygame/_sdl2/video.pyx":648
9449  *         # https://wiki.libsdl.org/SDL_GetTextureAlphaMod
9450  *         cdef Uint8 alpha
9451  *         res = SDL_GetTextureAlphaMod(self._tex, &alpha)             # <<<<<<<<<<<<<<
9452  *         if res < 0:
9453  *             raise error()
9454  */
9455   __pyx_v_res = SDL_GetTextureAlphaMod(__pyx_v_self->_tex, (&__pyx_v_alpha));
9456 
9457   /* "pygame/_sdl2/video.pyx":649
9458  *         cdef Uint8 alpha
9459  *         res = SDL_GetTextureAlphaMod(self._tex, &alpha)
9460  *         if res < 0:             # <<<<<<<<<<<<<<
9461  *             raise error()
9462  *
9463  */
9464   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
9465   if (unlikely(__pyx_t_1)) {
9466 
9467     /* "pygame/_sdl2/video.pyx":650
9468  *         res = SDL_GetTextureAlphaMod(self._tex, &alpha)
9469  *         if res < 0:
9470  *             raise error()             # <<<<<<<<<<<<<<
9471  *
9472  *         return alpha
9473  */
9474     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 650, __pyx_L1_error)
9475     __Pyx_GOTREF(__pyx_t_3);
9476     __pyx_t_4 = NULL;
9477     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9478       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9479       if (likely(__pyx_t_4)) {
9480         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9481         __Pyx_INCREF(__pyx_t_4);
9482         __Pyx_INCREF(function);
9483         __Pyx_DECREF_SET(__pyx_t_3, function);
9484       }
9485     }
9486     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9487     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9488     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 650, __pyx_L1_error)
9489     __Pyx_GOTREF(__pyx_t_2);
9490     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9491     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9492     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9493     __PYX_ERR(0, 650, __pyx_L1_error)
9494 
9495     /* "pygame/_sdl2/video.pyx":649
9496  *         cdef Uint8 alpha
9497  *         res = SDL_GetTextureAlphaMod(self._tex, &alpha)
9498  *         if res < 0:             # <<<<<<<<<<<<<<
9499  *             raise error()
9500  *
9501  */
9502   }
9503 
9504   /* "pygame/_sdl2/video.pyx":652
9505  *             raise error()
9506  *
9507  *         return alpha             # <<<<<<<<<<<<<<
9508  *
9509  *     @alpha.setter
9510  */
9511   __Pyx_XDECREF(__pyx_r);
9512   __pyx_t_2 = __Pyx_PyInt_From_Uint8(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error)
9513   __Pyx_GOTREF(__pyx_t_2);
9514   __pyx_r = __pyx_t_2;
9515   __pyx_t_2 = 0;
9516   goto __pyx_L0;
9517 
9518   /* "pygame/_sdl2/video.pyx":645
9519  *
9520  *     @property
9521  *     def alpha(self):             # <<<<<<<<<<<<<<
9522  *         # https://wiki.libsdl.org/SDL_GetTextureAlphaMod
9523  *         cdef Uint8 alpha
9524  */
9525 
9526   /* function exit code */
9527   __pyx_L1_error:;
9528   __Pyx_XDECREF(__pyx_t_2);
9529   __Pyx_XDECREF(__pyx_t_3);
9530   __Pyx_XDECREF(__pyx_t_4);
9531   __Pyx_AddTraceback("pygame._sdl2.video.Texture.alpha.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9532   __pyx_r = NULL;
9533   __pyx_L0:;
9534   __Pyx_XGIVEREF(__pyx_r);
9535   __Pyx_RefNannyFinishContext();
9536   return __pyx_r;
9537 }
9538 
9539 /* "pygame/_sdl2/video.pyx":655
9540  *
9541  *     @alpha.setter
9542  *     def alpha(self, Uint8 new_value):             # <<<<<<<<<<<<<<
9543  *         # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
9544  *         res = SDL_SetTextureAlphaMod(self._tex, new_value)
9545  */
9546 
9547 /* Python wrapper */
9548 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_new_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_arg_new_value)9549 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_new_value) {
9550   Uint8 __pyx_v_new_value;
9551   int __pyx_lineno = 0;
9552   const char *__pyx_filename = NULL;
9553   int __pyx_clineno = 0;
9554   int __pyx_r;
9555   __Pyx_RefNannyDeclarations
9556   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
9557   assert(__pyx_arg_new_value); {
9558     __pyx_v_new_value = __Pyx_PyInt_As_Uint8(__pyx_arg_new_value); if (unlikely((__pyx_v_new_value == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error)
9559   }
9560   goto __pyx_L4_argument_unpacking_done;
9561   __pyx_L3_error:;
9562   __Pyx_AddTraceback("pygame._sdl2.video.Texture.alpha.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9563   __Pyx_RefNannyFinishContext();
9564   return -1;
9565   __pyx_L4_argument_unpacking_done:;
9566   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), ((Uint8)__pyx_v_new_value));
9567 
9568   /* function exit code */
9569   __Pyx_RefNannyFinishContext();
9570   return __pyx_r;
9571 }
9572 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,Uint8 __pyx_v_new_value)9573 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5alpha_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, Uint8 __pyx_v_new_value) {
9574   int __pyx_v_res;
9575   int __pyx_r;
9576   __Pyx_RefNannyDeclarations
9577   int __pyx_t_1;
9578   PyObject *__pyx_t_2 = NULL;
9579   PyObject *__pyx_t_3 = NULL;
9580   PyObject *__pyx_t_4 = NULL;
9581   int __pyx_lineno = 0;
9582   const char *__pyx_filename = NULL;
9583   int __pyx_clineno = 0;
9584   __Pyx_RefNannySetupContext("__set__", 0);
9585 
9586   /* "pygame/_sdl2/video.pyx":657
9587  *     def alpha(self, Uint8 new_value):
9588  *         # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
9589  *         res = SDL_SetTextureAlphaMod(self._tex, new_value)             # <<<<<<<<<<<<<<
9590  *         if res < 0:
9591  *             raise error()
9592  */
9593   __pyx_v_res = SDL_SetTextureAlphaMod(__pyx_v_self->_tex, __pyx_v_new_value);
9594 
9595   /* "pygame/_sdl2/video.pyx":658
9596  *         # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
9597  *         res = SDL_SetTextureAlphaMod(self._tex, new_value)
9598  *         if res < 0:             # <<<<<<<<<<<<<<
9599  *             raise error()
9600  *
9601  */
9602   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
9603   if (unlikely(__pyx_t_1)) {
9604 
9605     /* "pygame/_sdl2/video.pyx":659
9606  *         res = SDL_SetTextureAlphaMod(self._tex, new_value)
9607  *         if res < 0:
9608  *             raise error()             # <<<<<<<<<<<<<<
9609  *
9610  *     @property
9611  */
9612     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error)
9613     __Pyx_GOTREF(__pyx_t_3);
9614     __pyx_t_4 = NULL;
9615     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9616       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9617       if (likely(__pyx_t_4)) {
9618         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9619         __Pyx_INCREF(__pyx_t_4);
9620         __Pyx_INCREF(function);
9621         __Pyx_DECREF_SET(__pyx_t_3, function);
9622       }
9623     }
9624     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9625     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9626     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error)
9627     __Pyx_GOTREF(__pyx_t_2);
9628     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9629     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9630     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9631     __PYX_ERR(0, 659, __pyx_L1_error)
9632 
9633     /* "pygame/_sdl2/video.pyx":658
9634  *         # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
9635  *         res = SDL_SetTextureAlphaMod(self._tex, new_value)
9636  *         if res < 0:             # <<<<<<<<<<<<<<
9637  *             raise error()
9638  *
9639  */
9640   }
9641 
9642   /* "pygame/_sdl2/video.pyx":655
9643  *
9644  *     @alpha.setter
9645  *     def alpha(self, Uint8 new_value):             # <<<<<<<<<<<<<<
9646  *         # https://wiki.libsdl.org/SDL_SetTextureAlphaMod
9647  *         res = SDL_SetTextureAlphaMod(self._tex, new_value)
9648  */
9649 
9650   /* function exit code */
9651   __pyx_r = 0;
9652   goto __pyx_L0;
9653   __pyx_L1_error:;
9654   __Pyx_XDECREF(__pyx_t_2);
9655   __Pyx_XDECREF(__pyx_t_3);
9656   __Pyx_XDECREF(__pyx_t_4);
9657   __Pyx_AddTraceback("pygame._sdl2.video.Texture.alpha.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9658   __pyx_r = -1;
9659   __pyx_L0:;
9660   __Pyx_RefNannyFinishContext();
9661   return __pyx_r;
9662 }
9663 
9664 /* "pygame/_sdl2/video.pyx":662
9665  *
9666  *     @property
9667  *     def blend_mode(self):             # <<<<<<<<<<<<<<
9668  *         # https://wiki.libsdl.org/SDL_GetTextureBlendMode
9669  *         cdef SDL_BlendMode blendMode
9670  */
9671 
9672 /* Python wrapper */
9673 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_1__get__(PyObject * __pyx_v_self)9674 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_1__get__(PyObject *__pyx_v_self) {
9675   PyObject *__pyx_r = 0;
9676   __Pyx_RefNannyDeclarations
9677   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9678   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
9679 
9680   /* function exit code */
9681   __Pyx_RefNannyFinishContext();
9682   return __pyx_r;
9683 }
9684 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)9685 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
9686   SDL_BlendMode __pyx_v_blendMode;
9687   int __pyx_v_res;
9688   PyObject *__pyx_r = NULL;
9689   __Pyx_RefNannyDeclarations
9690   int __pyx_t_1;
9691   PyObject *__pyx_t_2 = NULL;
9692   PyObject *__pyx_t_3 = NULL;
9693   PyObject *__pyx_t_4 = NULL;
9694   int __pyx_lineno = 0;
9695   const char *__pyx_filename = NULL;
9696   int __pyx_clineno = 0;
9697   __Pyx_RefNannySetupContext("__get__", 0);
9698 
9699   /* "pygame/_sdl2/video.pyx":665
9700  *         # https://wiki.libsdl.org/SDL_GetTextureBlendMode
9701  *         cdef SDL_BlendMode blendMode
9702  *         res = SDL_GetTextureBlendMode(self._tex, &blendMode)             # <<<<<<<<<<<<<<
9703  *         if res < 0:
9704  *             raise error()
9705  */
9706   __pyx_v_res = SDL_GetTextureBlendMode(__pyx_v_self->_tex, (&__pyx_v_blendMode));
9707 
9708   /* "pygame/_sdl2/video.pyx":666
9709  *         cdef SDL_BlendMode blendMode
9710  *         res = SDL_GetTextureBlendMode(self._tex, &blendMode)
9711  *         if res < 0:             # <<<<<<<<<<<<<<
9712  *             raise error()
9713  *
9714  */
9715   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
9716   if (unlikely(__pyx_t_1)) {
9717 
9718     /* "pygame/_sdl2/video.pyx":667
9719  *         res = SDL_GetTextureBlendMode(self._tex, &blendMode)
9720  *         if res < 0:
9721  *             raise error()             # <<<<<<<<<<<<<<
9722  *
9723  *         return blendMode
9724  */
9725     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error)
9726     __Pyx_GOTREF(__pyx_t_3);
9727     __pyx_t_4 = NULL;
9728     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9729       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9730       if (likely(__pyx_t_4)) {
9731         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9732         __Pyx_INCREF(__pyx_t_4);
9733         __Pyx_INCREF(function);
9734         __Pyx_DECREF_SET(__pyx_t_3, function);
9735       }
9736     }
9737     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9738     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9739     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error)
9740     __Pyx_GOTREF(__pyx_t_2);
9741     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9742     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9743     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9744     __PYX_ERR(0, 667, __pyx_L1_error)
9745 
9746     /* "pygame/_sdl2/video.pyx":666
9747  *         cdef SDL_BlendMode blendMode
9748  *         res = SDL_GetTextureBlendMode(self._tex, &blendMode)
9749  *         if res < 0:             # <<<<<<<<<<<<<<
9750  *             raise error()
9751  *
9752  */
9753   }
9754 
9755   /* "pygame/_sdl2/video.pyx":669
9756  *             raise error()
9757  *
9758  *         return blendMode             # <<<<<<<<<<<<<<
9759  *
9760  *     @blend_mode.setter
9761  */
9762   __Pyx_XDECREF(__pyx_r);
9763   __pyx_t_2 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_blendMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
9764   __Pyx_GOTREF(__pyx_t_2);
9765   __pyx_r = __pyx_t_2;
9766   __pyx_t_2 = 0;
9767   goto __pyx_L0;
9768 
9769   /* "pygame/_sdl2/video.pyx":662
9770  *
9771  *     @property
9772  *     def blend_mode(self):             # <<<<<<<<<<<<<<
9773  *         # https://wiki.libsdl.org/SDL_GetTextureBlendMode
9774  *         cdef SDL_BlendMode blendMode
9775  */
9776 
9777   /* function exit code */
9778   __pyx_L1_error:;
9779   __Pyx_XDECREF(__pyx_t_2);
9780   __Pyx_XDECREF(__pyx_t_3);
9781   __Pyx_XDECREF(__pyx_t_4);
9782   __Pyx_AddTraceback("pygame._sdl2.video.Texture.blend_mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9783   __pyx_r = NULL;
9784   __pyx_L0:;
9785   __Pyx_XGIVEREF(__pyx_r);
9786   __Pyx_RefNannyFinishContext();
9787   return __pyx_r;
9788 }
9789 
9790 /* "pygame/_sdl2/video.pyx":672
9791  *
9792  *     @blend_mode.setter
9793  *     def blend_mode(self, blendMode):             # <<<<<<<<<<<<<<
9794  *         # https://wiki.libsdl.org/SDL_SetTextureBlendMode
9795  *         res = SDL_SetTextureBlendMode(self._tex, blendMode)
9796  */
9797 
9798 /* Python wrapper */
9799 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_blendMode); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_blendMode)9800 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_blendMode) {
9801   int __pyx_r;
9802   __Pyx_RefNannyDeclarations
9803   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
9804   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), ((PyObject *)__pyx_v_blendMode));
9805 
9806   /* function exit code */
9807   __Pyx_RefNannyFinishContext();
9808   return __pyx_r;
9809 }
9810 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,PyObject * __pyx_v_blendMode)9811 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_10blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_blendMode) {
9812   int __pyx_v_res;
9813   int __pyx_r;
9814   __Pyx_RefNannyDeclarations
9815   SDL_BlendMode __pyx_t_1;
9816   int __pyx_t_2;
9817   PyObject *__pyx_t_3 = NULL;
9818   PyObject *__pyx_t_4 = NULL;
9819   PyObject *__pyx_t_5 = NULL;
9820   int __pyx_lineno = 0;
9821   const char *__pyx_filename = NULL;
9822   int __pyx_clineno = 0;
9823   __Pyx_RefNannySetupContext("__set__", 0);
9824 
9825   /* "pygame/_sdl2/video.pyx":674
9826  *     def blend_mode(self, blendMode):
9827  *         # https://wiki.libsdl.org/SDL_SetTextureBlendMode
9828  *         res = SDL_SetTextureBlendMode(self._tex, blendMode)             # <<<<<<<<<<<<<<
9829  *         if res < 0:
9830  *             raise error()
9831  */
9832   __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_blendMode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 674, __pyx_L1_error)
9833   __pyx_v_res = SDL_SetTextureBlendMode(__pyx_v_self->_tex, __pyx_t_1);
9834 
9835   /* "pygame/_sdl2/video.pyx":675
9836  *         # https://wiki.libsdl.org/SDL_SetTextureBlendMode
9837  *         res = SDL_SetTextureBlendMode(self._tex, blendMode)
9838  *         if res < 0:             # <<<<<<<<<<<<<<
9839  *             raise error()
9840  *
9841  */
9842   __pyx_t_2 = ((__pyx_v_res < 0) != 0);
9843   if (unlikely(__pyx_t_2)) {
9844 
9845     /* "pygame/_sdl2/video.pyx":676
9846  *         res = SDL_SetTextureBlendMode(self._tex, blendMode)
9847  *         if res < 0:
9848  *             raise error()             # <<<<<<<<<<<<<<
9849  *
9850  *     @property
9851  */
9852     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error)
9853     __Pyx_GOTREF(__pyx_t_4);
9854     __pyx_t_5 = NULL;
9855     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9856       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9857       if (likely(__pyx_t_5)) {
9858         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9859         __Pyx_INCREF(__pyx_t_5);
9860         __Pyx_INCREF(function);
9861         __Pyx_DECREF_SET(__pyx_t_4, function);
9862       }
9863     }
9864     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9865     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9866     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error)
9867     __Pyx_GOTREF(__pyx_t_3);
9868     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9869     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9870     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9871     __PYX_ERR(0, 676, __pyx_L1_error)
9872 
9873     /* "pygame/_sdl2/video.pyx":675
9874  *         # https://wiki.libsdl.org/SDL_SetTextureBlendMode
9875  *         res = SDL_SetTextureBlendMode(self._tex, blendMode)
9876  *         if res < 0:             # <<<<<<<<<<<<<<
9877  *             raise error()
9878  *
9879  */
9880   }
9881 
9882   /* "pygame/_sdl2/video.pyx":672
9883  *
9884  *     @blend_mode.setter
9885  *     def blend_mode(self, blendMode):             # <<<<<<<<<<<<<<
9886  *         # https://wiki.libsdl.org/SDL_SetTextureBlendMode
9887  *         res = SDL_SetTextureBlendMode(self._tex, blendMode)
9888  */
9889 
9890   /* function exit code */
9891   __pyx_r = 0;
9892   goto __pyx_L0;
9893   __pyx_L1_error:;
9894   __Pyx_XDECREF(__pyx_t_3);
9895   __Pyx_XDECREF(__pyx_t_4);
9896   __Pyx_XDECREF(__pyx_t_5);
9897   __Pyx_AddTraceback("pygame._sdl2.video.Texture.blend_mode.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9898   __pyx_r = -1;
9899   __pyx_L0:;
9900   __Pyx_RefNannyFinishContext();
9901   return __pyx_r;
9902 }
9903 
9904 /* "pygame/_sdl2/video.pyx":679
9905  *
9906  *     @property
9907  *     def color(self):             # <<<<<<<<<<<<<<
9908  *         # https://wiki.libsdl.org/SDL_GetTextureColorMod
9909  *         res = SDL_GetTextureColorMod(self._tex,
9910  */
9911 
9912 /* Python wrapper */
9913 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_1__get__(PyObject * __pyx_v_self)9914 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_1__get__(PyObject *__pyx_v_self) {
9915   PyObject *__pyx_r = 0;
9916   __Pyx_RefNannyDeclarations
9917   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9918   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
9919 
9920   /* function exit code */
9921   __Pyx_RefNannyFinishContext();
9922   return __pyx_r;
9923 }
9924 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)9925 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
9926   int __pyx_v_res;
9927   PyObject *__pyx_r = NULL;
9928   __Pyx_RefNannyDeclarations
9929   int __pyx_t_1;
9930   PyObject *__pyx_t_2 = NULL;
9931   PyObject *__pyx_t_3 = NULL;
9932   PyObject *__pyx_t_4 = NULL;
9933   int __pyx_lineno = 0;
9934   const char *__pyx_filename = NULL;
9935   int __pyx_clineno = 0;
9936   __Pyx_RefNannySetupContext("__get__", 0);
9937 
9938   /* "pygame/_sdl2/video.pyx":681
9939  *     def color(self):
9940  *         # https://wiki.libsdl.org/SDL_GetTextureColorMod
9941  *         res = SDL_GetTextureColorMod(self._tex,             # <<<<<<<<<<<<<<
9942  *             &self._color.data[0],
9943  *             &self._color.data[1],
9944  */
9945   __pyx_v_res = SDL_GetTextureColorMod(__pyx_v_self->_tex, (&(__pyx_v_self->_color->data[0])), (&(__pyx_v_self->_color->data[1])), (&(__pyx_v_self->_color->data[2])));
9946 
9947   /* "pygame/_sdl2/video.pyx":685
9948  *             &self._color.data[1],
9949  *             &self._color.data[2])
9950  *         if res < 0:             # <<<<<<<<<<<<<<
9951  *             raise error()
9952  *
9953  */
9954   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
9955   if (unlikely(__pyx_t_1)) {
9956 
9957     /* "pygame/_sdl2/video.pyx":686
9958  *             &self._color.data[2])
9959  *         if res < 0:
9960  *             raise error()             # <<<<<<<<<<<<<<
9961  *
9962  *         return self._color
9963  */
9964     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L1_error)
9965     __Pyx_GOTREF(__pyx_t_3);
9966     __pyx_t_4 = NULL;
9967     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9968       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9969       if (likely(__pyx_t_4)) {
9970         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9971         __Pyx_INCREF(__pyx_t_4);
9972         __Pyx_INCREF(function);
9973         __Pyx_DECREF_SET(__pyx_t_3, function);
9974       }
9975     }
9976     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9977     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9978     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
9979     __Pyx_GOTREF(__pyx_t_2);
9980     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9981     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9982     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9983     __PYX_ERR(0, 686, __pyx_L1_error)
9984 
9985     /* "pygame/_sdl2/video.pyx":685
9986  *             &self._color.data[1],
9987  *             &self._color.data[2])
9988  *         if res < 0:             # <<<<<<<<<<<<<<
9989  *             raise error()
9990  *
9991  */
9992   }
9993 
9994   /* "pygame/_sdl2/video.pyx":688
9995  *             raise error()
9996  *
9997  *         return self._color             # <<<<<<<<<<<<<<
9998  *
9999  *     @color.setter
10000  */
10001   __Pyx_XDECREF(__pyx_r);
10002   __Pyx_INCREF(((PyObject *)__pyx_v_self->_color));
10003   __pyx_r = ((PyObject *)__pyx_v_self->_color);
10004   goto __pyx_L0;
10005 
10006   /* "pygame/_sdl2/video.pyx":679
10007  *
10008  *     @property
10009  *     def color(self):             # <<<<<<<<<<<<<<
10010  *         # https://wiki.libsdl.org/SDL_GetTextureColorMod
10011  *         res = SDL_GetTextureColorMod(self._tex,
10012  */
10013 
10014   /* function exit code */
10015   __pyx_L1_error:;
10016   __Pyx_XDECREF(__pyx_t_2);
10017   __Pyx_XDECREF(__pyx_t_3);
10018   __Pyx_XDECREF(__pyx_t_4);
10019   __Pyx_AddTraceback("pygame._sdl2.video.Texture.color.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10020   __pyx_r = NULL;
10021   __pyx_L0:;
10022   __Pyx_XGIVEREF(__pyx_r);
10023   __Pyx_RefNannyFinishContext();
10024   return __pyx_r;
10025 }
10026 
10027 /* "pygame/_sdl2/video.pyx":691
10028  *
10029  *     @color.setter
10030  *     def color(self, new_value):             # <<<<<<<<<<<<<<
10031  *         # https://wiki.libsdl.org/SDL_SetTextureColorMod
10032  *         res = SDL_SetTextureColorMod(self._tex,
10033  */
10034 
10035 /* Python wrapper */
10036 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_new_value)10037 static int __pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_value) {
10038   int __pyx_r;
10039   __Pyx_RefNannyDeclarations
10040   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
10041   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), ((PyObject *)__pyx_v_new_value));
10042 
10043   /* function exit code */
10044   __Pyx_RefNannyFinishContext();
10045   return __pyx_r;
10046 }
10047 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,PyObject * __pyx_v_new_value)10048 static int __pyx_pf_6pygame_5_sdl2_5video_7Texture_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_new_value) {
10049   int __pyx_v_res;
10050   int __pyx_r;
10051   __Pyx_RefNannyDeclarations
10052   PyObject *__pyx_t_1 = NULL;
10053   Uint8 __pyx_t_2;
10054   Uint8 __pyx_t_3;
10055   Uint8 __pyx_t_4;
10056   int __pyx_t_5;
10057   PyObject *__pyx_t_6 = NULL;
10058   PyObject *__pyx_t_7 = NULL;
10059   int __pyx_lineno = 0;
10060   const char *__pyx_filename = NULL;
10061   int __pyx_clineno = 0;
10062   __Pyx_RefNannySetupContext("__set__", 0);
10063 
10064   /* "pygame/_sdl2/video.pyx":694
10065  *         # https://wiki.libsdl.org/SDL_SetTextureColorMod
10066  *         res = SDL_SetTextureColorMod(self._tex,
10067  *                                      new_value[0],             # <<<<<<<<<<<<<<
10068  *                                      new_value[1],
10069  *                                      new_value[2])
10070  */
10071   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error)
10072   __Pyx_GOTREF(__pyx_t_1);
10073   __pyx_t_2 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_2 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L1_error)
10074   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10075 
10076   /* "pygame/_sdl2/video.pyx":695
10077  *         res = SDL_SetTextureColorMod(self._tex,
10078  *                                      new_value[0],
10079  *                                      new_value[1],             # <<<<<<<<<<<<<<
10080  *                                      new_value[2])
10081  *         if res < 0:
10082  */
10083   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error)
10084   __Pyx_GOTREF(__pyx_t_1);
10085   __pyx_t_3 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_3 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L1_error)
10086   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10087 
10088   /* "pygame/_sdl2/video.pyx":696
10089  *                                      new_value[0],
10090  *                                      new_value[1],
10091  *                                      new_value[2])             # <<<<<<<<<<<<<<
10092  *         if res < 0:
10093  *             raise error()
10094  */
10095   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error)
10096   __Pyx_GOTREF(__pyx_t_1);
10097   __pyx_t_4 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_4 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L1_error)
10098   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10099 
10100   /* "pygame/_sdl2/video.pyx":693
10101  *     def color(self, new_value):
10102  *         # https://wiki.libsdl.org/SDL_SetTextureColorMod
10103  *         res = SDL_SetTextureColorMod(self._tex,             # <<<<<<<<<<<<<<
10104  *                                      new_value[0],
10105  *                                      new_value[1],
10106  */
10107   __pyx_v_res = SDL_SetTextureColorMod(__pyx_v_self->_tex, __pyx_t_2, __pyx_t_3, __pyx_t_4);
10108 
10109   /* "pygame/_sdl2/video.pyx":697
10110  *                                      new_value[1],
10111  *                                      new_value[2])
10112  *         if res < 0:             # <<<<<<<<<<<<<<
10113  *             raise error()
10114  *
10115  */
10116   __pyx_t_5 = ((__pyx_v_res < 0) != 0);
10117   if (unlikely(__pyx_t_5)) {
10118 
10119     /* "pygame/_sdl2/video.pyx":698
10120  *                                      new_value[2])
10121  *         if res < 0:
10122  *             raise error()             # <<<<<<<<<<<<<<
10123  *
10124  *     def get_rect(self, **kwargs):
10125  */
10126     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 698, __pyx_L1_error)
10127     __Pyx_GOTREF(__pyx_t_6);
10128     __pyx_t_7 = NULL;
10129     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
10130       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
10131       if (likely(__pyx_t_7)) {
10132         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
10133         __Pyx_INCREF(__pyx_t_7);
10134         __Pyx_INCREF(function);
10135         __Pyx_DECREF_SET(__pyx_t_6, function);
10136       }
10137     }
10138     __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
10139     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10140     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error)
10141     __Pyx_GOTREF(__pyx_t_1);
10142     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10143     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10144     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10145     __PYX_ERR(0, 698, __pyx_L1_error)
10146 
10147     /* "pygame/_sdl2/video.pyx":697
10148  *                                      new_value[1],
10149  *                                      new_value[2])
10150  *         if res < 0:             # <<<<<<<<<<<<<<
10151  *             raise error()
10152  *
10153  */
10154   }
10155 
10156   /* "pygame/_sdl2/video.pyx":691
10157  *
10158  *     @color.setter
10159  *     def color(self, new_value):             # <<<<<<<<<<<<<<
10160  *         # https://wiki.libsdl.org/SDL_SetTextureColorMod
10161  *         res = SDL_SetTextureColorMod(self._tex,
10162  */
10163 
10164   /* function exit code */
10165   __pyx_r = 0;
10166   goto __pyx_L0;
10167   __pyx_L1_error:;
10168   __Pyx_XDECREF(__pyx_t_1);
10169   __Pyx_XDECREF(__pyx_t_6);
10170   __Pyx_XDECREF(__pyx_t_7);
10171   __Pyx_AddTraceback("pygame._sdl2.video.Texture.color.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10172   __pyx_r = -1;
10173   __pyx_L0:;
10174   __Pyx_RefNannyFinishContext();
10175   return __pyx_r;
10176 }
10177 
10178 /* "pygame/_sdl2/video.pyx":700
10179  *             raise error()
10180  *
10181  *     def get_rect(self, **kwargs):             # <<<<<<<<<<<<<<
10182  *         """ Get the rectangular area of the texture.
10183  *         like surface.get_rect(), returns a new rectangle covering the entire surface.
10184  */
10185 
10186 /* Python wrapper */
10187 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_9get_rect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10188 static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_8get_rect[] = " Get the rectangular area of the texture.\n        like surface.get_rect(), returns a new rectangle covering the entire surface.\n        This rectangle will always start at 0, 0 with a width. and height the same size as the texture.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_7Texture_9get_rect(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10189 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_9get_rect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10190   PyObject *__pyx_v_kwargs = 0;
10191   PyObject *__pyx_r = 0;
10192   __Pyx_RefNannyDeclarations
10193   __Pyx_RefNannySetupContext("get_rect (wrapper)", 0);
10194   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
10195     __Pyx_RaiseArgtupleInvalid("get_rect", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;}
10196   if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "get_rect", 1))) return NULL;
10197   __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
10198   __Pyx_GOTREF(__pyx_v_kwargs);
10199   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_kwargs);
10200 
10201   /* function exit code */
10202   __Pyx_XDECREF(__pyx_v_kwargs);
10203   __Pyx_RefNannyFinishContext();
10204   return __pyx_r;
10205 }
10206 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,PyObject * __pyx_v_kwargs)10207 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8get_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_kwargs) {
10208   PyObject *__pyx_v_rect = NULL;
10209   PyObject *__pyx_v_key = NULL;
10210   PyObject *__pyx_r = NULL;
10211   __Pyx_RefNannyDeclarations
10212   PyObject *__pyx_t_1 = NULL;
10213   Py_ssize_t __pyx_t_2;
10214   Py_ssize_t __pyx_t_3;
10215   int __pyx_t_4;
10216   PyObject *__pyx_t_5 = NULL;
10217   int __pyx_t_6;
10218   int __pyx_t_7;
10219   int __pyx_lineno = 0;
10220   const char *__pyx_filename = NULL;
10221   int __pyx_clineno = 0;
10222   __Pyx_RefNannySetupContext("get_rect", 0);
10223 
10224   /* "pygame/_sdl2/video.pyx":705
10225  *         This rectangle will always start at 0, 0 with a width. and height the same size as the texture.
10226  *         """
10227  *         rect = pgRect_New4(0, 0, self.width, self.height)             # <<<<<<<<<<<<<<
10228  *         for key in kwargs:
10229  *             setattr(rect, key, kwargs[key])
10230  */
10231   __pyx_t_1 = pgRect_New4(0, 0, __pyx_v_self->width, __pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
10232   __Pyx_GOTREF(__pyx_t_1);
10233   __pyx_v_rect = __pyx_t_1;
10234   __pyx_t_1 = 0;
10235 
10236   /* "pygame/_sdl2/video.pyx":706
10237  *         """
10238  *         rect = pgRect_New4(0, 0, self.width, self.height)
10239  *         for key in kwargs:             # <<<<<<<<<<<<<<
10240  *             setattr(rect, key, kwargs[key])
10241  *
10242  */
10243   __pyx_t_2 = 0;
10244   __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 706, __pyx_L1_error)
10245   __Pyx_GOTREF(__pyx_t_5);
10246   __Pyx_XDECREF(__pyx_t_1);
10247   __pyx_t_1 = __pyx_t_5;
10248   __pyx_t_5 = 0;
10249   while (1) {
10250     __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, NULL, NULL, __pyx_t_4);
10251     if (unlikely(__pyx_t_6 == 0)) break;
10252     if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 706, __pyx_L1_error)
10253     __Pyx_GOTREF(__pyx_t_5);
10254     __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5);
10255     __pyx_t_5 = 0;
10256 
10257     /* "pygame/_sdl2/video.pyx":707
10258  *         rect = pgRect_New4(0, 0, self.width, self.height)
10259  *         for key in kwargs:
10260  *             setattr(rect, key, kwargs[key])             # <<<<<<<<<<<<<<
10261  *
10262  *         return rect
10263  */
10264     __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 707, __pyx_L1_error)
10265     __Pyx_GOTREF(__pyx_t_5);
10266     __pyx_t_7 = PyObject_SetAttr(__pyx_v_rect, __pyx_v_key, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 707, __pyx_L1_error)
10267     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10268   }
10269   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10270 
10271   /* "pygame/_sdl2/video.pyx":709
10272  *             setattr(rect, key, kwargs[key])
10273  *
10274  *         return rect             # <<<<<<<<<<<<<<
10275  *
10276  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,
10277  */
10278   __Pyx_XDECREF(__pyx_r);
10279   __Pyx_INCREF(__pyx_v_rect);
10280   __pyx_r = __pyx_v_rect;
10281   goto __pyx_L0;
10282 
10283   /* "pygame/_sdl2/video.pyx":700
10284  *             raise error()
10285  *
10286  *     def get_rect(self, **kwargs):             # <<<<<<<<<<<<<<
10287  *         """ Get the rectangular area of the texture.
10288  *         like surface.get_rect(), returns a new rectangle covering the entire surface.
10289  */
10290 
10291   /* function exit code */
10292   __pyx_L1_error:;
10293   __Pyx_XDECREF(__pyx_t_1);
10294   __Pyx_XDECREF(__pyx_t_5);
10295   __Pyx_AddTraceback("pygame._sdl2.video.Texture.get_rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
10296   __pyx_r = NULL;
10297   __pyx_L0:;
10298   __Pyx_XDECREF(__pyx_v_rect);
10299   __Pyx_XDECREF(__pyx_v_key);
10300   __Pyx_XGIVEREF(__pyx_r);
10301   __Pyx_RefNannyFinishContext();
10302   return __pyx_r;
10303 }
10304 
10305 /* "pygame/_sdl2/video.pyx":711
10306  *         return rect
10307  *
10308  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,             # <<<<<<<<<<<<<<
10309  *                        bint flipX=False, bint flipY=False):
10310  *         cdef int flip = SDL_FLIP_NONE
10311  */
10312 
__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,SDL_Rect * __pyx_v_csrcrect,SDL_Rect * __pyx_v_cdstrect,struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal * __pyx_optional_args)10313 static PyObject *__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, SDL_Rect *__pyx_v_csrcrect, SDL_Rect *__pyx_v_cdstrect, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal *__pyx_optional_args) {
10314   float __pyx_v_angle = ((float)0.0);
10315   SDL_Point *__pyx_v_originptr = ((SDL_Point *)NULL);
10316 
10317   /* "pygame/_sdl2/video.pyx":712
10318  *
10319  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,
10320  *                        bint flipX=False, bint flipY=False):             # <<<<<<<<<<<<<<
10321  *         cdef int flip = SDL_FLIP_NONE
10322  *         if flipX:
10323  */
10324   int __pyx_v_flipX = ((int)0);
10325   int __pyx_v_flipY = ((int)0);
10326   int __pyx_v_flip;
10327   int __pyx_v_res;
10328   PyObject *__pyx_r = NULL;
10329   __Pyx_RefNannyDeclarations
10330   int __pyx_t_1;
10331   PyObject *__pyx_t_2 = NULL;
10332   PyObject *__pyx_t_3 = NULL;
10333   PyObject *__pyx_t_4 = NULL;
10334   int __pyx_lineno = 0;
10335   const char *__pyx_filename = NULL;
10336   int __pyx_clineno = 0;
10337   __Pyx_RefNannySetupContext("draw_internal", 0);
10338   if (__pyx_optional_args) {
10339     if (__pyx_optional_args->__pyx_n > 0) {
10340       __pyx_v_angle = __pyx_optional_args->angle;
10341       if (__pyx_optional_args->__pyx_n > 1) {
10342         __pyx_v_originptr = __pyx_optional_args->originptr;
10343         if (__pyx_optional_args->__pyx_n > 2) {
10344           __pyx_v_flipX = __pyx_optional_args->flipX;
10345           if (__pyx_optional_args->__pyx_n > 3) {
10346             __pyx_v_flipY = __pyx_optional_args->flipY;
10347           }
10348         }
10349       }
10350     }
10351   }
10352 
10353   /* "pygame/_sdl2/video.pyx":713
10354  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,
10355  *                        bint flipX=False, bint flipY=False):
10356  *         cdef int flip = SDL_FLIP_NONE             # <<<<<<<<<<<<<<
10357  *         if flipX:
10358  *             flip |= SDL_FLIP_HORIZONTAL
10359  */
10360   __pyx_v_flip = SDL_FLIP_NONE;
10361 
10362   /* "pygame/_sdl2/video.pyx":714
10363  *                        bint flipX=False, bint flipY=False):
10364  *         cdef int flip = SDL_FLIP_NONE
10365  *         if flipX:             # <<<<<<<<<<<<<<
10366  *             flip |= SDL_FLIP_HORIZONTAL
10367  *         if flipY:
10368  */
10369   __pyx_t_1 = (__pyx_v_flipX != 0);
10370   if (__pyx_t_1) {
10371 
10372     /* "pygame/_sdl2/video.pyx":715
10373  *         cdef int flip = SDL_FLIP_NONE
10374  *         if flipX:
10375  *             flip |= SDL_FLIP_HORIZONTAL             # <<<<<<<<<<<<<<
10376  *         if flipY:
10377  *             flip |= SDL_FLIP_VERTICAL
10378  */
10379     __pyx_v_flip = (__pyx_v_flip | SDL_FLIP_HORIZONTAL);
10380 
10381     /* "pygame/_sdl2/video.pyx":714
10382  *                        bint flipX=False, bint flipY=False):
10383  *         cdef int flip = SDL_FLIP_NONE
10384  *         if flipX:             # <<<<<<<<<<<<<<
10385  *             flip |= SDL_FLIP_HORIZONTAL
10386  *         if flipY:
10387  */
10388   }
10389 
10390   /* "pygame/_sdl2/video.pyx":716
10391  *         if flipX:
10392  *             flip |= SDL_FLIP_HORIZONTAL
10393  *         if flipY:             # <<<<<<<<<<<<<<
10394  *             flip |= SDL_FLIP_VERTICAL
10395  *
10396  */
10397   __pyx_t_1 = (__pyx_v_flipY != 0);
10398   if (__pyx_t_1) {
10399 
10400     /* "pygame/_sdl2/video.pyx":717
10401  *             flip |= SDL_FLIP_HORIZONTAL
10402  *         if flipY:
10403  *             flip |= SDL_FLIP_VERTICAL             # <<<<<<<<<<<<<<
10404  *
10405  *         res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect,
10406  */
10407     __pyx_v_flip = (__pyx_v_flip | SDL_FLIP_VERTICAL);
10408 
10409     /* "pygame/_sdl2/video.pyx":716
10410  *         if flipX:
10411  *             flip |= SDL_FLIP_HORIZONTAL
10412  *         if flipY:             # <<<<<<<<<<<<<<
10413  *             flip |= SDL_FLIP_VERTICAL
10414  *
10415  */
10416   }
10417 
10418   /* "pygame/_sdl2/video.pyx":719
10419  *             flip |= SDL_FLIP_VERTICAL
10420  *
10421  *         res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect,             # <<<<<<<<<<<<<<
10422  *                                angle, originptr, <SDL_RendererFlip>flip)
10423  *         if res < 0:
10424  */
10425   __pyx_v_res = SDL_RenderCopyEx(__pyx_v_self->renderer->_renderer, __pyx_v_self->_tex, __pyx_v_csrcrect, __pyx_v_cdstrect, __pyx_v_angle, __pyx_v_originptr, ((SDL_RendererFlip)__pyx_v_flip));
10426 
10427   /* "pygame/_sdl2/video.pyx":721
10428  *         res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect,
10429  *                                angle, originptr, <SDL_RendererFlip>flip)
10430  *         if res < 0:             # <<<<<<<<<<<<<<
10431  *             raise error()
10432  *
10433  */
10434   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
10435   if (unlikely(__pyx_t_1)) {
10436 
10437     /* "pygame/_sdl2/video.pyx":722
10438  *                                angle, originptr, <SDL_RendererFlip>flip)
10439  *         if res < 0:
10440  *             raise error()             # <<<<<<<<<<<<<<
10441  *
10442  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
10443  */
10444     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 722, __pyx_L1_error)
10445     __Pyx_GOTREF(__pyx_t_3);
10446     __pyx_t_4 = NULL;
10447     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10448       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
10449       if (likely(__pyx_t_4)) {
10450         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10451         __Pyx_INCREF(__pyx_t_4);
10452         __Pyx_INCREF(function);
10453         __Pyx_DECREF_SET(__pyx_t_3, function);
10454       }
10455     }
10456     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
10457     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10458     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error)
10459     __Pyx_GOTREF(__pyx_t_2);
10460     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10461     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10462     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10463     __PYX_ERR(0, 722, __pyx_L1_error)
10464 
10465     /* "pygame/_sdl2/video.pyx":721
10466  *         res = SDL_RenderCopyEx(self.renderer._renderer, self._tex, csrcrect, cdstrect,
10467  *                                angle, originptr, <SDL_RendererFlip>flip)
10468  *         if res < 0:             # <<<<<<<<<<<<<<
10469  *             raise error()
10470  *
10471  */
10472   }
10473 
10474   /* "pygame/_sdl2/video.pyx":711
10475  *         return rect
10476  *
10477  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=0, SDL_Point *originptr=NULL,             # <<<<<<<<<<<<<<
10478  *                        bint flipX=False, bint flipY=False):
10479  *         cdef int flip = SDL_FLIP_NONE
10480  */
10481 
10482   /* function exit code */
10483   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10484   goto __pyx_L0;
10485   __pyx_L1_error:;
10486   __Pyx_XDECREF(__pyx_t_2);
10487   __Pyx_XDECREF(__pyx_t_3);
10488   __Pyx_XDECREF(__pyx_t_4);
10489   __Pyx_AddTraceback("pygame._sdl2.video.Texture.draw_internal", __pyx_clineno, __pyx_lineno, __pyx_filename);
10490   __pyx_r = 0;
10491   __pyx_L0:;
10492   __Pyx_XGIVEREF(__pyx_r);
10493   __Pyx_RefNannyFinishContext();
10494   return __pyx_r;
10495 }
10496 
10497 /* "pygame/_sdl2/video.pyx":724
10498  *             raise error()
10499  *
10500  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,             # <<<<<<<<<<<<<<
10501  *                     bint flipX=False, bint flipY=False):
10502  *         """ Copy a portion of the texture to the rendering target.
10503  */
10504 
10505 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,int __pyx_skip_dispatch,struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw * __pyx_optional_args)10506 static void __pyx_f_6pygame_5_sdl2_5video_7Texture_draw(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw *__pyx_optional_args) {
10507   PyObject *__pyx_v_srcrect = ((PyObject *)Py_None);
10508   PyObject *__pyx_v_dstrect = ((PyObject *)Py_None);
10509   float __pyx_v_angle = ((float)0.0);
10510   PyObject *__pyx_v_origin = ((PyObject *)Py_None);
10511 
10512   /* "pygame/_sdl2/video.pyx":725
10513  *
10514  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
10515  *                     bint flipX=False, bint flipY=False):             # <<<<<<<<<<<<<<
10516  *         """ Copy a portion of the texture to the rendering target.
10517  *
10518  */
10519   int __pyx_v_flipX = ((int)0);
10520   int __pyx_v_flipY = ((int)0);
10521   SDL_Rect __pyx_v_src;
10522   SDL_Rect __pyx_v_dst;
10523   SDL_Rect *__pyx_v_csrcrect;
10524   SDL_Rect *__pyx_v_cdstrect;
10525   SDL_Point __pyx_v_corigin;
10526   SDL_Point *__pyx_v_originptr;
10527   __Pyx_RefNannyDeclarations
10528   PyObject *__pyx_t_1 = NULL;
10529   PyObject *__pyx_t_2 = NULL;
10530   PyObject *__pyx_t_3 = NULL;
10531   PyObject *__pyx_t_4 = NULL;
10532   PyObject *__pyx_t_5 = NULL;
10533   PyObject *__pyx_t_6 = NULL;
10534   PyObject *__pyx_t_7 = NULL;
10535   int __pyx_t_8;
10536   PyObject *__pyx_t_9 = NULL;
10537   int __pyx_t_10;
10538   int __pyx_t_11;
10539   Py_ssize_t __pyx_t_12;
10540   struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal __pyx_t_13;
10541   int __pyx_lineno = 0;
10542   const char *__pyx_filename = NULL;
10543   int __pyx_clineno = 0;
10544   __Pyx_RefNannySetupContext("draw", 0);
10545   if (__pyx_optional_args) {
10546     if (__pyx_optional_args->__pyx_n > 0) {
10547       __pyx_v_srcrect = __pyx_optional_args->srcrect;
10548       if (__pyx_optional_args->__pyx_n > 1) {
10549         __pyx_v_dstrect = __pyx_optional_args->dstrect;
10550         if (__pyx_optional_args->__pyx_n > 2) {
10551           __pyx_v_angle = __pyx_optional_args->angle;
10552           if (__pyx_optional_args->__pyx_n > 3) {
10553             __pyx_v_origin = __pyx_optional_args->origin;
10554             if (__pyx_optional_args->__pyx_n > 4) {
10555               __pyx_v_flipX = __pyx_optional_args->flipX;
10556               if (__pyx_optional_args->__pyx_n > 5) {
10557                 __pyx_v_flipY = __pyx_optional_args->flipY;
10558               }
10559             }
10560           }
10561         }
10562       }
10563     }
10564   }
10565 
10566   /* "pygame/_sdl2/video.pyx":724
10567  *             raise error()
10568  *
10569  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,             # <<<<<<<<<<<<<<
10570  *                     bint flipX=False, bint flipY=False):
10571  *         """ Copy a portion of the texture to the rendering target.
10572  */
10573   /* Check if called by wrapper */
10574   if (unlikely(__pyx_skip_dispatch)) ;
10575   /* Check if overridden in Python */
10576   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
10577     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10578     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
10579     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
10580       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
10581       #endif
10582       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
10583       __Pyx_GOTREF(__pyx_t_1);
10584       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw)) {
10585         __pyx_t_3 = PyFloat_FromDouble(__pyx_v_angle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error)
10586         __Pyx_GOTREF(__pyx_t_3);
10587         __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_flipX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error)
10588         __Pyx_GOTREF(__pyx_t_4);
10589         __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_flipY); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error)
10590         __Pyx_GOTREF(__pyx_t_5);
10591         __Pyx_INCREF(__pyx_t_1);
10592         __pyx_t_6 = __pyx_t_1; __pyx_t_7 = NULL;
10593         __pyx_t_8 = 0;
10594         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
10595           __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
10596           if (likely(__pyx_t_7)) {
10597             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
10598             __Pyx_INCREF(__pyx_t_7);
10599             __Pyx_INCREF(function);
10600             __Pyx_DECREF_SET(__pyx_t_6, function);
10601             __pyx_t_8 = 1;
10602           }
10603         }
10604         #if CYTHON_FAST_PYCALL
10605         if (PyFunction_Check(__pyx_t_6)) {
10606           PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_v_srcrect, __pyx_v_dstrect, __pyx_t_3, __pyx_v_origin, __pyx_t_4, __pyx_t_5};
10607           __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
10608           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10609           __Pyx_GOTREF(__pyx_t_2);
10610           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10611           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10612           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10613         } else
10614         #endif
10615         #if CYTHON_FAST_PYCCALL
10616         if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
10617           PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_v_srcrect, __pyx_v_dstrect, __pyx_t_3, __pyx_v_origin, __pyx_t_4, __pyx_t_5};
10618           __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
10619           __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10620           __Pyx_GOTREF(__pyx_t_2);
10621           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10622           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10623           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10624         } else
10625         #endif
10626         {
10627           __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 724, __pyx_L1_error)
10628           __Pyx_GOTREF(__pyx_t_9);
10629           if (__pyx_t_7) {
10630             __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
10631           }
10632           __Pyx_INCREF(__pyx_v_srcrect);
10633           __Pyx_GIVEREF(__pyx_v_srcrect);
10634           PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_srcrect);
10635           __Pyx_INCREF(__pyx_v_dstrect);
10636           __Pyx_GIVEREF(__pyx_v_dstrect);
10637           PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_dstrect);
10638           __Pyx_GIVEREF(__pyx_t_3);
10639           PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_3);
10640           __Pyx_INCREF(__pyx_v_origin);
10641           __Pyx_GIVEREF(__pyx_v_origin);
10642           PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_v_origin);
10643           __Pyx_GIVEREF(__pyx_t_4);
10644           PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_t_4);
10645           __Pyx_GIVEREF(__pyx_t_5);
10646           PyTuple_SET_ITEM(__pyx_t_9, 5+__pyx_t_8, __pyx_t_5);
10647           __pyx_t_3 = 0;
10648           __pyx_t_4 = 0;
10649           __pyx_t_5 = 0;
10650           __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
10651           __Pyx_GOTREF(__pyx_t_2);
10652           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10653         }
10654         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10655         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10656         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10657         goto __pyx_L0;
10658       }
10659       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10660       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
10661       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
10662       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
10663         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
10664       }
10665       #endif
10666       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10667       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
10668     }
10669     #endif
10670   }
10671 
10672   /* "pygame/_sdl2/video.pyx":738
10673  *         """
10674  *         cdef SDL_Rect src, dst
10675  *         cdef SDL_Rect *csrcrect = NULL             # <<<<<<<<<<<<<<
10676  *         cdef SDL_Rect *cdstrect = NULL
10677  *         cdef SDL_Point corigin
10678  */
10679   __pyx_v_csrcrect = NULL;
10680 
10681   /* "pygame/_sdl2/video.pyx":739
10682  *         cdef SDL_Rect src, dst
10683  *         cdef SDL_Rect *csrcrect = NULL
10684  *         cdef SDL_Rect *cdstrect = NULL             # <<<<<<<<<<<<<<
10685  *         cdef SDL_Point corigin
10686  *         cdef SDL_Point *originptr
10687  */
10688   __pyx_v_cdstrect = NULL;
10689 
10690   /* "pygame/_sdl2/video.pyx":743
10691  *         cdef SDL_Point *originptr
10692  *
10693  *         if srcrect is not None:             # <<<<<<<<<<<<<<
10694  *             csrcrect = pgRect_FromObject(srcrect, &src)
10695  *             if not csrcrect:
10696  */
10697   __pyx_t_10 = (__pyx_v_srcrect != Py_None);
10698   __pyx_t_11 = (__pyx_t_10 != 0);
10699   if (__pyx_t_11) {
10700 
10701     /* "pygame/_sdl2/video.pyx":744
10702  *
10703  *         if srcrect is not None:
10704  *             csrcrect = pgRect_FromObject(srcrect, &src)             # <<<<<<<<<<<<<<
10705  *             if not csrcrect:
10706  *                 raise TypeError("the argument is not a rectangle or None")
10707  */
10708     __pyx_v_csrcrect = pgRect_FromObject(__pyx_v_srcrect, (&__pyx_v_src));
10709 
10710     /* "pygame/_sdl2/video.pyx":745
10711  *         if srcrect is not None:
10712  *             csrcrect = pgRect_FromObject(srcrect, &src)
10713  *             if not csrcrect:             # <<<<<<<<<<<<<<
10714  *                 raise TypeError("the argument is not a rectangle or None")
10715  *
10716  */
10717     __pyx_t_11 = ((!(__pyx_v_csrcrect != 0)) != 0);
10718     if (unlikely(__pyx_t_11)) {
10719 
10720       /* "pygame/_sdl2/video.pyx":746
10721  *             csrcrect = pgRect_FromObject(srcrect, &src)
10722  *             if not csrcrect:
10723  *                 raise TypeError("the argument is not a rectangle or None")             # <<<<<<<<<<<<<<
10724  *
10725  *         if dstrect is not None:
10726  */
10727       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
10728       __Pyx_GOTREF(__pyx_t_1);
10729       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10730       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10731       __PYX_ERR(0, 746, __pyx_L1_error)
10732 
10733       /* "pygame/_sdl2/video.pyx":745
10734  *         if srcrect is not None:
10735  *             csrcrect = pgRect_FromObject(srcrect, &src)
10736  *             if not csrcrect:             # <<<<<<<<<<<<<<
10737  *                 raise TypeError("the argument is not a rectangle or None")
10738  *
10739  */
10740     }
10741 
10742     /* "pygame/_sdl2/video.pyx":743
10743  *         cdef SDL_Point *originptr
10744  *
10745  *         if srcrect is not None:             # <<<<<<<<<<<<<<
10746  *             csrcrect = pgRect_FromObject(srcrect, &src)
10747  *             if not csrcrect:
10748  */
10749   }
10750 
10751   /* "pygame/_sdl2/video.pyx":748
10752  *                 raise TypeError("the argument is not a rectangle or None")
10753  *
10754  *         if dstrect is not None:             # <<<<<<<<<<<<<<
10755  *             cdstrect = pgRect_FromObject(dstrect, &dst)
10756  *             if cdstrect == NULL:
10757  */
10758   __pyx_t_11 = (__pyx_v_dstrect != Py_None);
10759   __pyx_t_10 = (__pyx_t_11 != 0);
10760   if (__pyx_t_10) {
10761 
10762     /* "pygame/_sdl2/video.pyx":749
10763  *
10764  *         if dstrect is not None:
10765  *             cdstrect = pgRect_FromObject(dstrect, &dst)             # <<<<<<<<<<<<<<
10766  *             if cdstrect == NULL:
10767  *                 if len(dstrect) == 2:
10768  */
10769     __pyx_v_cdstrect = pgRect_FromObject(__pyx_v_dstrect, (&__pyx_v_dst));
10770 
10771     /* "pygame/_sdl2/video.pyx":750
10772  *         if dstrect is not None:
10773  *             cdstrect = pgRect_FromObject(dstrect, &dst)
10774  *             if cdstrect == NULL:             # <<<<<<<<<<<<<<
10775  *                 if len(dstrect) == 2:
10776  *                     dst.x = dstrect[0]
10777  */
10778     __pyx_t_10 = ((__pyx_v_cdstrect == NULL) != 0);
10779     if (__pyx_t_10) {
10780 
10781       /* "pygame/_sdl2/video.pyx":751
10782  *             cdstrect = pgRect_FromObject(dstrect, &dst)
10783  *             if cdstrect == NULL:
10784  *                 if len(dstrect) == 2:             # <<<<<<<<<<<<<<
10785  *                     dst.x = dstrect[0]
10786  *                     dst.y = dstrect[1]
10787  */
10788       __pyx_t_12 = PyObject_Length(__pyx_v_dstrect); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 751, __pyx_L1_error)
10789       __pyx_t_10 = ((__pyx_t_12 == 2) != 0);
10790       if (likely(__pyx_t_10)) {
10791 
10792         /* "pygame/_sdl2/video.pyx":752
10793  *             if cdstrect == NULL:
10794  *                 if len(dstrect) == 2:
10795  *                     dst.x = dstrect[0]             # <<<<<<<<<<<<<<
10796  *                     dst.y = dstrect[1]
10797  *                     dst.w = self.width
10798  */
10799         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error)
10800         __Pyx_GOTREF(__pyx_t_1);
10801         __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 752, __pyx_L1_error)
10802         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10803         __pyx_v_dst.x = __pyx_t_8;
10804 
10805         /* "pygame/_sdl2/video.pyx":753
10806  *                 if len(dstrect) == 2:
10807  *                     dst.x = dstrect[0]
10808  *                     dst.y = dstrect[1]             # <<<<<<<<<<<<<<
10809  *                     dst.w = self.width
10810  *                     dst.h = self.height
10811  */
10812         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
10813         __Pyx_GOTREF(__pyx_t_1);
10814         __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L1_error)
10815         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10816         __pyx_v_dst.y = __pyx_t_8;
10817 
10818         /* "pygame/_sdl2/video.pyx":754
10819  *                     dst.x = dstrect[0]
10820  *                     dst.y = dstrect[1]
10821  *                     dst.w = self.width             # <<<<<<<<<<<<<<
10822  *                     dst.h = self.height
10823  *                     cdstrect = &dst
10824  */
10825         __pyx_t_8 = __pyx_v_self->width;
10826         __pyx_v_dst.w = __pyx_t_8;
10827 
10828         /* "pygame/_sdl2/video.pyx":755
10829  *                     dst.y = dstrect[1]
10830  *                     dst.w = self.width
10831  *                     dst.h = self.height             # <<<<<<<<<<<<<<
10832  *                     cdstrect = &dst
10833  *                 else:
10834  */
10835         __pyx_t_8 = __pyx_v_self->height;
10836         __pyx_v_dst.h = __pyx_t_8;
10837 
10838         /* "pygame/_sdl2/video.pyx":756
10839  *                     dst.w = self.width
10840  *                     dst.h = self.height
10841  *                     cdstrect = &dst             # <<<<<<<<<<<<<<
10842  *                 else:
10843  *                     raise TypeError('dstrect must be a position, rect, or None')
10844  */
10845         __pyx_v_cdstrect = (&__pyx_v_dst);
10846 
10847         /* "pygame/_sdl2/video.pyx":751
10848  *             cdstrect = pgRect_FromObject(dstrect, &dst)
10849  *             if cdstrect == NULL:
10850  *                 if len(dstrect) == 2:             # <<<<<<<<<<<<<<
10851  *                     dst.x = dstrect[0]
10852  *                     dst.y = dstrect[1]
10853  */
10854         goto __pyx_L7;
10855       }
10856 
10857       /* "pygame/_sdl2/video.pyx":758
10858  *                     cdstrect = &dst
10859  *                 else:
10860  *                     raise TypeError('dstrect must be a position, rect, or None')             # <<<<<<<<<<<<<<
10861  *
10862  *         if origin:
10863  */
10864       /*else*/ {
10865         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
10866         __Pyx_GOTREF(__pyx_t_1);
10867         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10868         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10869         __PYX_ERR(0, 758, __pyx_L1_error)
10870       }
10871       __pyx_L7:;
10872 
10873       /* "pygame/_sdl2/video.pyx":750
10874  *         if dstrect is not None:
10875  *             cdstrect = pgRect_FromObject(dstrect, &dst)
10876  *             if cdstrect == NULL:             # <<<<<<<<<<<<<<
10877  *                 if len(dstrect) == 2:
10878  *                     dst.x = dstrect[0]
10879  */
10880     }
10881 
10882     /* "pygame/_sdl2/video.pyx":748
10883  *                 raise TypeError("the argument is not a rectangle or None")
10884  *
10885  *         if dstrect is not None:             # <<<<<<<<<<<<<<
10886  *             cdstrect = pgRect_FromObject(dstrect, &dst)
10887  *             if cdstrect == NULL:
10888  */
10889   }
10890 
10891   /* "pygame/_sdl2/video.pyx":760
10892  *                     raise TypeError('dstrect must be a position, rect, or None')
10893  *
10894  *         if origin:             # <<<<<<<<<<<<<<
10895  *             originptr = &corigin
10896  *             corigin.x = origin[0]
10897  */
10898   __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_origin); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 760, __pyx_L1_error)
10899   if (__pyx_t_10) {
10900 
10901     /* "pygame/_sdl2/video.pyx":761
10902  *
10903  *         if origin:
10904  *             originptr = &corigin             # <<<<<<<<<<<<<<
10905  *             corigin.x = origin[0]
10906  *             corigin.y = origin[1]
10907  */
10908     __pyx_v_originptr = (&__pyx_v_corigin);
10909 
10910     /* "pygame/_sdl2/video.pyx":762
10911  *         if origin:
10912  *             originptr = &corigin
10913  *             corigin.x = origin[0]             # <<<<<<<<<<<<<<
10914  *             corigin.y = origin[1]
10915  *         else:
10916  */
10917     __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
10918     __Pyx_GOTREF(__pyx_t_1);
10919     __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error)
10920     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10921     __pyx_v_corigin.x = __pyx_t_8;
10922 
10923     /* "pygame/_sdl2/video.pyx":763
10924  *             originptr = &corigin
10925  *             corigin.x = origin[0]
10926  *             corigin.y = origin[1]             # <<<<<<<<<<<<<<
10927  *         else:
10928  *             originptr = NULL
10929  */
10930     __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
10931     __Pyx_GOTREF(__pyx_t_1);
10932     __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)
10933     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10934     __pyx_v_corigin.y = __pyx_t_8;
10935 
10936     /* "pygame/_sdl2/video.pyx":760
10937  *                     raise TypeError('dstrect must be a position, rect, or None')
10938  *
10939  *         if origin:             # <<<<<<<<<<<<<<
10940  *             originptr = &corigin
10941  *             corigin.x = origin[0]
10942  */
10943     goto __pyx_L8;
10944   }
10945 
10946   /* "pygame/_sdl2/video.pyx":765
10947  *             corigin.y = origin[1]
10948  *         else:
10949  *             originptr = NULL             # <<<<<<<<<<<<<<
10950  *
10951  *         self.draw_internal(csrcrect, cdstrect, angle, originptr,
10952  */
10953   /*else*/ {
10954     __pyx_v_originptr = NULL;
10955   }
10956   __pyx_L8:;
10957 
10958   /* "pygame/_sdl2/video.pyx":767
10959  *             originptr = NULL
10960  *
10961  *         self.draw_internal(csrcrect, cdstrect, angle, originptr,             # <<<<<<<<<<<<<<
10962  *                            flipX, flipY)
10963  *
10964  */
10965   __pyx_t_13.__pyx_n = 4;
10966   __pyx_t_13.angle = __pyx_v_angle;
10967   __pyx_t_13.originptr = __pyx_v_originptr;
10968   __pyx_t_13.flipX = __pyx_v_flipX;
10969   __pyx_t_13.flipY = __pyx_v_flipY;
10970   __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)__pyx_v_self->__pyx_vtab)->draw_internal(__pyx_v_self, __pyx_v_csrcrect, __pyx_v_cdstrect, &__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
10971   __Pyx_GOTREF(__pyx_t_1);
10972   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10973 
10974   /* "pygame/_sdl2/video.pyx":724
10975  *             raise error()
10976  *
10977  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,             # <<<<<<<<<<<<<<
10978  *                     bint flipX=False, bint flipY=False):
10979  *         """ Copy a portion of the texture to the rendering target.
10980  */
10981 
10982   /* function exit code */
10983   goto __pyx_L0;
10984   __pyx_L1_error:;
10985   __Pyx_XDECREF(__pyx_t_1);
10986   __Pyx_XDECREF(__pyx_t_2);
10987   __Pyx_XDECREF(__pyx_t_3);
10988   __Pyx_XDECREF(__pyx_t_4);
10989   __Pyx_XDECREF(__pyx_t_5);
10990   __Pyx_XDECREF(__pyx_t_6);
10991   __Pyx_XDECREF(__pyx_t_7);
10992   __Pyx_XDECREF(__pyx_t_9);
10993   __Pyx_WriteUnraisable("pygame._sdl2.video.Texture.draw", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
10994   __pyx_L0:;
10995   __Pyx_RefNannyFinishContext();
10996 }
10997 
10998 /* Python wrapper */
10999 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11000 static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_10draw[] = " Copy a portion of the texture to the rendering target.\n\n        :param srcrect: source rectangle on the texture, or None for the entire texture.\n        :param dstrect: destination rectangle or position on the render target, or None for entire target.\n                        The texture is stretched to fill dstrect.\n        :param float angle: angle (in degrees) to rotate dstrect around (clockwise).\n        :param origin: point around which dstrect will be rotated.\n                       If None, it will equal the center: (dstrect.w/2, dstrect.h/2).\n        :param bool flipX: flip horizontally.\n        :param bool flipY: flip vertically.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11001 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11002   PyObject *__pyx_v_srcrect = 0;
11003   PyObject *__pyx_v_dstrect = 0;
11004   float __pyx_v_angle;
11005   PyObject *__pyx_v_origin = 0;
11006   int __pyx_v_flipX;
11007   int __pyx_v_flipY;
11008   int __pyx_lineno = 0;
11009   const char *__pyx_filename = NULL;
11010   int __pyx_clineno = 0;
11011   PyObject *__pyx_r = 0;
11012   __Pyx_RefNannyDeclarations
11013   __Pyx_RefNannySetupContext("draw (wrapper)", 0);
11014   {
11015     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_srcrect,&__pyx_n_s_dstrect,&__pyx_n_s_angle,&__pyx_n_s_origin,&__pyx_n_s_flipX,&__pyx_n_s_flipY,0};
11016     PyObject* values[6] = {0,0,0,0,0,0};
11017     values[0] = ((PyObject *)Py_None);
11018     values[1] = ((PyObject *)Py_None);
11019     values[3] = ((PyObject *)Py_None);
11020     if (unlikely(__pyx_kwds)) {
11021       Py_ssize_t kw_args;
11022       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11023       switch (pos_args) {
11024         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11025         CYTHON_FALLTHROUGH;
11026         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11027         CYTHON_FALLTHROUGH;
11028         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11029         CYTHON_FALLTHROUGH;
11030         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11031         CYTHON_FALLTHROUGH;
11032         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11033         CYTHON_FALLTHROUGH;
11034         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11035         CYTHON_FALLTHROUGH;
11036         case  0: break;
11037         default: goto __pyx_L5_argtuple_error;
11038       }
11039       kw_args = PyDict_Size(__pyx_kwds);
11040       switch (pos_args) {
11041         case  0:
11042         if (kw_args > 0) {
11043           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcrect);
11044           if (value) { values[0] = value; kw_args--; }
11045         }
11046         CYTHON_FALLTHROUGH;
11047         case  1:
11048         if (kw_args > 0) {
11049           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstrect);
11050           if (value) { values[1] = value; kw_args--; }
11051         }
11052         CYTHON_FALLTHROUGH;
11053         case  2:
11054         if (kw_args > 0) {
11055           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_angle);
11056           if (value) { values[2] = value; kw_args--; }
11057         }
11058         CYTHON_FALLTHROUGH;
11059         case  3:
11060         if (kw_args > 0) {
11061           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_origin);
11062           if (value) { values[3] = value; kw_args--; }
11063         }
11064         CYTHON_FALLTHROUGH;
11065         case  4:
11066         if (kw_args > 0) {
11067           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flipX);
11068           if (value) { values[4] = value; kw_args--; }
11069         }
11070         CYTHON_FALLTHROUGH;
11071         case  5:
11072         if (kw_args > 0) {
11073           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flipY);
11074           if (value) { values[5] = value; kw_args--; }
11075         }
11076       }
11077       if (unlikely(kw_args > 0)) {
11078         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 724, __pyx_L3_error)
11079       }
11080     } else {
11081       switch (PyTuple_GET_SIZE(__pyx_args)) {
11082         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11083         CYTHON_FALLTHROUGH;
11084         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11085         CYTHON_FALLTHROUGH;
11086         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11087         CYTHON_FALLTHROUGH;
11088         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11089         CYTHON_FALLTHROUGH;
11090         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11091         CYTHON_FALLTHROUGH;
11092         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11093         CYTHON_FALLTHROUGH;
11094         case  0: break;
11095         default: goto __pyx_L5_argtuple_error;
11096       }
11097     }
11098     __pyx_v_srcrect = values[0];
11099     __pyx_v_dstrect = values[1];
11100     if (values[2]) {
11101       __pyx_v_angle = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_angle == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 724, __pyx_L3_error)
11102     } else {
11103       __pyx_v_angle = ((float)0.0);
11104     }
11105     __pyx_v_origin = values[3];
11106     if (values[4]) {
11107       __pyx_v_flipX = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_flipX == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error)
11108     } else {
11109 
11110       /* "pygame/_sdl2/video.pyx":725
11111  *
11112  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,
11113  *                     bint flipX=False, bint flipY=False):             # <<<<<<<<<<<<<<
11114  *         """ Copy a portion of the texture to the rendering target.
11115  *
11116  */
11117       __pyx_v_flipX = ((int)0);
11118     }
11119     if (values[5]) {
11120       __pyx_v_flipY = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_flipY == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error)
11121     } else {
11122       __pyx_v_flipY = ((int)0);
11123     }
11124   }
11125   goto __pyx_L4_argument_unpacking_done;
11126   __pyx_L5_argtuple_error:;
11127   __Pyx_RaiseArgtupleInvalid("draw", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 724, __pyx_L3_error)
11128   __pyx_L3_error:;
11129   __Pyx_AddTraceback("pygame._sdl2.video.Texture.draw", __pyx_clineno, __pyx_lineno, __pyx_filename);
11130   __Pyx_RefNannyFinishContext();
11131   return NULL;
11132   __pyx_L4_argument_unpacking_done:;
11133   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_srcrect, __pyx_v_dstrect, __pyx_v_angle, __pyx_v_origin, __pyx_v_flipX, __pyx_v_flipY);
11134 
11135   /* "pygame/_sdl2/video.pyx":724
11136  *             raise error()
11137  *
11138  *     cpdef void draw(self, srcrect=None, dstrect=None, float angle=0, origin=None,             # <<<<<<<<<<<<<<
11139  *                     bint flipX=False, bint flipY=False):
11140  *         """ Copy a portion of the texture to the rendering target.
11141  */
11142 
11143   /* function exit code */
11144   __Pyx_RefNannyFinishContext();
11145   return __pyx_r;
11146 }
11147 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,PyObject * __pyx_v_srcrect,PyObject * __pyx_v_dstrect,float __pyx_v_angle,PyObject * __pyx_v_origin,int __pyx_v_flipX,int __pyx_v_flipY)11148 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_10draw(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_srcrect, PyObject *__pyx_v_dstrect, float __pyx_v_angle, PyObject *__pyx_v_origin, int __pyx_v_flipX, int __pyx_v_flipY) {
11149   PyObject *__pyx_r = NULL;
11150   __Pyx_RefNannyDeclarations
11151   struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw __pyx_t_1;
11152   PyObject *__pyx_t_2 = NULL;
11153   int __pyx_lineno = 0;
11154   const char *__pyx_filename = NULL;
11155   int __pyx_clineno = 0;
11156   __Pyx_RefNannySetupContext("draw", 0);
11157   __Pyx_XDECREF(__pyx_r);
11158   __pyx_t_1.__pyx_n = 6;
11159   __pyx_t_1.srcrect = __pyx_v_srcrect;
11160   __pyx_t_1.dstrect = __pyx_v_dstrect;
11161   __pyx_t_1.angle = __pyx_v_angle;
11162   __pyx_t_1.origin = __pyx_v_origin;
11163   __pyx_t_1.flipX = __pyx_v_flipX;
11164   __pyx_t_1.flipY = __pyx_v_flipY;
11165   __pyx_vtabptr_6pygame_5_sdl2_5video_Texture->draw(__pyx_v_self, 1, &__pyx_t_1);
11166   __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
11167   __Pyx_GOTREF(__pyx_t_2);
11168   __pyx_r = __pyx_t_2;
11169   __pyx_t_2 = 0;
11170   goto __pyx_L0;
11171 
11172   /* function exit code */
11173   __pyx_L1_error:;
11174   __Pyx_XDECREF(__pyx_t_2);
11175   __Pyx_AddTraceback("pygame._sdl2.video.Texture.draw", __pyx_clineno, __pyx_lineno, __pyx_filename);
11176   __pyx_r = NULL;
11177   __pyx_L0:;
11178   __Pyx_XGIVEREF(__pyx_r);
11179   __Pyx_RefNannyFinishContext();
11180   return __pyx_r;
11181 }
11182 
11183 /* "pygame/_sdl2/video.pyx":770
11184  *                            flipX, flipY)
11185  *
11186  *     def update(self, surface, area=None):             # <<<<<<<<<<<<<<
11187  *         # https://wiki.libsdl.org/SDL_UpdateTexture
11188  *         # Should it accept a raw pixel data array too?
11189  */
11190 
11191 /* Python wrapper */
11192 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11193 static char __pyx_doc_6pygame_5_sdl2_5video_7Texture_12update[] = " Update the texture with Surface.\n        This is a fairly slow function, intended for use with static textures that do not change often.\n\n        If the texture is intended to be updated often,\n        it is preferred to create the texture as streaming and use the locking functions.\n\n        While this function will work with streaming textures,\n        for optimization reasons you may not get the pixels back if you lock the texture afterward.\n\n        :param surface: source Surface.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_7Texture_13update(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11194 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_13update(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11195   PyObject *__pyx_v_surface = 0;
11196   PyObject *__pyx_v_area = 0;
11197   int __pyx_lineno = 0;
11198   const char *__pyx_filename = NULL;
11199   int __pyx_clineno = 0;
11200   PyObject *__pyx_r = 0;
11201   __Pyx_RefNannyDeclarations
11202   __Pyx_RefNannySetupContext("update (wrapper)", 0);
11203   {
11204     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_area,0};
11205     PyObject* values[2] = {0,0};
11206     values[1] = ((PyObject *)Py_None);
11207     if (unlikely(__pyx_kwds)) {
11208       Py_ssize_t kw_args;
11209       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11210       switch (pos_args) {
11211         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11212         CYTHON_FALLTHROUGH;
11213         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11214         CYTHON_FALLTHROUGH;
11215         case  0: break;
11216         default: goto __pyx_L5_argtuple_error;
11217       }
11218       kw_args = PyDict_Size(__pyx_kwds);
11219       switch (pos_args) {
11220         case  0:
11221         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
11222         else goto __pyx_L5_argtuple_error;
11223         CYTHON_FALLTHROUGH;
11224         case  1:
11225         if (kw_args > 0) {
11226           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_area);
11227           if (value) { values[1] = value; kw_args--; }
11228         }
11229       }
11230       if (unlikely(kw_args > 0)) {
11231         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update") < 0)) __PYX_ERR(0, 770, __pyx_L3_error)
11232       }
11233     } else {
11234       switch (PyTuple_GET_SIZE(__pyx_args)) {
11235         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11236         CYTHON_FALLTHROUGH;
11237         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11238         break;
11239         default: goto __pyx_L5_argtuple_error;
11240       }
11241     }
11242     __pyx_v_surface = values[0];
11243     __pyx_v_area = values[1];
11244   }
11245   goto __pyx_L4_argument_unpacking_done;
11246   __pyx_L5_argtuple_error:;
11247   __Pyx_RaiseArgtupleInvalid("update", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 770, __pyx_L3_error)
11248   __pyx_L3_error:;
11249   __Pyx_AddTraceback("pygame._sdl2.video.Texture.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
11250   __Pyx_RefNannyFinishContext();
11251   return NULL;
11252   __pyx_L4_argument_unpacking_done:;
11253   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_12update(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), __pyx_v_surface, __pyx_v_area);
11254 
11255   /* function exit code */
11256   __Pyx_RefNannyFinishContext();
11257   return __pyx_r;
11258 }
11259 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_12update(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,PyObject * __pyx_v_surface,PyObject * __pyx_v_area)11260 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_12update(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, PyObject *__pyx_v_surface, PyObject *__pyx_v_area) {
11261   SDL_Rect __pyx_v_rect;
11262   SDL_Rect *__pyx_v_rectptr;
11263   SDL_Surface *__pyx_v_surf;
11264   int __pyx_v_res;
11265   PyObject *__pyx_r = NULL;
11266   __Pyx_RefNannyDeclarations
11267   int __pyx_t_1;
11268   PyObject *__pyx_t_2 = NULL;
11269   int __pyx_t_3;
11270   int __pyx_t_4;
11271   PyObject *__pyx_t_5 = NULL;
11272   PyObject *__pyx_t_6 = NULL;
11273   int __pyx_lineno = 0;
11274   const char *__pyx_filename = NULL;
11275   int __pyx_clineno = 0;
11276   __Pyx_RefNannySetupContext("update", 0);
11277 
11278   /* "pygame/_sdl2/video.pyx":785
11279  *         """
11280  *
11281  *         if not pgSurface_Check(surface):             # <<<<<<<<<<<<<<
11282  *             raise TypeError("update source should be a Surface.")
11283  *
11284  */
11285   __pyx_t_1 = ((!(pgSurface_Check(__pyx_v_surface) != 0)) != 0);
11286   if (unlikely(__pyx_t_1)) {
11287 
11288     /* "pygame/_sdl2/video.pyx":786
11289  *
11290  *         if not pgSurface_Check(surface):
11291  *             raise TypeError("update source should be a Surface.")             # <<<<<<<<<<<<<<
11292  *
11293  *         cdef SDL_Rect rect
11294  */
11295     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 786, __pyx_L1_error)
11296     __Pyx_GOTREF(__pyx_t_2);
11297     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11298     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11299     __PYX_ERR(0, 786, __pyx_L1_error)
11300 
11301     /* "pygame/_sdl2/video.pyx":785
11302  *         """
11303  *
11304  *         if not pgSurface_Check(surface):             # <<<<<<<<<<<<<<
11305  *             raise TypeError("update source should be a Surface.")
11306  *
11307  */
11308   }
11309 
11310   /* "pygame/_sdl2/video.pyx":789
11311  *
11312  *         cdef SDL_Rect rect
11313  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &rect)             # <<<<<<<<<<<<<<
11314  *         cdef SDL_Surface *surf = pgSurface_AsSurface(surface)
11315  *
11316  */
11317   __pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_rect));
11318 
11319   /* "pygame/_sdl2/video.pyx":790
11320  *         cdef SDL_Rect rect
11321  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &rect)
11322  *         cdef SDL_Surface *surf = pgSurface_AsSurface(surface)             # <<<<<<<<<<<<<<
11323  *
11324  *         if rectptr == NULL and area is not None:
11325  */
11326   __pyx_v_surf = pgSurface_AsSurface(__pyx_v_surface);
11327 
11328   /* "pygame/_sdl2/video.pyx":792
11329  *         cdef SDL_Surface *surf = pgSurface_AsSurface(surface)
11330  *
11331  *         if rectptr == NULL and area is not None:             # <<<<<<<<<<<<<<
11332  *             raise TypeError('area must be a rectangle or None')
11333  *
11334  */
11335   __pyx_t_3 = ((__pyx_v_rectptr == NULL) != 0);
11336   if (__pyx_t_3) {
11337   } else {
11338     __pyx_t_1 = __pyx_t_3;
11339     goto __pyx_L5_bool_binop_done;
11340   }
11341   __pyx_t_3 = (__pyx_v_area != Py_None);
11342   __pyx_t_4 = (__pyx_t_3 != 0);
11343   __pyx_t_1 = __pyx_t_4;
11344   __pyx_L5_bool_binop_done:;
11345   if (unlikely(__pyx_t_1)) {
11346 
11347     /* "pygame/_sdl2/video.pyx":793
11348  *
11349  *         if rectptr == NULL and area is not None:
11350  *             raise TypeError('area must be a rectangle or None')             # <<<<<<<<<<<<<<
11351  *
11352  *         res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
11353  */
11354     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 793, __pyx_L1_error)
11355     __Pyx_GOTREF(__pyx_t_2);
11356     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11357     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11358     __PYX_ERR(0, 793, __pyx_L1_error)
11359 
11360     /* "pygame/_sdl2/video.pyx":792
11361  *         cdef SDL_Surface *surf = pgSurface_AsSurface(surface)
11362  *
11363  *         if rectptr == NULL and area is not None:             # <<<<<<<<<<<<<<
11364  *             raise TypeError('area must be a rectangle or None')
11365  *
11366  */
11367   }
11368 
11369   /* "pygame/_sdl2/video.pyx":795
11370  *             raise TypeError('area must be a rectangle or None')
11371  *
11372  *         res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)             # <<<<<<<<<<<<<<
11373  *         if res < 0:
11374  *             raise error()
11375  */
11376   __pyx_v_res = SDL_UpdateTexture(__pyx_v_self->_tex, __pyx_v_rectptr, __pyx_v_surf->pixels, __pyx_v_surf->pitch);
11377 
11378   /* "pygame/_sdl2/video.pyx":796
11379  *
11380  *         res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
11381  *         if res < 0:             # <<<<<<<<<<<<<<
11382  *             raise error()
11383  *
11384  */
11385   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
11386   if (unlikely(__pyx_t_1)) {
11387 
11388     /* "pygame/_sdl2/video.pyx":797
11389  *         res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
11390  *         if res < 0:
11391  *             raise error()             # <<<<<<<<<<<<<<
11392  *
11393  * cdef class Image:
11394  */
11395     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 797, __pyx_L1_error)
11396     __Pyx_GOTREF(__pyx_t_5);
11397     __pyx_t_6 = NULL;
11398     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
11399       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
11400       if (likely(__pyx_t_6)) {
11401         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11402         __Pyx_INCREF(__pyx_t_6);
11403         __Pyx_INCREF(function);
11404         __Pyx_DECREF_SET(__pyx_t_5, function);
11405       }
11406     }
11407     __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
11408     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11409     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error)
11410     __Pyx_GOTREF(__pyx_t_2);
11411     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11412     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11413     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11414     __PYX_ERR(0, 797, __pyx_L1_error)
11415 
11416     /* "pygame/_sdl2/video.pyx":796
11417  *
11418  *         res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
11419  *         if res < 0:             # <<<<<<<<<<<<<<
11420  *             raise error()
11421  *
11422  */
11423   }
11424 
11425   /* "pygame/_sdl2/video.pyx":770
11426  *                            flipX, flipY)
11427  *
11428  *     def update(self, surface, area=None):             # <<<<<<<<<<<<<<
11429  *         # https://wiki.libsdl.org/SDL_UpdateTexture
11430  *         # Should it accept a raw pixel data array too?
11431  */
11432 
11433   /* function exit code */
11434   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11435   goto __pyx_L0;
11436   __pyx_L1_error:;
11437   __Pyx_XDECREF(__pyx_t_2);
11438   __Pyx_XDECREF(__pyx_t_5);
11439   __Pyx_XDECREF(__pyx_t_6);
11440   __Pyx_AddTraceback("pygame._sdl2.video.Texture.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
11441   __pyx_r = NULL;
11442   __pyx_L0:;
11443   __Pyx_XGIVEREF(__pyx_r);
11444   __Pyx_RefNannyFinishContext();
11445   return __pyx_r;
11446 }
11447 
11448 /* "pygame/_sdl2/video.pxd":397
11449  *     cdef SDL_Texture* _tex
11450  *     cdef Color _color
11451  *     cdef readonly Renderer renderer             # <<<<<<<<<<<<<<
11452  *     cdef readonly int width
11453  *     cdef readonly int height
11454  */
11455 
11456 /* Python wrapper */
11457 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_8renderer_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_8renderer_1__get__(PyObject * __pyx_v_self)11458 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_8renderer_1__get__(PyObject *__pyx_v_self) {
11459   PyObject *__pyx_r = 0;
11460   __Pyx_RefNannyDeclarations
11461   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11462   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_8renderer___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
11463 
11464   /* function exit code */
11465   __Pyx_RefNannyFinishContext();
11466   return __pyx_r;
11467 }
11468 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_8renderer___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)11469 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_8renderer___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
11470   PyObject *__pyx_r = NULL;
11471   __Pyx_RefNannyDeclarations
11472   __Pyx_RefNannySetupContext("__get__", 0);
11473   __Pyx_XDECREF(__pyx_r);
11474   __Pyx_INCREF(((PyObject *)__pyx_v_self->renderer));
11475   __pyx_r = ((PyObject *)__pyx_v_self->renderer);
11476   goto __pyx_L0;
11477 
11478   /* function exit code */
11479   __pyx_L0:;
11480   __Pyx_XGIVEREF(__pyx_r);
11481   __Pyx_RefNannyFinishContext();
11482   return __pyx_r;
11483 }
11484 
11485 /* "pygame/_sdl2/video.pxd":398
11486  *     cdef Color _color
11487  *     cdef readonly Renderer renderer
11488  *     cdef readonly int width             # <<<<<<<<<<<<<<
11489  *     cdef readonly int height
11490  *
11491  */
11492 
11493 /* Python wrapper */
11494 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5width_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_5width_1__get__(PyObject * __pyx_v_self)11495 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_5width_1__get__(PyObject *__pyx_v_self) {
11496   PyObject *__pyx_r = 0;
11497   __Pyx_RefNannyDeclarations
11498   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11499   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_5width___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
11500 
11501   /* function exit code */
11502   __Pyx_RefNannyFinishContext();
11503   return __pyx_r;
11504 }
11505 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_5width___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)11506 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_5width___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
11507   PyObject *__pyx_r = NULL;
11508   __Pyx_RefNannyDeclarations
11509   PyObject *__pyx_t_1 = NULL;
11510   int __pyx_lineno = 0;
11511   const char *__pyx_filename = NULL;
11512   int __pyx_clineno = 0;
11513   __Pyx_RefNannySetupContext("__get__", 0);
11514   __Pyx_XDECREF(__pyx_r);
11515   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 398, __pyx_L1_error)
11516   __Pyx_GOTREF(__pyx_t_1);
11517   __pyx_r = __pyx_t_1;
11518   __pyx_t_1 = 0;
11519   goto __pyx_L0;
11520 
11521   /* function exit code */
11522   __pyx_L1_error:;
11523   __Pyx_XDECREF(__pyx_t_1);
11524   __Pyx_AddTraceback("pygame._sdl2.video.Texture.width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11525   __pyx_r = NULL;
11526   __pyx_L0:;
11527   __Pyx_XGIVEREF(__pyx_r);
11528   __Pyx_RefNannyFinishContext();
11529   return __pyx_r;
11530 }
11531 
11532 /* "pygame/_sdl2/video.pxd":399
11533  *     cdef readonly Renderer renderer
11534  *     cdef readonly int width
11535  *     cdef readonly int height             # <<<<<<<<<<<<<<
11536  *
11537  *     cdef draw_internal(self, SDL_Rect *csrcrect, SDL_Rect *cdstrect, float angle=*, SDL_Point *originptr=*,
11538  */
11539 
11540 /* Python wrapper */
11541 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_6height_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_6height_1__get__(PyObject * __pyx_v_self)11542 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_6height_1__get__(PyObject *__pyx_v_self) {
11543   PyObject *__pyx_r = 0;
11544   __Pyx_RefNannyDeclarations
11545   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11546   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_6height___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
11547 
11548   /* function exit code */
11549   __Pyx_RefNannyFinishContext();
11550   return __pyx_r;
11551 }
11552 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_6height___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)11553 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_6height___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
11554   PyObject *__pyx_r = NULL;
11555   __Pyx_RefNannyDeclarations
11556   PyObject *__pyx_t_1 = NULL;
11557   int __pyx_lineno = 0;
11558   const char *__pyx_filename = NULL;
11559   int __pyx_clineno = 0;
11560   __Pyx_RefNannySetupContext("__get__", 0);
11561   __Pyx_XDECREF(__pyx_r);
11562   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 399, __pyx_L1_error)
11563   __Pyx_GOTREF(__pyx_t_1);
11564   __pyx_r = __pyx_t_1;
11565   __pyx_t_1 = 0;
11566   goto __pyx_L0;
11567 
11568   /* function exit code */
11569   __pyx_L1_error:;
11570   __Pyx_XDECREF(__pyx_t_1);
11571   __Pyx_AddTraceback("pygame._sdl2.video.Texture.height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11572   __pyx_r = NULL;
11573   __pyx_L0:;
11574   __Pyx_XGIVEREF(__pyx_r);
11575   __Pyx_RefNannyFinishContext();
11576   return __pyx_r;
11577 }
11578 
11579 /* "(tree fragment)":1
11580  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11581  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11582  * def __setstate_cython__(self, __pyx_state):
11583  */
11584 
11585 /* Python wrapper */
11586 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_15__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)11587 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11588   PyObject *__pyx_r = 0;
11589   __Pyx_RefNannyDeclarations
11590   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
11591   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_14__reduce_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self));
11592 
11593   /* function exit code */
11594   __Pyx_RefNannyFinishContext();
11595   return __pyx_r;
11596 }
11597 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self)11598 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self) {
11599   PyObject *__pyx_r = NULL;
11600   __Pyx_RefNannyDeclarations
11601   PyObject *__pyx_t_1 = NULL;
11602   int __pyx_lineno = 0;
11603   const char *__pyx_filename = NULL;
11604   int __pyx_clineno = 0;
11605   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
11606 
11607   /* "(tree fragment)":2
11608  * def __reduce_cython__(self):
11609  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11610  * def __setstate_cython__(self, __pyx_state):
11611  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11612  */
11613   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
11614   __Pyx_GOTREF(__pyx_t_1);
11615   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11616   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11617   __PYX_ERR(1, 2, __pyx_L1_error)
11618 
11619   /* "(tree fragment)":1
11620  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11621  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11622  * def __setstate_cython__(self, __pyx_state):
11623  */
11624 
11625   /* function exit code */
11626   __pyx_L1_error:;
11627   __Pyx_XDECREF(__pyx_t_1);
11628   __Pyx_AddTraceback("pygame._sdl2.video.Texture.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11629   __pyx_r = NULL;
11630   __Pyx_XGIVEREF(__pyx_r);
11631   __Pyx_RefNannyFinishContext();
11632   return __pyx_r;
11633 }
11634 
11635 /* "(tree fragment)":3
11636  * def __reduce_cython__(self):
11637  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11638  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11639  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11640  */
11641 
11642 /* Python wrapper */
11643 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_7Texture_17__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)11644 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_7Texture_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11645   PyObject *__pyx_r = 0;
11646   __Pyx_RefNannyDeclarations
11647   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11648   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_7Texture_16__setstate_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11649 
11650   /* function exit code */
11651   __Pyx_RefNannyFinishContext();
11652   return __pyx_r;
11653 }
11654 
__pyx_pf_6pygame_5_sdl2_5video_7Texture_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)11655 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_7Texture_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Texture *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11656   PyObject *__pyx_r = NULL;
11657   __Pyx_RefNannyDeclarations
11658   PyObject *__pyx_t_1 = NULL;
11659   int __pyx_lineno = 0;
11660   const char *__pyx_filename = NULL;
11661   int __pyx_clineno = 0;
11662   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
11663 
11664   /* "(tree fragment)":4
11665  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11666  * def __setstate_cython__(self, __pyx_state):
11667  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11668  */
11669   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
11670   __Pyx_GOTREF(__pyx_t_1);
11671   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11672   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11673   __PYX_ERR(1, 4, __pyx_L1_error)
11674 
11675   /* "(tree fragment)":3
11676  * def __reduce_cython__(self):
11677  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11678  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11679  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11680  */
11681 
11682   /* function exit code */
11683   __pyx_L1_error:;
11684   __Pyx_XDECREF(__pyx_t_1);
11685   __Pyx_AddTraceback("pygame._sdl2.video.Texture.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11686   __pyx_r = NULL;
11687   __Pyx_XGIVEREF(__pyx_r);
11688   __Pyx_RefNannyFinishContext();
11689   return __pyx_r;
11690 }
11691 
11692 /* "pygame/_sdl2/video.pyx":801
11693  * cdef class Image:
11694  *
11695  *     def __cinit__(self):             # <<<<<<<<<<<<<<
11696  *         self.angle = 0
11697  *         self._origin.x = 0
11698  */
11699 
11700 /* Python wrapper */
11701 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11702 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11703   int __pyx_r;
11704   __Pyx_RefNannyDeclarations
11705   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
11706   if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
11707     __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
11708   if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
11709   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
11710 
11711   /* function exit code */
11712   __Pyx_RefNannyFinishContext();
11713   return __pyx_r;
11714 }
11715 
__pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)11716 static int __pyx_pf_6pygame_5_sdl2_5video_5Image___cinit__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
11717   Uint8 __pyx_v_defaultColor[4];
11718   int __pyx_r;
11719   __Pyx_RefNannyDeclarations
11720   Uint8 __pyx_t_1[4];
11721   PyObject *__pyx_t_2 = NULL;
11722   int __pyx_lineno = 0;
11723   const char *__pyx_filename = NULL;
11724   int __pyx_clineno = 0;
11725   __Pyx_RefNannySetupContext("__cinit__", 0);
11726 
11727   /* "pygame/_sdl2/video.pyx":802
11728  *
11729  *     def __cinit__(self):
11730  *         self.angle = 0             # <<<<<<<<<<<<<<
11731  *         self._origin.x = 0
11732  *         self._origin.y = 0
11733  */
11734   __pyx_v_self->angle = 0.0;
11735 
11736   /* "pygame/_sdl2/video.pyx":803
11737  *     def __cinit__(self):
11738  *         self.angle = 0
11739  *         self._origin.x = 0             # <<<<<<<<<<<<<<
11740  *         self._origin.y = 0
11741  *         self._originptr = NULL
11742  */
11743   __pyx_v_self->_origin.x = 0;
11744 
11745   /* "pygame/_sdl2/video.pyx":804
11746  *         self.angle = 0
11747  *         self._origin.x = 0
11748  *         self._origin.y = 0             # <<<<<<<<<<<<<<
11749  *         self._originptr = NULL
11750  *         self.flipX = False
11751  */
11752   __pyx_v_self->_origin.y = 0;
11753 
11754   /* "pygame/_sdl2/video.pyx":805
11755  *         self._origin.x = 0
11756  *         self._origin.y = 0
11757  *         self._originptr = NULL             # <<<<<<<<<<<<<<
11758  *         self.flipX = False
11759  *         self.flipY = False
11760  */
11761   __pyx_v_self->_originptr = NULL;
11762 
11763   /* "pygame/_sdl2/video.pyx":806
11764  *         self._origin.y = 0
11765  *         self._originptr = NULL
11766  *         self.flipX = False             # <<<<<<<<<<<<<<
11767  *         self.flipY = False
11768  *
11769  */
11770   __pyx_v_self->flipX = 0;
11771 
11772   /* "pygame/_sdl2/video.pyx":807
11773  *         self._originptr = NULL
11774  *         self.flipX = False
11775  *         self.flipY = False             # <<<<<<<<<<<<<<
11776  *
11777  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
11778  */
11779   __pyx_v_self->flipY = 0;
11780 
11781   /* "pygame/_sdl2/video.pyx":809
11782  *         self.flipY = False
11783  *
11784  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]             # <<<<<<<<<<<<<<
11785  *         self._color = pgColor_NewLength(defaultColor, 3)
11786  *         self.alpha = 255
11787  */
11788   __pyx_t_1[0] = 0xFF;
11789   __pyx_t_1[1] = 0xFF;
11790   __pyx_t_1[2] = 0xFF;
11791   __pyx_t_1[3] = 0xFF;
11792   memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_1, sizeof(__pyx_v_defaultColor[0]) * (4));
11793 
11794   /* "pygame/_sdl2/video.pyx":810
11795  *
11796  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
11797  *         self._color = pgColor_NewLength(defaultColor, 3)             # <<<<<<<<<<<<<<
11798  *         self.alpha = 255
11799  *
11800  */
11801   __pyx_t_2 = pgColor_NewLength(__pyx_v_defaultColor, 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error)
11802   __Pyx_GOTREF(__pyx_t_2);
11803   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 810, __pyx_L1_error)
11804   __Pyx_GIVEREF(__pyx_t_2);
11805   __Pyx_GOTREF(__pyx_v_self->_color);
11806   __Pyx_DECREF(((PyObject *)__pyx_v_self->_color));
11807   __pyx_v_self->_color = ((pgColorObject *)__pyx_t_2);
11808   __pyx_t_2 = 0;
11809 
11810   /* "pygame/_sdl2/video.pyx":811
11811  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
11812  *         self._color = pgColor_NewLength(defaultColor, 3)
11813  *         self.alpha = 255             # <<<<<<<<<<<<<<
11814  *
11815  *     def __init__(self, textureOrImage, srcrect=None):
11816  */
11817   __pyx_v_self->alpha = 255.0;
11818 
11819   /* "pygame/_sdl2/video.pyx":801
11820  * cdef class Image:
11821  *
11822  *     def __cinit__(self):             # <<<<<<<<<<<<<<
11823  *         self.angle = 0
11824  *         self._origin.x = 0
11825  */
11826 
11827   /* function exit code */
11828   __pyx_r = 0;
11829   goto __pyx_L0;
11830   __pyx_L1_error:;
11831   __Pyx_XDECREF(__pyx_t_2);
11832   __Pyx_AddTraceback("pygame._sdl2.video.Image.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11833   __pyx_r = -1;
11834   __pyx_L0:;
11835   __Pyx_RefNannyFinishContext();
11836   return __pyx_r;
11837 }
11838 
11839 /* "pygame/_sdl2/video.pyx":813
11840  *         self.alpha = 255
11841  *
11842  *     def __init__(self, textureOrImage, srcrect=None):             # <<<<<<<<<<<<<<
11843  *         cdef SDL_Rect temp
11844  *         cdef SDL_Rect *rectptr
11845  */
11846 
11847 /* Python wrapper */
11848 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11849 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11850   PyObject *__pyx_v_textureOrImage = 0;
11851   PyObject *__pyx_v_srcrect = 0;
11852   int __pyx_lineno = 0;
11853   const char *__pyx_filename = NULL;
11854   int __pyx_clineno = 0;
11855   int __pyx_r;
11856   __Pyx_RefNannyDeclarations
11857   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
11858   {
11859     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_textureOrImage,&__pyx_n_s_srcrect,0};
11860     PyObject* values[2] = {0,0};
11861     values[1] = ((PyObject *)Py_None);
11862     if (unlikely(__pyx_kwds)) {
11863       Py_ssize_t kw_args;
11864       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11865       switch (pos_args) {
11866         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11867         CYTHON_FALLTHROUGH;
11868         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11869         CYTHON_FALLTHROUGH;
11870         case  0: break;
11871         default: goto __pyx_L5_argtuple_error;
11872       }
11873       kw_args = PyDict_Size(__pyx_kwds);
11874       switch (pos_args) {
11875         case  0:
11876         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_textureOrImage)) != 0)) kw_args--;
11877         else goto __pyx_L5_argtuple_error;
11878         CYTHON_FALLTHROUGH;
11879         case  1:
11880         if (kw_args > 0) {
11881           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcrect);
11882           if (value) { values[1] = value; kw_args--; }
11883         }
11884       }
11885       if (unlikely(kw_args > 0)) {
11886         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 813, __pyx_L3_error)
11887       }
11888     } else {
11889       switch (PyTuple_GET_SIZE(__pyx_args)) {
11890         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11891         CYTHON_FALLTHROUGH;
11892         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11893         break;
11894         default: goto __pyx_L5_argtuple_error;
11895       }
11896     }
11897     __pyx_v_textureOrImage = values[0];
11898     __pyx_v_srcrect = values[1];
11899   }
11900   goto __pyx_L4_argument_unpacking_done;
11901   __pyx_L5_argtuple_error:;
11902   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 813, __pyx_L3_error)
11903   __pyx_L3_error:;
11904   __Pyx_AddTraceback("pygame._sdl2.video.Image.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11905   __Pyx_RefNannyFinishContext();
11906   return -1;
11907   __pyx_L4_argument_unpacking_done:;
11908   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), __pyx_v_textureOrImage, __pyx_v_srcrect);
11909 
11910   /* function exit code */
11911   __Pyx_RefNannyFinishContext();
11912   return __pyx_r;
11913 }
11914 
__pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_textureOrImage,PyObject * __pyx_v_srcrect)11915 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_textureOrImage, PyObject *__pyx_v_srcrect) {
11916   SDL_Rect __pyx_v_temp;
11917   SDL_Rect *__pyx_v_rectptr;
11918   int __pyx_r;
11919   __Pyx_RefNannyDeclarations
11920   int __pyx_t_1;
11921   int __pyx_t_2;
11922   PyObject *__pyx_t_3 = NULL;
11923   PyObject *__pyx_t_4 = NULL;
11924   PyObject *__pyx_t_5 = NULL;
11925   SDL_BlendMode __pyx_t_6;
11926   int __pyx_t_7;
11927   int __pyx_lineno = 0;
11928   const char *__pyx_filename = NULL;
11929   int __pyx_clineno = 0;
11930   __Pyx_RefNannySetupContext("__init__", 0);
11931 
11932   /* "pygame/_sdl2/video.pyx":817
11933  *         cdef SDL_Rect *rectptr
11934  *
11935  *         if isinstance(textureOrImage, Image):             # <<<<<<<<<<<<<<
11936  *             self.texture = textureOrImage.texture
11937  *             self.srcrect = pgRect_New(&(<Rect>textureOrImage.srcrect).r)
11938  */
11939   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_textureOrImage, __pyx_ptype_6pygame_5_sdl2_5video_Image);
11940   __pyx_t_2 = (__pyx_t_1 != 0);
11941   if (__pyx_t_2) {
11942 
11943     /* "pygame/_sdl2/video.pyx":818
11944  *
11945  *         if isinstance(textureOrImage, Image):
11946  *             self.texture = textureOrImage.texture             # <<<<<<<<<<<<<<
11947  *             self.srcrect = pgRect_New(&(<Rect>textureOrImage.srcrect).r)
11948  *         else:
11949  */
11950     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 818, __pyx_L1_error)
11951     __Pyx_GOTREF(__pyx_t_3);
11952     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 818, __pyx_L1_error)
11953     __Pyx_GIVEREF(__pyx_t_3);
11954     __Pyx_GOTREF(__pyx_v_self->texture);
11955     __Pyx_DECREF(((PyObject *)__pyx_v_self->texture));
11956     __pyx_v_self->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_3);
11957     __pyx_t_3 = 0;
11958 
11959     /* "pygame/_sdl2/video.pyx":819
11960  *         if isinstance(textureOrImage, Image):
11961  *             self.texture = textureOrImage.texture
11962  *             self.srcrect = pgRect_New(&(<Rect>textureOrImage.srcrect).r)             # <<<<<<<<<<<<<<
11963  *         else:
11964  *             self.texture = textureOrImage
11965  */
11966     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_srcrect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 819, __pyx_L1_error)
11967     __Pyx_GOTREF(__pyx_t_3);
11968     __pyx_t_4 = pgRect_New((&((pgRectObject *)__pyx_t_3)->r)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 819, __pyx_L1_error)
11969     __Pyx_GOTREF(__pyx_t_4);
11970     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11971     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 819, __pyx_L1_error)
11972     __Pyx_GIVEREF(__pyx_t_4);
11973     __Pyx_GOTREF(__pyx_v_self->srcrect);
11974     __Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
11975     __pyx_v_self->srcrect = ((pgRectObject *)__pyx_t_4);
11976     __pyx_t_4 = 0;
11977 
11978     /* "pygame/_sdl2/video.pyx":817
11979  *         cdef SDL_Rect *rectptr
11980  *
11981  *         if isinstance(textureOrImage, Image):             # <<<<<<<<<<<<<<
11982  *             self.texture = textureOrImage.texture
11983  *             self.srcrect = pgRect_New(&(<Rect>textureOrImage.srcrect).r)
11984  */
11985     goto __pyx_L3;
11986   }
11987 
11988   /* "pygame/_sdl2/video.pyx":821
11989  *             self.srcrect = pgRect_New(&(<Rect>textureOrImage.srcrect).r)
11990  *         else:
11991  *             self.texture = textureOrImage             # <<<<<<<<<<<<<<
11992  *             self.srcrect = textureOrImage.get_rect()
11993  *         self.blend_mode = textureOrImage.blend_mode
11994  */
11995   /*else*/ {
11996     if (!(likely(((__pyx_v_textureOrImage) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_textureOrImage, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 821, __pyx_L1_error)
11997     __pyx_t_4 = __pyx_v_textureOrImage;
11998     __Pyx_INCREF(__pyx_t_4);
11999     __Pyx_GIVEREF(__pyx_t_4);
12000     __Pyx_GOTREF(__pyx_v_self->texture);
12001     __Pyx_DECREF(((PyObject *)__pyx_v_self->texture));
12002     __pyx_v_self->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_4);
12003     __pyx_t_4 = 0;
12004 
12005     /* "pygame/_sdl2/video.pyx":822
12006  *         else:
12007  *             self.texture = textureOrImage
12008  *             self.srcrect = textureOrImage.get_rect()             # <<<<<<<<<<<<<<
12009  *         self.blend_mode = textureOrImage.blend_mode
12010  *
12011  */
12012     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_get_rect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 822, __pyx_L1_error)
12013     __Pyx_GOTREF(__pyx_t_3);
12014     __pyx_t_5 = NULL;
12015     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
12016       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
12017       if (likely(__pyx_t_5)) {
12018         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12019         __Pyx_INCREF(__pyx_t_5);
12020         __Pyx_INCREF(function);
12021         __Pyx_DECREF_SET(__pyx_t_3, function);
12022       }
12023     }
12024     __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
12025     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12026     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 822, __pyx_L1_error)
12027     __Pyx_GOTREF(__pyx_t_4);
12028     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12029     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 822, __pyx_L1_error)
12030     __Pyx_GIVEREF(__pyx_t_4);
12031     __Pyx_GOTREF(__pyx_v_self->srcrect);
12032     __Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
12033     __pyx_v_self->srcrect = ((pgRectObject *)__pyx_t_4);
12034     __pyx_t_4 = 0;
12035   }
12036   __pyx_L3:;
12037 
12038   /* "pygame/_sdl2/video.pyx":823
12039  *             self.texture = textureOrImage
12040  *             self.srcrect = textureOrImage.get_rect()
12041  *         self.blend_mode = textureOrImage.blend_mode             # <<<<<<<<<<<<<<
12042  *
12043  *         if srcrect is not None:
12044  */
12045   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_textureOrImage, __pyx_n_s_blend_mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
12046   __Pyx_GOTREF(__pyx_t_4);
12047   __pyx_t_6 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_t_4)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L1_error)
12048   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12049   __pyx_v_self->blend_mode = __pyx_t_6;
12050 
12051   /* "pygame/_sdl2/video.pyx":825
12052  *         self.blend_mode = textureOrImage.blend_mode
12053  *
12054  *         if srcrect is not None:             # <<<<<<<<<<<<<<
12055  *             rectptr = pgRect_FromObject(srcrect, &temp)
12056  *             if rectptr == NULL:
12057  */
12058   __pyx_t_2 = (__pyx_v_srcrect != Py_None);
12059   __pyx_t_1 = (__pyx_t_2 != 0);
12060   if (__pyx_t_1) {
12061 
12062     /* "pygame/_sdl2/video.pyx":826
12063  *
12064  *         if srcrect is not None:
12065  *             rectptr = pgRect_FromObject(srcrect, &temp)             # <<<<<<<<<<<<<<
12066  *             if rectptr == NULL:
12067  *                 raise TypeError('srcrect must be None or a rectangle')
12068  */
12069     __pyx_v_rectptr = pgRect_FromObject(__pyx_v_srcrect, (&__pyx_v_temp));
12070 
12071     /* "pygame/_sdl2/video.pyx":827
12072  *         if srcrect is not None:
12073  *             rectptr = pgRect_FromObject(srcrect, &temp)
12074  *             if rectptr == NULL:             # <<<<<<<<<<<<<<
12075  *                 raise TypeError('srcrect must be None or a rectangle')
12076  *             temp.x = rectptr.x
12077  */
12078     __pyx_t_1 = ((__pyx_v_rectptr == NULL) != 0);
12079     if (unlikely(__pyx_t_1)) {
12080 
12081       /* "pygame/_sdl2/video.pyx":828
12082  *             rectptr = pgRect_FromObject(srcrect, &temp)
12083  *             if rectptr == NULL:
12084  *                 raise TypeError('srcrect must be None or a rectangle')             # <<<<<<<<<<<<<<
12085  *             temp.x = rectptr.x
12086  *             temp.y = rectptr.y
12087  */
12088       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error)
12089       __Pyx_GOTREF(__pyx_t_4);
12090       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
12091       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12092       __PYX_ERR(0, 828, __pyx_L1_error)
12093 
12094       /* "pygame/_sdl2/video.pyx":827
12095  *         if srcrect is not None:
12096  *             rectptr = pgRect_FromObject(srcrect, &temp)
12097  *             if rectptr == NULL:             # <<<<<<<<<<<<<<
12098  *                 raise TypeError('srcrect must be None or a rectangle')
12099  *             temp.x = rectptr.x
12100  */
12101     }
12102 
12103     /* "pygame/_sdl2/video.pyx":829
12104  *             if rectptr == NULL:
12105  *                 raise TypeError('srcrect must be None or a rectangle')
12106  *             temp.x = rectptr.x             # <<<<<<<<<<<<<<
12107  *             temp.y = rectptr.y
12108  *             temp.w = rectptr.w
12109  */
12110     __pyx_t_7 = __pyx_v_rectptr->x;
12111     __pyx_v_temp.x = __pyx_t_7;
12112 
12113     /* "pygame/_sdl2/video.pyx":830
12114  *                 raise TypeError('srcrect must be None or a rectangle')
12115  *             temp.x = rectptr.x
12116  *             temp.y = rectptr.y             # <<<<<<<<<<<<<<
12117  *             temp.w = rectptr.w
12118  *             temp.h = rectptr.h
12119  */
12120     __pyx_t_7 = __pyx_v_rectptr->y;
12121     __pyx_v_temp.y = __pyx_t_7;
12122 
12123     /* "pygame/_sdl2/video.pyx":831
12124  *             temp.x = rectptr.x
12125  *             temp.y = rectptr.y
12126  *             temp.w = rectptr.w             # <<<<<<<<<<<<<<
12127  *             temp.h = rectptr.h
12128  *
12129  */
12130     __pyx_t_7 = __pyx_v_rectptr->w;
12131     __pyx_v_temp.w = __pyx_t_7;
12132 
12133     /* "pygame/_sdl2/video.pyx":832
12134  *             temp.y = rectptr.y
12135  *             temp.w = rectptr.w
12136  *             temp.h = rectptr.h             # <<<<<<<<<<<<<<
12137  *
12138  *             if temp.x < 0 or temp.y < 0 or \
12139  */
12140     __pyx_t_7 = __pyx_v_rectptr->h;
12141     __pyx_v_temp.h = __pyx_t_7;
12142 
12143     /* "pygame/_sdl2/video.pyx":834
12144  *             temp.h = rectptr.h
12145  *
12146  *             if temp.x < 0 or temp.y < 0 or \             # <<<<<<<<<<<<<<
12147  *                 temp.w < 0 or temp.h < 0 or \
12148  *                 temp.x + temp.w > self.srcrect.w or \
12149  */
12150     __pyx_t_2 = ((__pyx_v_temp.x < 0) != 0);
12151     if (!__pyx_t_2) {
12152     } else {
12153       __pyx_t_1 = __pyx_t_2;
12154       goto __pyx_L7_bool_binop_done;
12155     }
12156     __pyx_t_2 = ((__pyx_v_temp.y < 0) != 0);
12157     if (!__pyx_t_2) {
12158     } else {
12159       __pyx_t_1 = __pyx_t_2;
12160       goto __pyx_L7_bool_binop_done;
12161     }
12162 
12163     /* "pygame/_sdl2/video.pyx":835
12164  *
12165  *             if temp.x < 0 or temp.y < 0 or \
12166  *                 temp.w < 0 or temp.h < 0 or \             # <<<<<<<<<<<<<<
12167  *                 temp.x + temp.w > self.srcrect.w or \
12168  *                 temp.y + temp.h > self.srcrect.h:
12169  */
12170     __pyx_t_2 = ((__pyx_v_temp.w < 0) != 0);
12171     if (!__pyx_t_2) {
12172     } else {
12173       __pyx_t_1 = __pyx_t_2;
12174       goto __pyx_L7_bool_binop_done;
12175     }
12176     __pyx_t_2 = ((__pyx_v_temp.h < 0) != 0);
12177     if (!__pyx_t_2) {
12178     } else {
12179       __pyx_t_1 = __pyx_t_2;
12180       goto __pyx_L7_bool_binop_done;
12181     }
12182 
12183     /* "pygame/_sdl2/video.pyx":836
12184  *             if temp.x < 0 or temp.y < 0 or \
12185  *                 temp.w < 0 or temp.h < 0 or \
12186  *                 temp.x + temp.w > self.srcrect.w or \             # <<<<<<<<<<<<<<
12187  *                 temp.y + temp.h > self.srcrect.h:
12188  *                 raise ValueError('rect values are out of range')
12189  */
12190     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_temp.x + __pyx_v_temp.w)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error)
12191     __Pyx_GOTREF(__pyx_t_4);
12192     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error)
12193     __Pyx_GOTREF(__pyx_t_3);
12194     __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error)
12195     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12196     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12197     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 836, __pyx_L1_error)
12198     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12199     if (!__pyx_t_2) {
12200     } else {
12201       __pyx_t_1 = __pyx_t_2;
12202       goto __pyx_L7_bool_binop_done;
12203     }
12204 
12205     /* "pygame/_sdl2/video.pyx":837
12206  *                 temp.w < 0 or temp.h < 0 or \
12207  *                 temp.x + temp.w > self.srcrect.w or \
12208  *                 temp.y + temp.h > self.srcrect.h:             # <<<<<<<<<<<<<<
12209  *                 raise ValueError('rect values are out of range')
12210  *             temp.x += self.srcrect.x
12211  */
12212     __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_temp.y + __pyx_v_temp.h)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 837, __pyx_L1_error)
12213     __Pyx_GOTREF(__pyx_t_5);
12214     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error)
12215     __Pyx_GOTREF(__pyx_t_3);
12216     __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 837, __pyx_L1_error)
12217     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12218     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12219     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 837, __pyx_L1_error)
12220     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12221     __pyx_t_1 = __pyx_t_2;
12222     __pyx_L7_bool_binop_done:;
12223 
12224     /* "pygame/_sdl2/video.pyx":834
12225  *             temp.h = rectptr.h
12226  *
12227  *             if temp.x < 0 or temp.y < 0 or \             # <<<<<<<<<<<<<<
12228  *                 temp.w < 0 or temp.h < 0 or \
12229  *                 temp.x + temp.w > self.srcrect.w or \
12230  */
12231     if (unlikely(__pyx_t_1)) {
12232 
12233       /* "pygame/_sdl2/video.pyx":838
12234  *                 temp.x + temp.w > self.srcrect.w or \
12235  *                 temp.y + temp.h > self.srcrect.h:
12236  *                 raise ValueError('rect values are out of range')             # <<<<<<<<<<<<<<
12237  *             temp.x += self.srcrect.x
12238  *             temp.y += self.srcrect.y
12239  */
12240       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 838, __pyx_L1_error)
12241       __Pyx_GOTREF(__pyx_t_4);
12242       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
12243       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12244       __PYX_ERR(0, 838, __pyx_L1_error)
12245 
12246       /* "pygame/_sdl2/video.pyx":834
12247  *             temp.h = rectptr.h
12248  *
12249  *             if temp.x < 0 or temp.y < 0 or \             # <<<<<<<<<<<<<<
12250  *                 temp.w < 0 or temp.h < 0 or \
12251  *                 temp.x + temp.w > self.srcrect.w or \
12252  */
12253     }
12254 
12255     /* "pygame/_sdl2/video.pyx":839
12256  *                 temp.y + temp.h > self.srcrect.h:
12257  *                 raise ValueError('rect values are out of range')
12258  *             temp.x += self.srcrect.x             # <<<<<<<<<<<<<<
12259  *             temp.y += self.srcrect.y
12260  *             self.srcrect = pgRect_New(&temp)
12261  */
12262     __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_temp.x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error)
12263     __Pyx_GOTREF(__pyx_t_4);
12264     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L1_error)
12265     __Pyx_GOTREF(__pyx_t_3);
12266     __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 839, __pyx_L1_error)
12267     __Pyx_GOTREF(__pyx_t_5);
12268     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12269     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12270     __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 839, __pyx_L1_error)
12271     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12272     __pyx_v_temp.x = __pyx_t_7;
12273 
12274     /* "pygame/_sdl2/video.pyx":840
12275  *                 raise ValueError('rect values are out of range')
12276  *             temp.x += self.srcrect.x
12277  *             temp.y += self.srcrect.y             # <<<<<<<<<<<<<<
12278  *             self.srcrect = pgRect_New(&temp)
12279  *
12280  */
12281     __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_temp.y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 840, __pyx_L1_error)
12282     __Pyx_GOTREF(__pyx_t_5);
12283     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 840, __pyx_L1_error)
12284     __Pyx_GOTREF(__pyx_t_3);
12285     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error)
12286     __Pyx_GOTREF(__pyx_t_4);
12287     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12288     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12289     __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L1_error)
12290     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12291     __pyx_v_temp.y = __pyx_t_7;
12292 
12293     /* "pygame/_sdl2/video.pyx":841
12294  *             temp.x += self.srcrect.x
12295  *             temp.y += self.srcrect.y
12296  *             self.srcrect = pgRect_New(&temp)             # <<<<<<<<<<<<<<
12297  *
12298  *     @property
12299  */
12300     __pyx_t_4 = pgRect_New((&__pyx_v_temp)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error)
12301     __Pyx_GOTREF(__pyx_t_4);
12302     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(0, 841, __pyx_L1_error)
12303     __Pyx_GIVEREF(__pyx_t_4);
12304     __Pyx_GOTREF(__pyx_v_self->srcrect);
12305     __Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
12306     __pyx_v_self->srcrect = ((pgRectObject *)__pyx_t_4);
12307     __pyx_t_4 = 0;
12308 
12309     /* "pygame/_sdl2/video.pyx":825
12310  *         self.blend_mode = textureOrImage.blend_mode
12311  *
12312  *         if srcrect is not None:             # <<<<<<<<<<<<<<
12313  *             rectptr = pgRect_FromObject(srcrect, &temp)
12314  *             if rectptr == NULL:
12315  */
12316   }
12317 
12318   /* "pygame/_sdl2/video.pyx":813
12319  *         self.alpha = 255
12320  *
12321  *     def __init__(self, textureOrImage, srcrect=None):             # <<<<<<<<<<<<<<
12322  *         cdef SDL_Rect temp
12323  *         cdef SDL_Rect *rectptr
12324  */
12325 
12326   /* function exit code */
12327   __pyx_r = 0;
12328   goto __pyx_L0;
12329   __pyx_L1_error:;
12330   __Pyx_XDECREF(__pyx_t_3);
12331   __Pyx_XDECREF(__pyx_t_4);
12332   __Pyx_XDECREF(__pyx_t_5);
12333   __Pyx_AddTraceback("pygame._sdl2.video.Image.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12334   __pyx_r = -1;
12335   __pyx_L0:;
12336   __Pyx_RefNannyFinishContext();
12337   return __pyx_r;
12338 }
12339 
12340 /* "pygame/_sdl2/video.pyx":844
12341  *
12342  *     @property
12343  *     def color(self):             # <<<<<<<<<<<<<<
12344  *         return self._color
12345  *
12346  */
12347 
12348 /* Python wrapper */
12349 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5color_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5color_1__get__(PyObject * __pyx_v_self)12350 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5color_1__get__(PyObject *__pyx_v_self) {
12351   PyObject *__pyx_r = 0;
12352   __Pyx_RefNannyDeclarations
12353   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12354   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
12355 
12356   /* function exit code */
12357   __Pyx_RefNannyFinishContext();
12358   return __pyx_r;
12359 }
12360 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)12361 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
12362   PyObject *__pyx_r = NULL;
12363   __Pyx_RefNannyDeclarations
12364   __Pyx_RefNannySetupContext("__get__", 0);
12365 
12366   /* "pygame/_sdl2/video.pyx":845
12367  *     @property
12368  *     def color(self):
12369  *         return self._color             # <<<<<<<<<<<<<<
12370  *
12371  *     @color.setter
12372  */
12373   __Pyx_XDECREF(__pyx_r);
12374   __Pyx_INCREF(((PyObject *)__pyx_v_self->_color));
12375   __pyx_r = ((PyObject *)__pyx_v_self->_color);
12376   goto __pyx_L0;
12377 
12378   /* "pygame/_sdl2/video.pyx":844
12379  *
12380  *     @property
12381  *     def color(self):             # <<<<<<<<<<<<<<
12382  *         return self._color
12383  *
12384  */
12385 
12386   /* function exit code */
12387   __pyx_L0:;
12388   __Pyx_XGIVEREF(__pyx_r);
12389   __Pyx_RefNannyFinishContext();
12390   return __pyx_r;
12391 }
12392 
12393 /* "pygame/_sdl2/video.pyx":848
12394  *
12395  *     @color.setter
12396  *     def color(self, new_color):             # <<<<<<<<<<<<<<
12397  *         self._color[:3] = new_color[:3]
12398  *
12399  */
12400 
12401 /* Python wrapper */
12402 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5color_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_color); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5color_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_new_color)12403 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5color_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_color) {
12404   int __pyx_r;
12405   __Pyx_RefNannyDeclarations
12406   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12407   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_new_color));
12408 
12409   /* function exit code */
12410   __Pyx_RefNannyFinishContext();
12411   return __pyx_r;
12412 }
12413 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_new_color)12414 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_new_color) {
12415   int __pyx_r;
12416   __Pyx_RefNannyDeclarations
12417   PyObject *__pyx_t_1 = NULL;
12418   int __pyx_lineno = 0;
12419   const char *__pyx_filename = NULL;
12420   int __pyx_clineno = 0;
12421   __Pyx_RefNannySetupContext("__set__", 0);
12422 
12423   /* "pygame/_sdl2/video.pyx":849
12424  *     @color.setter
12425  *     def color(self, new_color):
12426  *         self._color[:3] = new_color[:3]             # <<<<<<<<<<<<<<
12427  *
12428  *     @property
12429  */
12430   __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_new_color, 0, 3, NULL, NULL, &__pyx_slice__22, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error)
12431   __Pyx_GOTREF(__pyx_t_1);
12432   if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_color), __pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__22, 0, 1, 1) < 0) __PYX_ERR(0, 849, __pyx_L1_error)
12433   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12434 
12435   /* "pygame/_sdl2/video.pyx":848
12436  *
12437  *     @color.setter
12438  *     def color(self, new_color):             # <<<<<<<<<<<<<<
12439  *         self._color[:3] = new_color[:3]
12440  *
12441  */
12442 
12443   /* function exit code */
12444   __pyx_r = 0;
12445   goto __pyx_L0;
12446   __pyx_L1_error:;
12447   __Pyx_XDECREF(__pyx_t_1);
12448   __Pyx_AddTraceback("pygame._sdl2.video.Image.color.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12449   __pyx_r = -1;
12450   __pyx_L0:;
12451   __Pyx_RefNannyFinishContext();
12452   return __pyx_r;
12453 }
12454 
12455 /* "pygame/_sdl2/video.pyx":852
12456  *
12457  *     @property
12458  *     def origin(self):             # <<<<<<<<<<<<<<
12459  *         if self._originptr == NULL:
12460  *             return None
12461  */
12462 
12463 /* Python wrapper */
12464 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_1__get__(PyObject * __pyx_v_self)12465 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_1__get__(PyObject *__pyx_v_self) {
12466   PyObject *__pyx_r = 0;
12467   __Pyx_RefNannyDeclarations
12468   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12469   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
12470 
12471   /* function exit code */
12472   __Pyx_RefNannyFinishContext();
12473   return __pyx_r;
12474 }
12475 
__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)12476 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
12477   PyObject *__pyx_r = NULL;
12478   __Pyx_RefNannyDeclarations
12479   int __pyx_t_1;
12480   PyObject *__pyx_t_2 = NULL;
12481   PyObject *__pyx_t_3 = NULL;
12482   PyObject *__pyx_t_4 = NULL;
12483   int __pyx_lineno = 0;
12484   const char *__pyx_filename = NULL;
12485   int __pyx_clineno = 0;
12486   __Pyx_RefNannySetupContext("__get__", 0);
12487 
12488   /* "pygame/_sdl2/video.pyx":853
12489  *     @property
12490  *     def origin(self):
12491  *         if self._originptr == NULL:             # <<<<<<<<<<<<<<
12492  *             return None
12493  *         else:
12494  */
12495   __pyx_t_1 = ((__pyx_v_self->_originptr == NULL) != 0);
12496   if (__pyx_t_1) {
12497 
12498     /* "pygame/_sdl2/video.pyx":854
12499  *     def origin(self):
12500  *         if self._originptr == NULL:
12501  *             return None             # <<<<<<<<<<<<<<
12502  *         else:
12503  *             return (self._origin.x, self._origin.y)
12504  */
12505     __Pyx_XDECREF(__pyx_r);
12506     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12507     goto __pyx_L0;
12508 
12509     /* "pygame/_sdl2/video.pyx":853
12510  *     @property
12511  *     def origin(self):
12512  *         if self._originptr == NULL:             # <<<<<<<<<<<<<<
12513  *             return None
12514  *         else:
12515  */
12516   }
12517 
12518   /* "pygame/_sdl2/video.pyx":856
12519  *             return None
12520  *         else:
12521  *             return (self._origin.x, self._origin.y)             # <<<<<<<<<<<<<<
12522  *
12523  *     @origin.setter
12524  */
12525   /*else*/ {
12526     __Pyx_XDECREF(__pyx_r);
12527     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->_origin.x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error)
12528     __Pyx_GOTREF(__pyx_t_2);
12529     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->_origin.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 856, __pyx_L1_error)
12530     __Pyx_GOTREF(__pyx_t_3);
12531     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 856, __pyx_L1_error)
12532     __Pyx_GOTREF(__pyx_t_4);
12533     __Pyx_GIVEREF(__pyx_t_2);
12534     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
12535     __Pyx_GIVEREF(__pyx_t_3);
12536     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
12537     __pyx_t_2 = 0;
12538     __pyx_t_3 = 0;
12539     __pyx_r = __pyx_t_4;
12540     __pyx_t_4 = 0;
12541     goto __pyx_L0;
12542   }
12543 
12544   /* "pygame/_sdl2/video.pyx":852
12545  *
12546  *     @property
12547  *     def origin(self):             # <<<<<<<<<<<<<<
12548  *         if self._originptr == NULL:
12549  *             return None
12550  */
12551 
12552   /* function exit code */
12553   __pyx_L1_error:;
12554   __Pyx_XDECREF(__pyx_t_2);
12555   __Pyx_XDECREF(__pyx_t_3);
12556   __Pyx_XDECREF(__pyx_t_4);
12557   __Pyx_AddTraceback("pygame._sdl2.video.Image.origin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12558   __pyx_r = NULL;
12559   __pyx_L0:;
12560   __Pyx_XGIVEREF(__pyx_r);
12561   __Pyx_RefNannyFinishContext();
12562   return __pyx_r;
12563 }
12564 
12565 /* "pygame/_sdl2/video.pyx":859
12566  *
12567  *     @origin.setter
12568  *     def origin(self, new_origin):             # <<<<<<<<<<<<<<
12569  *         if new_origin:
12570  *             self._origin.x = <int>new_origin[0]
12571  */
12572 
12573 /* Python wrapper */
12574 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_origin); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_new_origin)12575 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_origin) {
12576   int __pyx_r;
12577   __Pyx_RefNannyDeclarations
12578   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12579   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_new_origin));
12580 
12581   /* function exit code */
12582   __Pyx_RefNannyFinishContext();
12583   return __pyx_r;
12584 }
12585 
__pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_new_origin)12586 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_6origin_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_new_origin) {
12587   int __pyx_r;
12588   __Pyx_RefNannyDeclarations
12589   int __pyx_t_1;
12590   PyObject *__pyx_t_2 = NULL;
12591   int __pyx_t_3;
12592   int __pyx_lineno = 0;
12593   const char *__pyx_filename = NULL;
12594   int __pyx_clineno = 0;
12595   __Pyx_RefNannySetupContext("__set__", 0);
12596 
12597   /* "pygame/_sdl2/video.pyx":860
12598  *     @origin.setter
12599  *     def origin(self, new_origin):
12600  *         if new_origin:             # <<<<<<<<<<<<<<
12601  *             self._origin.x = <int>new_origin[0]
12602  *             self._origin.y = <int>new_origin[1]
12603  */
12604   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_new_origin); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 860, __pyx_L1_error)
12605   if (__pyx_t_1) {
12606 
12607     /* "pygame/_sdl2/video.pyx":861
12608  *     def origin(self, new_origin):
12609  *         if new_origin:
12610  *             self._origin.x = <int>new_origin[0]             # <<<<<<<<<<<<<<
12611  *             self._origin.y = <int>new_origin[1]
12612  *             self._originptr = &self._origin
12613  */
12614     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_origin, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 861, __pyx_L1_error)
12615     __Pyx_GOTREF(__pyx_t_2);
12616     __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L1_error)
12617     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12618     __pyx_v_self->_origin.x = ((int)__pyx_t_3);
12619 
12620     /* "pygame/_sdl2/video.pyx":862
12621  *         if new_origin:
12622  *             self._origin.x = <int>new_origin[0]
12623  *             self._origin.y = <int>new_origin[1]             # <<<<<<<<<<<<<<
12624  *             self._originptr = &self._origin
12625  *         else:
12626  */
12627     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_origin, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 862, __pyx_L1_error)
12628     __Pyx_GOTREF(__pyx_t_2);
12629     __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L1_error)
12630     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12631     __pyx_v_self->_origin.y = ((int)__pyx_t_3);
12632 
12633     /* "pygame/_sdl2/video.pyx":863
12634  *             self._origin.x = <int>new_origin[0]
12635  *             self._origin.y = <int>new_origin[1]
12636  *             self._originptr = &self._origin             # <<<<<<<<<<<<<<
12637  *         else:
12638  *             self._originptr = NULL
12639  */
12640     __pyx_v_self->_originptr = (&__pyx_v_self->_origin);
12641 
12642     /* "pygame/_sdl2/video.pyx":860
12643  *     @origin.setter
12644  *     def origin(self, new_origin):
12645  *         if new_origin:             # <<<<<<<<<<<<<<
12646  *             self._origin.x = <int>new_origin[0]
12647  *             self._origin.y = <int>new_origin[1]
12648  */
12649     goto __pyx_L3;
12650   }
12651 
12652   /* "pygame/_sdl2/video.pyx":865
12653  *             self._originptr = &self._origin
12654  *         else:
12655  *             self._originptr = NULL             # <<<<<<<<<<<<<<
12656  *
12657  *     def get_rect(self):
12658  */
12659   /*else*/ {
12660     __pyx_v_self->_originptr = NULL;
12661   }
12662   __pyx_L3:;
12663 
12664   /* "pygame/_sdl2/video.pyx":859
12665  *
12666  *     @origin.setter
12667  *     def origin(self, new_origin):             # <<<<<<<<<<<<<<
12668  *         if new_origin:
12669  *             self._origin.x = <int>new_origin[0]
12670  */
12671 
12672   /* function exit code */
12673   __pyx_r = 0;
12674   goto __pyx_L0;
12675   __pyx_L1_error:;
12676   __Pyx_XDECREF(__pyx_t_2);
12677   __Pyx_AddTraceback("pygame._sdl2.video.Image.origin.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12678   __pyx_r = -1;
12679   __pyx_L0:;
12680   __Pyx_RefNannyFinishContext();
12681   return __pyx_r;
12682 }
12683 
12684 /* "pygame/_sdl2/video.pyx":867
12685  *             self._originptr = NULL
12686  *
12687  *     def get_rect(self):             # <<<<<<<<<<<<<<
12688  *         return pgRect_New(&self.srcrect.r)
12689  *
12690  */
12691 
12692 /* Python wrapper */
12693 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12694 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12695   PyObject *__pyx_r = 0;
12696   __Pyx_RefNannyDeclarations
12697   __Pyx_RefNannySetupContext("get_rect (wrapper)", 0);
12698   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_4get_rect(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
12699 
12700   /* function exit code */
12701   __Pyx_RefNannyFinishContext();
12702   return __pyx_r;
12703 }
12704 
__pyx_pf_6pygame_5_sdl2_5video_5Image_4get_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)12705 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_4get_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
12706   PyObject *__pyx_r = NULL;
12707   __Pyx_RefNannyDeclarations
12708   PyObject *__pyx_t_1 = NULL;
12709   int __pyx_lineno = 0;
12710   const char *__pyx_filename = NULL;
12711   int __pyx_clineno = 0;
12712   __Pyx_RefNannySetupContext("get_rect", 0);
12713 
12714   /* "pygame/_sdl2/video.pyx":868
12715  *
12716  *     def get_rect(self):
12717  *         return pgRect_New(&self.srcrect.r)             # <<<<<<<<<<<<<<
12718  *
12719  *     cpdef void draw(self, srcrect=None, dstrect=None):
12720  */
12721   __Pyx_XDECREF(__pyx_r);
12722   __pyx_t_1 = pgRect_New((&__pyx_v_self->srcrect->r)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
12723   __Pyx_GOTREF(__pyx_t_1);
12724   __pyx_r = __pyx_t_1;
12725   __pyx_t_1 = 0;
12726   goto __pyx_L0;
12727 
12728   /* "pygame/_sdl2/video.pyx":867
12729  *             self._originptr = NULL
12730  *
12731  *     def get_rect(self):             # <<<<<<<<<<<<<<
12732  *         return pgRect_New(&self.srcrect.r)
12733  *
12734  */
12735 
12736   /* function exit code */
12737   __pyx_L1_error:;
12738   __Pyx_XDECREF(__pyx_t_1);
12739   __Pyx_AddTraceback("pygame._sdl2.video.Image.get_rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
12740   __pyx_r = NULL;
12741   __pyx_L0:;
12742   __Pyx_XGIVEREF(__pyx_r);
12743   __Pyx_RefNannyFinishContext();
12744   return __pyx_r;
12745 }
12746 
12747 /* "pygame/_sdl2/video.pyx":870
12748  *         return pgRect_New(&self.srcrect.r)
12749  *
12750  *     cpdef void draw(self, srcrect=None, dstrect=None):             # <<<<<<<<<<<<<<
12751  *         """ Copy a portion of the image to the rendering target.
12752  *
12753  */
12754 
12755 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,int __pyx_skip_dispatch,struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw * __pyx_optional_args)12756 static void __pyx_f_6pygame_5_sdl2_5video_5Image_draw(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw *__pyx_optional_args) {
12757   PyObject *__pyx_v_srcrect = ((PyObject *)Py_None);
12758   PyObject *__pyx_v_dstrect = ((PyObject *)Py_None);
12759   SDL_Rect __pyx_v_src;
12760   SDL_Rect __pyx_v_dst;
12761   SDL_Rect *__pyx_v_csrcrect;
12762   SDL_Rect *__pyx_v_cdstrect;
12763   SDL_Rect *__pyx_v_rectptr;
12764   __Pyx_RefNannyDeclarations
12765   PyObject *__pyx_t_1 = NULL;
12766   PyObject *__pyx_t_2 = NULL;
12767   PyObject *__pyx_t_3 = NULL;
12768   PyObject *__pyx_t_4 = NULL;
12769   int __pyx_t_5;
12770   PyObject *__pyx_t_6 = NULL;
12771   int __pyx_t_7;
12772   int __pyx_t_8;
12773   SDL_Rect __pyx_t_9;
12774   Py_ssize_t __pyx_t_10;
12775   struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal __pyx_t_11;
12776   int __pyx_lineno = 0;
12777   const char *__pyx_filename = NULL;
12778   int __pyx_clineno = 0;
12779   __Pyx_RefNannySetupContext("draw", 0);
12780   if (__pyx_optional_args) {
12781     if (__pyx_optional_args->__pyx_n > 0) {
12782       __pyx_v_srcrect = __pyx_optional_args->srcrect;
12783       if (__pyx_optional_args->__pyx_n > 1) {
12784         __pyx_v_dstrect = __pyx_optional_args->dstrect;
12785       }
12786     }
12787   }
12788   /* Check if called by wrapper */
12789   if (unlikely(__pyx_skip_dispatch)) ;
12790   /* Check if overridden in Python */
12791   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
12792     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
12793     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
12794     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
12795       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
12796       #endif
12797       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 870, __pyx_L1_error)
12798       __Pyx_GOTREF(__pyx_t_1);
12799       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw)) {
12800         __Pyx_INCREF(__pyx_t_1);
12801         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
12802         __pyx_t_5 = 0;
12803         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
12804           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
12805           if (likely(__pyx_t_4)) {
12806             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12807             __Pyx_INCREF(__pyx_t_4);
12808             __Pyx_INCREF(function);
12809             __Pyx_DECREF_SET(__pyx_t_3, function);
12810             __pyx_t_5 = 1;
12811           }
12812         }
12813         #if CYTHON_FAST_PYCALL
12814         if (PyFunction_Check(__pyx_t_3)) {
12815           PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_srcrect, __pyx_v_dstrect};
12816           __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
12817           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12818           __Pyx_GOTREF(__pyx_t_2);
12819         } else
12820         #endif
12821         #if CYTHON_FAST_PYCCALL
12822         if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
12823           PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_srcrect, __pyx_v_dstrect};
12824           __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
12825           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12826           __Pyx_GOTREF(__pyx_t_2);
12827         } else
12828         #endif
12829         {
12830           __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 870, __pyx_L1_error)
12831           __Pyx_GOTREF(__pyx_t_6);
12832           if (__pyx_t_4) {
12833             __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
12834           }
12835           __Pyx_INCREF(__pyx_v_srcrect);
12836           __Pyx_GIVEREF(__pyx_v_srcrect);
12837           PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_srcrect);
12838           __Pyx_INCREF(__pyx_v_dstrect);
12839           __Pyx_GIVEREF(__pyx_v_dstrect);
12840           PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_dstrect);
12841           __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
12842           __Pyx_GOTREF(__pyx_t_2);
12843           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12844         }
12845         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12846         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12847         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12848         goto __pyx_L0;
12849       }
12850       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
12851       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
12852       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
12853       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
12854         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
12855       }
12856       #endif
12857       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12858       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
12859     }
12860     #endif
12861   }
12862 
12863   /* "pygame/_sdl2/video.pyx":879
12864  *         cdef SDL_Rect src
12865  *         cdef SDL_Rect dst
12866  *         cdef SDL_Rect *csrcrect = NULL             # <<<<<<<<<<<<<<
12867  *         cdef SDL_Rect *cdstrect = NULL
12868  *         cdef SDL_Rect *rectptr
12869  */
12870   __pyx_v_csrcrect = NULL;
12871 
12872   /* "pygame/_sdl2/video.pyx":880
12873  *         cdef SDL_Rect dst
12874  *         cdef SDL_Rect *csrcrect = NULL
12875  *         cdef SDL_Rect *cdstrect = NULL             # <<<<<<<<<<<<<<
12876  *         cdef SDL_Rect *rectptr
12877  *
12878  */
12879   __pyx_v_cdstrect = NULL;
12880 
12881   /* "pygame/_sdl2/video.pyx":883
12882  *         cdef SDL_Rect *rectptr
12883  *
12884  *         if srcrect is None:             # <<<<<<<<<<<<<<
12885  *             csrcrect = &self.srcrect.r
12886  *         else:
12887  */
12888   __pyx_t_7 = (__pyx_v_srcrect == Py_None);
12889   __pyx_t_8 = (__pyx_t_7 != 0);
12890   if (__pyx_t_8) {
12891 
12892     /* "pygame/_sdl2/video.pyx":884
12893  *
12894  *         if srcrect is None:
12895  *             csrcrect = &self.srcrect.r             # <<<<<<<<<<<<<<
12896  *         else:
12897  *             if pgRect_Check(srcrect):
12898  */
12899     __pyx_v_csrcrect = (&__pyx_v_self->srcrect->r);
12900 
12901     /* "pygame/_sdl2/video.pyx":883
12902  *         cdef SDL_Rect *rectptr
12903  *
12904  *         if srcrect is None:             # <<<<<<<<<<<<<<
12905  *             csrcrect = &self.srcrect.r
12906  *         else:
12907  */
12908     goto __pyx_L3;
12909   }
12910 
12911   /* "pygame/_sdl2/video.pyx":886
12912  *             csrcrect = &self.srcrect.r
12913  *         else:
12914  *             if pgRect_Check(srcrect):             # <<<<<<<<<<<<<<
12915  *                 src = (<Rect>srcrect).r
12916  *             else:
12917  */
12918   /*else*/ {
12919     __pyx_t_8 = (pgRect_Check(__pyx_v_srcrect) != 0);
12920     if (__pyx_t_8) {
12921 
12922       /* "pygame/_sdl2/video.pyx":887
12923  *         else:
12924  *             if pgRect_Check(srcrect):
12925  *                 src = (<Rect>srcrect).r             # <<<<<<<<<<<<<<
12926  *             else:
12927  *
12928  */
12929       __pyx_t_9 = ((pgRectObject *)__pyx_v_srcrect)->r;
12930       __pyx_v_src = __pyx_t_9;
12931 
12932       /* "pygame/_sdl2/video.pyx":886
12933  *             csrcrect = &self.srcrect.r
12934  *         else:
12935  *             if pgRect_Check(srcrect):             # <<<<<<<<<<<<<<
12936  *                 src = (<Rect>srcrect).r
12937  *             else:
12938  */
12939       goto __pyx_L4;
12940     }
12941 
12942     /* "pygame/_sdl2/video.pyx":890
12943  *             else:
12944  *
12945  *                 rectptr = pgRect_FromObject(srcrect, &src)             # <<<<<<<<<<<<<<
12946  *                 if rectptr == NULL:
12947  *                     raise TypeError('srcrect must be a rect or None')
12948  */
12949     /*else*/ {
12950       __pyx_v_rectptr = pgRect_FromObject(__pyx_v_srcrect, (&__pyx_v_src));
12951 
12952       /* "pygame/_sdl2/video.pyx":891
12953  *
12954  *                 rectptr = pgRect_FromObject(srcrect, &src)
12955  *                 if rectptr == NULL:             # <<<<<<<<<<<<<<
12956  *                     raise TypeError('srcrect must be a rect or None')
12957  *                 src.x = rectptr.x
12958  */
12959       __pyx_t_8 = ((__pyx_v_rectptr == NULL) != 0);
12960       if (unlikely(__pyx_t_8)) {
12961 
12962         /* "pygame/_sdl2/video.pyx":892
12963  *                 rectptr = pgRect_FromObject(srcrect, &src)
12964  *                 if rectptr == NULL:
12965  *                     raise TypeError('srcrect must be a rect or None')             # <<<<<<<<<<<<<<
12966  *                 src.x = rectptr.x
12967  *                 src.y = rectptr.y
12968  */
12969         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 892, __pyx_L1_error)
12970         __Pyx_GOTREF(__pyx_t_1);
12971         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12972         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12973         __PYX_ERR(0, 892, __pyx_L1_error)
12974 
12975         /* "pygame/_sdl2/video.pyx":891
12976  *
12977  *                 rectptr = pgRect_FromObject(srcrect, &src)
12978  *                 if rectptr == NULL:             # <<<<<<<<<<<<<<
12979  *                     raise TypeError('srcrect must be a rect or None')
12980  *                 src.x = rectptr.x
12981  */
12982       }
12983 
12984       /* "pygame/_sdl2/video.pyx":893
12985  *                 if rectptr == NULL:
12986  *                     raise TypeError('srcrect must be a rect or None')
12987  *                 src.x = rectptr.x             # <<<<<<<<<<<<<<
12988  *                 src.y = rectptr.y
12989  *                 src.w = rectptr.w
12990  */
12991       __pyx_t_5 = __pyx_v_rectptr->x;
12992       __pyx_v_src.x = __pyx_t_5;
12993 
12994       /* "pygame/_sdl2/video.pyx":894
12995  *                     raise TypeError('srcrect must be a rect or None')
12996  *                 src.x = rectptr.x
12997  *                 src.y = rectptr.y             # <<<<<<<<<<<<<<
12998  *                 src.w = rectptr.w
12999  *                 src.h = rectptr.h
13000  */
13001       __pyx_t_5 = __pyx_v_rectptr->y;
13002       __pyx_v_src.y = __pyx_t_5;
13003 
13004       /* "pygame/_sdl2/video.pyx":895
13005  *                 src.x = rectptr.x
13006  *                 src.y = rectptr.y
13007  *                 src.w = rectptr.w             # <<<<<<<<<<<<<<
13008  *                 src.h = rectptr.h
13009  *
13010  */
13011       __pyx_t_5 = __pyx_v_rectptr->w;
13012       __pyx_v_src.w = __pyx_t_5;
13013 
13014       /* "pygame/_sdl2/video.pyx":896
13015  *                 src.y = rectptr.y
13016  *                 src.w = rectptr.w
13017  *                 src.h = rectptr.h             # <<<<<<<<<<<<<<
13018  *
13019  *             src.x += self.srcrect.x
13020  */
13021       __pyx_t_5 = __pyx_v_rectptr->h;
13022       __pyx_v_src.h = __pyx_t_5;
13023     }
13024     __pyx_L4:;
13025 
13026     /* "pygame/_sdl2/video.pyx":898
13027  *                 src.h = rectptr.h
13028  *
13029  *             src.x += self.srcrect.x             # <<<<<<<<<<<<<<
13030  *             src.y += self.srcrect.y
13031  *             csrcrect = &src
13032  */
13033     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_src.x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
13034     __Pyx_GOTREF(__pyx_t_1);
13035     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 898, __pyx_L1_error)
13036     __Pyx_GOTREF(__pyx_t_2);
13037     __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 898, __pyx_L1_error)
13038     __Pyx_GOTREF(__pyx_t_3);
13039     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13040     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13041     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 898, __pyx_L1_error)
13042     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13043     __pyx_v_src.x = __pyx_t_5;
13044 
13045     /* "pygame/_sdl2/video.pyx":899
13046  *
13047  *             src.x += self.srcrect.x
13048  *             src.y += self.srcrect.y             # <<<<<<<<<<<<<<
13049  *             csrcrect = &src
13050  *
13051  */
13052     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_src.y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
13053     __Pyx_GOTREF(__pyx_t_3);
13054     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 899, __pyx_L1_error)
13055     __Pyx_GOTREF(__pyx_t_2);
13056     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error)
13057     __Pyx_GOTREF(__pyx_t_1);
13058     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13059     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13060     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 899, __pyx_L1_error)
13061     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13062     __pyx_v_src.y = __pyx_t_5;
13063 
13064     /* "pygame/_sdl2/video.pyx":900
13065  *             src.x += self.srcrect.x
13066  *             src.y += self.srcrect.y
13067  *             csrcrect = &src             # <<<<<<<<<<<<<<
13068  *
13069  *         if dstrect is not None:
13070  */
13071     __pyx_v_csrcrect = (&__pyx_v_src);
13072   }
13073   __pyx_L3:;
13074 
13075   /* "pygame/_sdl2/video.pyx":902
13076  *             csrcrect = &src
13077  *
13078  *         if dstrect is not None:             # <<<<<<<<<<<<<<
13079  *             cdstrect = pgRect_FromObject(dstrect, &dst)
13080  *             if cdstrect == NULL:
13081  */
13082   __pyx_t_8 = (__pyx_v_dstrect != Py_None);
13083   __pyx_t_7 = (__pyx_t_8 != 0);
13084   if (__pyx_t_7) {
13085 
13086     /* "pygame/_sdl2/video.pyx":903
13087  *
13088  *         if dstrect is not None:
13089  *             cdstrect = pgRect_FromObject(dstrect, &dst)             # <<<<<<<<<<<<<<
13090  *             if cdstrect == NULL:
13091  *                 if len(dstrect) == 2:
13092  */
13093     __pyx_v_cdstrect = pgRect_FromObject(__pyx_v_dstrect, (&__pyx_v_dst));
13094 
13095     /* "pygame/_sdl2/video.pyx":904
13096  *         if dstrect is not None:
13097  *             cdstrect = pgRect_FromObject(dstrect, &dst)
13098  *             if cdstrect == NULL:             # <<<<<<<<<<<<<<
13099  *                 if len(dstrect) == 2:
13100  *                     dst.x = dstrect[0]
13101  */
13102     __pyx_t_7 = ((__pyx_v_cdstrect == NULL) != 0);
13103     if (__pyx_t_7) {
13104 
13105       /* "pygame/_sdl2/video.pyx":905
13106  *             cdstrect = pgRect_FromObject(dstrect, &dst)
13107  *             if cdstrect == NULL:
13108  *                 if len(dstrect) == 2:             # <<<<<<<<<<<<<<
13109  *                     dst.x = dstrect[0]
13110  *                     dst.y = dstrect[1]
13111  */
13112       __pyx_t_10 = PyObject_Length(__pyx_v_dstrect); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 905, __pyx_L1_error)
13113       __pyx_t_7 = ((__pyx_t_10 == 2) != 0);
13114       if (likely(__pyx_t_7)) {
13115 
13116         /* "pygame/_sdl2/video.pyx":906
13117  *             if cdstrect == NULL:
13118  *                 if len(dstrect) == 2:
13119  *                     dst.x = dstrect[0]             # <<<<<<<<<<<<<<
13120  *                     dst.y = dstrect[1]
13121  *                     dst.w = self.srcrect.w
13122  */
13123         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error)
13124         __Pyx_GOTREF(__pyx_t_1);
13125         __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 906, __pyx_L1_error)
13126         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13127         __pyx_v_dst.x = __pyx_t_5;
13128 
13129         /* "pygame/_sdl2/video.pyx":907
13130  *                 if len(dstrect) == 2:
13131  *                     dst.x = dstrect[0]
13132  *                     dst.y = dstrect[1]             # <<<<<<<<<<<<<<
13133  *                     dst.w = self.srcrect.w
13134  *                     dst.h = self.srcrect.h
13135  */
13136         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_dstrect, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
13137         __Pyx_GOTREF(__pyx_t_1);
13138         __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 907, __pyx_L1_error)
13139         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13140         __pyx_v_dst.y = __pyx_t_5;
13141 
13142         /* "pygame/_sdl2/video.pyx":908
13143  *                     dst.x = dstrect[0]
13144  *                     dst.y = dstrect[1]
13145  *                     dst.w = self.srcrect.w             # <<<<<<<<<<<<<<
13146  *                     dst.h = self.srcrect.h
13147  *                     cdstrect = &dst
13148  */
13149         __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
13150         __Pyx_GOTREF(__pyx_t_1);
13151         __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 908, __pyx_L1_error)
13152         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13153         __pyx_v_dst.w = __pyx_t_5;
13154 
13155         /* "pygame/_sdl2/video.pyx":909
13156  *                     dst.y = dstrect[1]
13157  *                     dst.w = self.srcrect.w
13158  *                     dst.h = self.srcrect.h             # <<<<<<<<<<<<<<
13159  *                     cdstrect = &dst
13160  *                 else:
13161  */
13162         __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->srcrect), __pyx_n_s_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
13163         __Pyx_GOTREF(__pyx_t_1);
13164         __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 909, __pyx_L1_error)
13165         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13166         __pyx_v_dst.h = __pyx_t_5;
13167 
13168         /* "pygame/_sdl2/video.pyx":910
13169  *                     dst.w = self.srcrect.w
13170  *                     dst.h = self.srcrect.h
13171  *                     cdstrect = &dst             # <<<<<<<<<<<<<<
13172  *                 else:
13173  *                     raise TypeError('dstrect must be a position, rect, or None')
13174  */
13175         __pyx_v_cdstrect = (&__pyx_v_dst);
13176 
13177         /* "pygame/_sdl2/video.pyx":905
13178  *             cdstrect = pgRect_FromObject(dstrect, &dst)
13179  *             if cdstrect == NULL:
13180  *                 if len(dstrect) == 2:             # <<<<<<<<<<<<<<
13181  *                     dst.x = dstrect[0]
13182  *                     dst.y = dstrect[1]
13183  */
13184         goto __pyx_L8;
13185       }
13186 
13187       /* "pygame/_sdl2/video.pyx":912
13188  *                     cdstrect = &dst
13189  *                 else:
13190  *                     raise TypeError('dstrect must be a position, rect, or None')             # <<<<<<<<<<<<<<
13191  *
13192  *         self.texture.color = self._color
13193  */
13194       /*else*/ {
13195         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 912, __pyx_L1_error)
13196         __Pyx_GOTREF(__pyx_t_1);
13197         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13198         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13199         __PYX_ERR(0, 912, __pyx_L1_error)
13200       }
13201       __pyx_L8:;
13202 
13203       /* "pygame/_sdl2/video.pyx":904
13204  *         if dstrect is not None:
13205  *             cdstrect = pgRect_FromObject(dstrect, &dst)
13206  *             if cdstrect == NULL:             # <<<<<<<<<<<<<<
13207  *                 if len(dstrect) == 2:
13208  *                     dst.x = dstrect[0]
13209  */
13210     }
13211 
13212     /* "pygame/_sdl2/video.pyx":902
13213  *             csrcrect = &src
13214  *
13215  *         if dstrect is not None:             # <<<<<<<<<<<<<<
13216  *             cdstrect = pgRect_FromObject(dstrect, &dst)
13217  *             if cdstrect == NULL:
13218  */
13219   }
13220 
13221   /* "pygame/_sdl2/video.pyx":914
13222  *                     raise TypeError('dstrect must be a position, rect, or None')
13223  *
13224  *         self.texture.color = self._color             # <<<<<<<<<<<<<<
13225  *         self.texture.alpha = self.alpha
13226  *         self.texture.blend_mode = self.blend_mode
13227  */
13228   __pyx_t_1 = ((PyObject *)__pyx_v_self->_color);
13229   __Pyx_INCREF(__pyx_t_1);
13230   if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_color, __pyx_t_1) < 0) __PYX_ERR(0, 914, __pyx_L1_error)
13231   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13232 
13233   /* "pygame/_sdl2/video.pyx":915
13234  *
13235  *         self.texture.color = self._color
13236  *         self.texture.alpha = self.alpha             # <<<<<<<<<<<<<<
13237  *         self.texture.blend_mode = self.blend_mode
13238  *
13239  */
13240   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error)
13241   __Pyx_GOTREF(__pyx_t_1);
13242   if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 915, __pyx_L1_error)
13243   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13244 
13245   /* "pygame/_sdl2/video.pyx":916
13246  *         self.texture.color = self._color
13247  *         self.texture.alpha = self.alpha
13248  *         self.texture.blend_mode = self.blend_mode             # <<<<<<<<<<<<<<
13249  *
13250  *         self.texture.draw_internal(csrcrect, cdstrect, self.angle,
13251  */
13252   __pyx_t_1 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_self->blend_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
13253   __Pyx_GOTREF(__pyx_t_1);
13254   if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self->texture), __pyx_n_s_blend_mode, __pyx_t_1) < 0) __PYX_ERR(0, 916, __pyx_L1_error)
13255   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13256 
13257   /* "pygame/_sdl2/video.pyx":918
13258  *         self.texture.blend_mode = self.blend_mode
13259  *
13260  *         self.texture.draw_internal(csrcrect, cdstrect, self.angle,             # <<<<<<<<<<<<<<
13261  *                                    self._originptr, self.flipX, self.flipY)
13262  *
13263  */
13264   __pyx_t_11.__pyx_n = 4;
13265   __pyx_t_11.angle = __pyx_v_self->angle;
13266   __pyx_t_11.originptr = __pyx_v_self->_originptr;
13267   __pyx_t_11.flipX = __pyx_v_self->flipX;
13268   __pyx_t_11.flipY = __pyx_v_self->flipY;
13269   __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)__pyx_v_self->texture->__pyx_vtab)->draw_internal(__pyx_v_self->texture, __pyx_v_csrcrect, __pyx_v_cdstrect, &__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
13270   __Pyx_GOTREF(__pyx_t_1);
13271   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13272 
13273   /* "pygame/_sdl2/video.pyx":870
13274  *         return pgRect_New(&self.srcrect.r)
13275  *
13276  *     cpdef void draw(self, srcrect=None, dstrect=None):             # <<<<<<<<<<<<<<
13277  *         """ Copy a portion of the image to the rendering target.
13278  *
13279  */
13280 
13281   /* function exit code */
13282   goto __pyx_L0;
13283   __pyx_L1_error:;
13284   __Pyx_XDECREF(__pyx_t_1);
13285   __Pyx_XDECREF(__pyx_t_2);
13286   __Pyx_XDECREF(__pyx_t_3);
13287   __Pyx_XDECREF(__pyx_t_4);
13288   __Pyx_XDECREF(__pyx_t_6);
13289   __Pyx_WriteUnraisable("pygame._sdl2.video.Image.draw", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13290   __pyx_L0:;
13291   __Pyx_RefNannyFinishContext();
13292 }
13293 
13294 /* Python wrapper */
13295 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13296 static char __pyx_doc_6pygame_5_sdl2_5video_5Image_6draw[] = " Copy a portion of the image to the rendering target.\n\n        :param srcrect: source rectangle specifying a sub-image, or None for the entire image.\n        :param dstrect: destination rectangle or position on the render target, or None for entire target.\n                        The image is stretched to fill dstrect.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)13297 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13298   PyObject *__pyx_v_srcrect = 0;
13299   PyObject *__pyx_v_dstrect = 0;
13300   int __pyx_lineno = 0;
13301   const char *__pyx_filename = NULL;
13302   int __pyx_clineno = 0;
13303   PyObject *__pyx_r = 0;
13304   __Pyx_RefNannyDeclarations
13305   __Pyx_RefNannySetupContext("draw (wrapper)", 0);
13306   {
13307     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_srcrect,&__pyx_n_s_dstrect,0};
13308     PyObject* values[2] = {0,0};
13309     values[0] = ((PyObject *)Py_None);
13310     values[1] = ((PyObject *)Py_None);
13311     if (unlikely(__pyx_kwds)) {
13312       Py_ssize_t kw_args;
13313       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13314       switch (pos_args) {
13315         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13316         CYTHON_FALLTHROUGH;
13317         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13318         CYTHON_FALLTHROUGH;
13319         case  0: break;
13320         default: goto __pyx_L5_argtuple_error;
13321       }
13322       kw_args = PyDict_Size(__pyx_kwds);
13323       switch (pos_args) {
13324         case  0:
13325         if (kw_args > 0) {
13326           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_srcrect);
13327           if (value) { values[0] = value; kw_args--; }
13328         }
13329         CYTHON_FALLTHROUGH;
13330         case  1:
13331         if (kw_args > 0) {
13332           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dstrect);
13333           if (value) { values[1] = value; kw_args--; }
13334         }
13335       }
13336       if (unlikely(kw_args > 0)) {
13337         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw") < 0)) __PYX_ERR(0, 870, __pyx_L3_error)
13338       }
13339     } else {
13340       switch (PyTuple_GET_SIZE(__pyx_args)) {
13341         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13342         CYTHON_FALLTHROUGH;
13343         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13344         CYTHON_FALLTHROUGH;
13345         case  0: break;
13346         default: goto __pyx_L5_argtuple_error;
13347       }
13348     }
13349     __pyx_v_srcrect = values[0];
13350     __pyx_v_dstrect = values[1];
13351   }
13352   goto __pyx_L4_argument_unpacking_done;
13353   __pyx_L5_argtuple_error:;
13354   __Pyx_RaiseArgtupleInvalid("draw", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 870, __pyx_L3_error)
13355   __pyx_L3_error:;
13356   __Pyx_AddTraceback("pygame._sdl2.video.Image.draw", __pyx_clineno, __pyx_lineno, __pyx_filename);
13357   __Pyx_RefNannyFinishContext();
13358   return NULL;
13359   __pyx_L4_argument_unpacking_done:;
13360   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_6draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), __pyx_v_srcrect, __pyx_v_dstrect);
13361 
13362   /* function exit code */
13363   __Pyx_RefNannyFinishContext();
13364   return __pyx_r;
13365 }
13366 
__pyx_pf_6pygame_5_sdl2_5video_5Image_6draw(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_srcrect,PyObject * __pyx_v_dstrect)13367 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_6draw(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_srcrect, PyObject *__pyx_v_dstrect) {
13368   PyObject *__pyx_r = NULL;
13369   __Pyx_RefNannyDeclarations
13370   struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw __pyx_t_1;
13371   PyObject *__pyx_t_2 = NULL;
13372   int __pyx_lineno = 0;
13373   const char *__pyx_filename = NULL;
13374   int __pyx_clineno = 0;
13375   __Pyx_RefNannySetupContext("draw", 0);
13376   __Pyx_XDECREF(__pyx_r);
13377   __pyx_t_1.__pyx_n = 2;
13378   __pyx_t_1.srcrect = __pyx_v_srcrect;
13379   __pyx_t_1.dstrect = __pyx_v_dstrect;
13380   __pyx_vtabptr_6pygame_5_sdl2_5video_Image->draw(__pyx_v_self, 1, &__pyx_t_1);
13381   __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error)
13382   __Pyx_GOTREF(__pyx_t_2);
13383   __pyx_r = __pyx_t_2;
13384   __pyx_t_2 = 0;
13385   goto __pyx_L0;
13386 
13387   /* function exit code */
13388   __pyx_L1_error:;
13389   __Pyx_XDECREF(__pyx_t_2);
13390   __Pyx_AddTraceback("pygame._sdl2.video.Image.draw", __pyx_clineno, __pyx_lineno, __pyx_filename);
13391   __pyx_r = NULL;
13392   __pyx_L0:;
13393   __Pyx_XGIVEREF(__pyx_r);
13394   __Pyx_RefNannyFinishContext();
13395   return __pyx_r;
13396 }
13397 
13398 /* "pygame/_sdl2/video.pxd":408
13399  * cdef class Image:
13400  *     cdef Color _color
13401  *     cdef public float angle             # <<<<<<<<<<<<<<
13402  *     cdef SDL_Point _origin
13403  *     cdef SDL_Point* _originptr
13404  */
13405 
13406 /* Python wrapper */
13407 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_1__get__(PyObject * __pyx_v_self)13408 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_1__get__(PyObject *__pyx_v_self) {
13409   PyObject *__pyx_r = 0;
13410   __Pyx_RefNannyDeclarations
13411   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13412   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5angle___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13413 
13414   /* function exit code */
13415   __Pyx_RefNannyFinishContext();
13416   return __pyx_r;
13417 }
13418 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5angle___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13419 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5angle___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13420   PyObject *__pyx_r = NULL;
13421   __Pyx_RefNannyDeclarations
13422   PyObject *__pyx_t_1 = NULL;
13423   int __pyx_lineno = 0;
13424   const char *__pyx_filename = NULL;
13425   int __pyx_clineno = 0;
13426   __Pyx_RefNannySetupContext("__get__", 0);
13427   __Pyx_XDECREF(__pyx_r);
13428   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->angle); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 408, __pyx_L1_error)
13429   __Pyx_GOTREF(__pyx_t_1);
13430   __pyx_r = __pyx_t_1;
13431   __pyx_t_1 = 0;
13432   goto __pyx_L0;
13433 
13434   /* function exit code */
13435   __pyx_L1_error:;
13436   __Pyx_XDECREF(__pyx_t_1);
13437   __Pyx_AddTraceback("pygame._sdl2.video.Image.angle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13438   __pyx_r = NULL;
13439   __pyx_L0:;
13440   __Pyx_XGIVEREF(__pyx_r);
13441   __Pyx_RefNannyFinishContext();
13442   return __pyx_r;
13443 }
13444 
13445 /* Python wrapper */
13446 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13447 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13448   int __pyx_r;
13449   __Pyx_RefNannyDeclarations
13450   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13451   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5angle_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13452 
13453   /* function exit code */
13454   __Pyx_RefNannyFinishContext();
13455   return __pyx_r;
13456 }
13457 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5angle_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13458 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5angle_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13459   int __pyx_r;
13460   __Pyx_RefNannyDeclarations
13461   float __pyx_t_1;
13462   int __pyx_lineno = 0;
13463   const char *__pyx_filename = NULL;
13464   int __pyx_clineno = 0;
13465   __Pyx_RefNannySetupContext("__set__", 0);
13466   __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 408, __pyx_L1_error)
13467   __pyx_v_self->angle = __pyx_t_1;
13468 
13469   /* function exit code */
13470   __pyx_r = 0;
13471   goto __pyx_L0;
13472   __pyx_L1_error:;
13473   __Pyx_AddTraceback("pygame._sdl2.video.Image.angle.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13474   __pyx_r = -1;
13475   __pyx_L0:;
13476   __Pyx_RefNannyFinishContext();
13477   return __pyx_r;
13478 }
13479 
13480 /* "pygame/_sdl2/video.pxd":411
13481  *     cdef SDL_Point _origin
13482  *     cdef SDL_Point* _originptr
13483  *     cdef public bint flipX             # <<<<<<<<<<<<<<
13484  *     cdef public bint flipY
13485  *     cdef public float alpha
13486  */
13487 
13488 /* Python wrapper */
13489 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_1__get__(PyObject * __pyx_v_self)13490 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_1__get__(PyObject *__pyx_v_self) {
13491   PyObject *__pyx_r = 0;
13492   __Pyx_RefNannyDeclarations
13493   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13494   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13495 
13496   /* function exit code */
13497   __Pyx_RefNannyFinishContext();
13498   return __pyx_r;
13499 }
13500 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13501 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13502   PyObject *__pyx_r = NULL;
13503   __Pyx_RefNannyDeclarations
13504   PyObject *__pyx_t_1 = NULL;
13505   int __pyx_lineno = 0;
13506   const char *__pyx_filename = NULL;
13507   int __pyx_clineno = 0;
13508   __Pyx_RefNannySetupContext("__get__", 0);
13509   __Pyx_XDECREF(__pyx_r);
13510   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->flipX); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 411, __pyx_L1_error)
13511   __Pyx_GOTREF(__pyx_t_1);
13512   __pyx_r = __pyx_t_1;
13513   __pyx_t_1 = 0;
13514   goto __pyx_L0;
13515 
13516   /* function exit code */
13517   __pyx_L1_error:;
13518   __Pyx_XDECREF(__pyx_t_1);
13519   __Pyx_AddTraceback("pygame._sdl2.video.Image.flipX.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13520   __pyx_r = NULL;
13521   __pyx_L0:;
13522   __Pyx_XGIVEREF(__pyx_r);
13523   __Pyx_RefNannyFinishContext();
13524   return __pyx_r;
13525 }
13526 
13527 /* Python wrapper */
13528 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13529 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13530   int __pyx_r;
13531   __Pyx_RefNannyDeclarations
13532   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13533   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13534 
13535   /* function exit code */
13536   __Pyx_RefNannyFinishContext();
13537   return __pyx_r;
13538 }
13539 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13540 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipX_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13541   int __pyx_r;
13542   __Pyx_RefNannyDeclarations
13543   int __pyx_t_1;
13544   int __pyx_lineno = 0;
13545   const char *__pyx_filename = NULL;
13546   int __pyx_clineno = 0;
13547   __Pyx_RefNannySetupContext("__set__", 0);
13548   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 411, __pyx_L1_error)
13549   __pyx_v_self->flipX = __pyx_t_1;
13550 
13551   /* function exit code */
13552   __pyx_r = 0;
13553   goto __pyx_L0;
13554   __pyx_L1_error:;
13555   __Pyx_AddTraceback("pygame._sdl2.video.Image.flipX.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13556   __pyx_r = -1;
13557   __pyx_L0:;
13558   __Pyx_RefNannyFinishContext();
13559   return __pyx_r;
13560 }
13561 
13562 /* "pygame/_sdl2/video.pxd":412
13563  *     cdef SDL_Point* _originptr
13564  *     cdef public bint flipX
13565  *     cdef public bint flipY             # <<<<<<<<<<<<<<
13566  *     cdef public float alpha
13567  *     cdef public SDL_BlendMode blend_mode
13568  */
13569 
13570 /* Python wrapper */
13571 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_1__get__(PyObject * __pyx_v_self)13572 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_1__get__(PyObject *__pyx_v_self) {
13573   PyObject *__pyx_r = 0;
13574   __Pyx_RefNannyDeclarations
13575   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13576   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13577 
13578   /* function exit code */
13579   __Pyx_RefNannyFinishContext();
13580   return __pyx_r;
13581 }
13582 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13583 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13584   PyObject *__pyx_r = NULL;
13585   __Pyx_RefNannyDeclarations
13586   PyObject *__pyx_t_1 = NULL;
13587   int __pyx_lineno = 0;
13588   const char *__pyx_filename = NULL;
13589   int __pyx_clineno = 0;
13590   __Pyx_RefNannySetupContext("__get__", 0);
13591   __Pyx_XDECREF(__pyx_r);
13592   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->flipY); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 412, __pyx_L1_error)
13593   __Pyx_GOTREF(__pyx_t_1);
13594   __pyx_r = __pyx_t_1;
13595   __pyx_t_1 = 0;
13596   goto __pyx_L0;
13597 
13598   /* function exit code */
13599   __pyx_L1_error:;
13600   __Pyx_XDECREF(__pyx_t_1);
13601   __Pyx_AddTraceback("pygame._sdl2.video.Image.flipY.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13602   __pyx_r = NULL;
13603   __pyx_L0:;
13604   __Pyx_XGIVEREF(__pyx_r);
13605   __Pyx_RefNannyFinishContext();
13606   return __pyx_r;
13607 }
13608 
13609 /* Python wrapper */
13610 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13611 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13612   int __pyx_r;
13613   __Pyx_RefNannyDeclarations
13614   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13615   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13616 
13617   /* function exit code */
13618   __Pyx_RefNannyFinishContext();
13619   return __pyx_r;
13620 }
13621 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13622 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5flipY_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13623   int __pyx_r;
13624   __Pyx_RefNannyDeclarations
13625   int __pyx_t_1;
13626   int __pyx_lineno = 0;
13627   const char *__pyx_filename = NULL;
13628   int __pyx_clineno = 0;
13629   __Pyx_RefNannySetupContext("__set__", 0);
13630   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 412, __pyx_L1_error)
13631   __pyx_v_self->flipY = __pyx_t_1;
13632 
13633   /* function exit code */
13634   __pyx_r = 0;
13635   goto __pyx_L0;
13636   __pyx_L1_error:;
13637   __Pyx_AddTraceback("pygame._sdl2.video.Image.flipY.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13638   __pyx_r = -1;
13639   __pyx_L0:;
13640   __Pyx_RefNannyFinishContext();
13641   return __pyx_r;
13642 }
13643 
13644 /* "pygame/_sdl2/video.pxd":413
13645  *     cdef public bint flipX
13646  *     cdef public bint flipY
13647  *     cdef public float alpha             # <<<<<<<<<<<<<<
13648  *     cdef public SDL_BlendMode blend_mode
13649  *
13650  */
13651 
13652 /* Python wrapper */
13653 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_1__get__(PyObject * __pyx_v_self)13654 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_1__get__(PyObject *__pyx_v_self) {
13655   PyObject *__pyx_r = 0;
13656   __Pyx_RefNannyDeclarations
13657   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13658   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13659 
13660   /* function exit code */
13661   __Pyx_RefNannyFinishContext();
13662   return __pyx_r;
13663 }
13664 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13665 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13666   PyObject *__pyx_r = NULL;
13667   __Pyx_RefNannyDeclarations
13668   PyObject *__pyx_t_1 = NULL;
13669   int __pyx_lineno = 0;
13670   const char *__pyx_filename = NULL;
13671   int __pyx_clineno = 0;
13672   __Pyx_RefNannySetupContext("__get__", 0);
13673   __Pyx_XDECREF(__pyx_r);
13674   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 413, __pyx_L1_error)
13675   __Pyx_GOTREF(__pyx_t_1);
13676   __pyx_r = __pyx_t_1;
13677   __pyx_t_1 = 0;
13678   goto __pyx_L0;
13679 
13680   /* function exit code */
13681   __pyx_L1_error:;
13682   __Pyx_XDECREF(__pyx_t_1);
13683   __Pyx_AddTraceback("pygame._sdl2.video.Image.alpha.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13684   __pyx_r = NULL;
13685   __pyx_L0:;
13686   __Pyx_XGIVEREF(__pyx_r);
13687   __Pyx_RefNannyFinishContext();
13688   return __pyx_r;
13689 }
13690 
13691 /* Python wrapper */
13692 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13693 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13694   int __pyx_r;
13695   __Pyx_RefNannyDeclarations
13696   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13697   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13698 
13699   /* function exit code */
13700   __Pyx_RefNannyFinishContext();
13701   return __pyx_r;
13702 }
13703 
__pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13704 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_5alpha_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13705   int __pyx_r;
13706   __Pyx_RefNannyDeclarations
13707   float __pyx_t_1;
13708   int __pyx_lineno = 0;
13709   const char *__pyx_filename = NULL;
13710   int __pyx_clineno = 0;
13711   __Pyx_RefNannySetupContext("__set__", 0);
13712   __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 413, __pyx_L1_error)
13713   __pyx_v_self->alpha = __pyx_t_1;
13714 
13715   /* function exit code */
13716   __pyx_r = 0;
13717   goto __pyx_L0;
13718   __pyx_L1_error:;
13719   __Pyx_AddTraceback("pygame._sdl2.video.Image.alpha.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13720   __pyx_r = -1;
13721   __pyx_L0:;
13722   __Pyx_RefNannyFinishContext();
13723   return __pyx_r;
13724 }
13725 
13726 /* "pygame/_sdl2/video.pxd":414
13727  *     cdef public bint flipY
13728  *     cdef public float alpha
13729  *     cdef public SDL_BlendMode blend_mode             # <<<<<<<<<<<<<<
13730  *
13731  *     cdef public Texture texture
13732  */
13733 
13734 /* Python wrapper */
13735 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_1__get__(PyObject * __pyx_v_self)13736 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_1__get__(PyObject *__pyx_v_self) {
13737   PyObject *__pyx_r = 0;
13738   __Pyx_RefNannyDeclarations
13739   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13740   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13741 
13742   /* function exit code */
13743   __Pyx_RefNannyFinishContext();
13744   return __pyx_r;
13745 }
13746 
__pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13747 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13748   PyObject *__pyx_r = NULL;
13749   __Pyx_RefNannyDeclarations
13750   PyObject *__pyx_t_1 = NULL;
13751   int __pyx_lineno = 0;
13752   const char *__pyx_filename = NULL;
13753   int __pyx_clineno = 0;
13754   __Pyx_RefNannySetupContext("__get__", 0);
13755   __Pyx_XDECREF(__pyx_r);
13756   __pyx_t_1 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_self->blend_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 414, __pyx_L1_error)
13757   __Pyx_GOTREF(__pyx_t_1);
13758   __pyx_r = __pyx_t_1;
13759   __pyx_t_1 = 0;
13760   goto __pyx_L0;
13761 
13762   /* function exit code */
13763   __pyx_L1_error:;
13764   __Pyx_XDECREF(__pyx_t_1);
13765   __Pyx_AddTraceback("pygame._sdl2.video.Image.blend_mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13766   __pyx_r = NULL;
13767   __pyx_L0:;
13768   __Pyx_XGIVEREF(__pyx_r);
13769   __Pyx_RefNannyFinishContext();
13770   return __pyx_r;
13771 }
13772 
13773 /* Python wrapper */
13774 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13775 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13776   int __pyx_r;
13777   __Pyx_RefNannyDeclarations
13778   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13779   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13780 
13781   /* function exit code */
13782   __Pyx_RefNannyFinishContext();
13783   return __pyx_r;
13784 }
13785 
__pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13786 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_10blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13787   int __pyx_r;
13788   __Pyx_RefNannyDeclarations
13789   SDL_BlendMode __pyx_t_1;
13790   int __pyx_lineno = 0;
13791   const char *__pyx_filename = NULL;
13792   int __pyx_clineno = 0;
13793   __Pyx_RefNannySetupContext("__set__", 0);
13794   __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 414, __pyx_L1_error)
13795   __pyx_v_self->blend_mode = __pyx_t_1;
13796 
13797   /* function exit code */
13798   __pyx_r = 0;
13799   goto __pyx_L0;
13800   __pyx_L1_error:;
13801   __Pyx_AddTraceback("pygame._sdl2.video.Image.blend_mode.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13802   __pyx_r = -1;
13803   __pyx_L0:;
13804   __Pyx_RefNannyFinishContext();
13805   return __pyx_r;
13806 }
13807 
13808 /* "pygame/_sdl2/video.pxd":416
13809  *     cdef public SDL_BlendMode blend_mode
13810  *
13811  *     cdef public Texture texture             # <<<<<<<<<<<<<<
13812  *     cdef public Rect srcrect
13813  *
13814  */
13815 
13816 /* Python wrapper */
13817 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_1__get__(PyObject * __pyx_v_self)13818 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_1__get__(PyObject *__pyx_v_self) {
13819   PyObject *__pyx_r = 0;
13820   __Pyx_RefNannyDeclarations
13821   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13822   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13823 
13824   /* function exit code */
13825   __Pyx_RefNannyFinishContext();
13826   return __pyx_r;
13827 }
13828 
__pyx_pf_6pygame_5_sdl2_5video_5Image_7texture___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13829 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_7texture___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13830   PyObject *__pyx_r = NULL;
13831   __Pyx_RefNannyDeclarations
13832   __Pyx_RefNannySetupContext("__get__", 0);
13833   __Pyx_XDECREF(__pyx_r);
13834   __Pyx_INCREF(((PyObject *)__pyx_v_self->texture));
13835   __pyx_r = ((PyObject *)__pyx_v_self->texture);
13836   goto __pyx_L0;
13837 
13838   /* function exit code */
13839   __pyx_L0:;
13840   __Pyx_XGIVEREF(__pyx_r);
13841   __Pyx_RefNannyFinishContext();
13842   return __pyx_r;
13843 }
13844 
13845 /* Python wrapper */
13846 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13847 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13848   int __pyx_r;
13849   __Pyx_RefNannyDeclarations
13850   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13851   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13852 
13853   /* function exit code */
13854   __Pyx_RefNannyFinishContext();
13855   return __pyx_r;
13856 }
13857 
__pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13858 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13859   int __pyx_r;
13860   __Pyx_RefNannyDeclarations
13861   PyObject *__pyx_t_1 = NULL;
13862   int __pyx_lineno = 0;
13863   const char *__pyx_filename = NULL;
13864   int __pyx_clineno = 0;
13865   __Pyx_RefNannySetupContext("__set__", 0);
13866   if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(2, 416, __pyx_L1_error)
13867   __pyx_t_1 = __pyx_v_value;
13868   __Pyx_INCREF(__pyx_t_1);
13869   __Pyx_GIVEREF(__pyx_t_1);
13870   __Pyx_GOTREF(__pyx_v_self->texture);
13871   __Pyx_DECREF(((PyObject *)__pyx_v_self->texture));
13872   __pyx_v_self->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_1);
13873   __pyx_t_1 = 0;
13874 
13875   /* function exit code */
13876   __pyx_r = 0;
13877   goto __pyx_L0;
13878   __pyx_L1_error:;
13879   __Pyx_XDECREF(__pyx_t_1);
13880   __Pyx_AddTraceback("pygame._sdl2.video.Image.texture.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13881   __pyx_r = -1;
13882   __pyx_L0:;
13883   __Pyx_RefNannyFinishContext();
13884   return __pyx_r;
13885 }
13886 
13887 /* Python wrapper */
13888 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_5__del__(PyObject * __pyx_v_self)13889 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_5__del__(PyObject *__pyx_v_self) {
13890   int __pyx_r;
13891   __Pyx_RefNannyDeclarations
13892   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
13893   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_4__del__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13894 
13895   /* function exit code */
13896   __Pyx_RefNannyFinishContext();
13897   return __pyx_r;
13898 }
13899 
__pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13900 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7texture_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13901   int __pyx_r;
13902   __Pyx_RefNannyDeclarations
13903   __Pyx_RefNannySetupContext("__del__", 0);
13904   __Pyx_INCREF(Py_None);
13905   __Pyx_GIVEREF(Py_None);
13906   __Pyx_GOTREF(__pyx_v_self->texture);
13907   __Pyx_DECREF(((PyObject *)__pyx_v_self->texture));
13908   __pyx_v_self->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
13909 
13910   /* function exit code */
13911   __pyx_r = 0;
13912   __Pyx_RefNannyFinishContext();
13913   return __pyx_r;
13914 }
13915 
13916 /* "pygame/_sdl2/video.pxd":417
13917  *
13918  *     cdef public Texture texture
13919  *     cdef public Rect srcrect             # <<<<<<<<<<<<<<
13920  *
13921  *     cpdef void draw(self, srcrect=*, dstrect=*)
13922  */
13923 
13924 /* Python wrapper */
13925 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_1__get__(PyObject * __pyx_v_self)13926 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_1__get__(PyObject *__pyx_v_self) {
13927   PyObject *__pyx_r = 0;
13928   __Pyx_RefNannyDeclarations
13929   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13930   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
13931 
13932   /* function exit code */
13933   __Pyx_RefNannyFinishContext();
13934   return __pyx_r;
13935 }
13936 
__pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)13937 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
13938   PyObject *__pyx_r = NULL;
13939   __Pyx_RefNannyDeclarations
13940   __Pyx_RefNannySetupContext("__get__", 0);
13941   __Pyx_XDECREF(__pyx_r);
13942   __Pyx_INCREF(((PyObject *)__pyx_v_self->srcrect));
13943   __pyx_r = ((PyObject *)__pyx_v_self->srcrect);
13944   goto __pyx_L0;
13945 
13946   /* function exit code */
13947   __pyx_L0:;
13948   __Pyx_XGIVEREF(__pyx_r);
13949   __Pyx_RefNannyFinishContext();
13950   return __pyx_r;
13951 }
13952 
13953 /* Python wrapper */
13954 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)13955 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
13956   int __pyx_r;
13957   __Pyx_RefNannyDeclarations
13958   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
13959   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v_value));
13960 
13961   /* function exit code */
13962   __Pyx_RefNannyFinishContext();
13963   return __pyx_r;
13964 }
13965 
__pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,PyObject * __pyx_v_value)13966 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, PyObject *__pyx_v_value) {
13967   int __pyx_r;
13968   __Pyx_RefNannyDeclarations
13969   PyObject *__pyx_t_1 = NULL;
13970   int __pyx_lineno = 0;
13971   const char *__pyx_filename = NULL;
13972   int __pyx_clineno = 0;
13973   __Pyx_RefNannySetupContext("__set__", 0);
13974   if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6pygame_5_sdl2_5video_Rect))))) __PYX_ERR(2, 417, __pyx_L1_error)
13975   __pyx_t_1 = __pyx_v_value;
13976   __Pyx_INCREF(__pyx_t_1);
13977   __Pyx_GIVEREF(__pyx_t_1);
13978   __Pyx_GOTREF(__pyx_v_self->srcrect);
13979   __Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
13980   __pyx_v_self->srcrect = ((pgRectObject *)__pyx_t_1);
13981   __pyx_t_1 = 0;
13982 
13983   /* function exit code */
13984   __pyx_r = 0;
13985   goto __pyx_L0;
13986   __pyx_L1_error:;
13987   __Pyx_XDECREF(__pyx_t_1);
13988   __Pyx_AddTraceback("pygame._sdl2.video.Image.srcrect.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13989   __pyx_r = -1;
13990   __pyx_L0:;
13991   __Pyx_RefNannyFinishContext();
13992   return __pyx_r;
13993 }
13994 
13995 /* Python wrapper */
13996 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_5__del__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_5__del__(PyObject * __pyx_v_self)13997 static int __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_5__del__(PyObject *__pyx_v_self) {
13998   int __pyx_r;
13999   __Pyx_RefNannyDeclarations
14000   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
14001   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_4__del__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
14002 
14003   /* function exit code */
14004   __Pyx_RefNannyFinishContext();
14005   return __pyx_r;
14006 }
14007 
__pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)14008 static int __pyx_pf_6pygame_5_sdl2_5video_5Image_7srcrect_4__del__(struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
14009   int __pyx_r;
14010   __Pyx_RefNannyDeclarations
14011   __Pyx_RefNannySetupContext("__del__", 0);
14012   __Pyx_INCREF(Py_None);
14013   __Pyx_GIVEREF(Py_None);
14014   __Pyx_GOTREF(__pyx_v_self->srcrect);
14015   __Pyx_DECREF(((PyObject *)__pyx_v_self->srcrect));
14016   __pyx_v_self->srcrect = ((pgRectObject *)Py_None);
14017 
14018   /* function exit code */
14019   __pyx_r = 0;
14020   __Pyx_RefNannyFinishContext();
14021   return __pyx_r;
14022 }
14023 
14024 /* "(tree fragment)":1
14025  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14026  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14027  * def __setstate_cython__(self, __pyx_state):
14028  */
14029 
14030 /* Python wrapper */
14031 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)14032 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14033   PyObject *__pyx_r = 0;
14034   __Pyx_RefNannyDeclarations
14035   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
14036   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_8__reduce_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self));
14037 
14038   /* function exit code */
14039   __Pyx_RefNannyFinishContext();
14040   return __pyx_r;
14041 }
14042 
__pyx_pf_6pygame_5_sdl2_5video_5Image_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self)14043 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self) {
14044   PyObject *__pyx_r = NULL;
14045   __Pyx_RefNannyDeclarations
14046   PyObject *__pyx_t_1 = NULL;
14047   int __pyx_lineno = 0;
14048   const char *__pyx_filename = NULL;
14049   int __pyx_clineno = 0;
14050   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
14051 
14052   /* "(tree fragment)":2
14053  * def __reduce_cython__(self):
14054  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
14055  * def __setstate_cython__(self, __pyx_state):
14056  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14057  */
14058   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
14059   __Pyx_GOTREF(__pyx_t_1);
14060   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14061   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14062   __PYX_ERR(1, 2, __pyx_L1_error)
14063 
14064   /* "(tree fragment)":1
14065  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
14066  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14067  * def __setstate_cython__(self, __pyx_state):
14068  */
14069 
14070   /* function exit code */
14071   __pyx_L1_error:;
14072   __Pyx_XDECREF(__pyx_t_1);
14073   __Pyx_AddTraceback("pygame._sdl2.video.Image.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14074   __pyx_r = NULL;
14075   __Pyx_XGIVEREF(__pyx_r);
14076   __Pyx_RefNannyFinishContext();
14077   return __pyx_r;
14078 }
14079 
14080 /* "(tree fragment)":3
14081  * def __reduce_cython__(self):
14082  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14083  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14084  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14085  */
14086 
14087 /* Python wrapper */
14088 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_5Image_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)14089 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_5Image_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14090   PyObject *__pyx_r = 0;
14091   __Pyx_RefNannyDeclarations
14092   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
14093   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_5Image_10__setstate_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14094 
14095   /* function exit code */
14096   __Pyx_RefNannyFinishContext();
14097   return __pyx_r;
14098 }
14099 
__pyx_pf_6pygame_5_sdl2_5video_5Image_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)14100 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_5Image_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Image *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14101   PyObject *__pyx_r = NULL;
14102   __Pyx_RefNannyDeclarations
14103   PyObject *__pyx_t_1 = NULL;
14104   int __pyx_lineno = 0;
14105   const char *__pyx_filename = NULL;
14106   int __pyx_clineno = 0;
14107   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
14108 
14109   /* "(tree fragment)":4
14110  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14111  * def __setstate_cython__(self, __pyx_state):
14112  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
14113  */
14114   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
14115   __Pyx_GOTREF(__pyx_t_1);
14116   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14117   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14118   __PYX_ERR(1, 4, __pyx_L1_error)
14119 
14120   /* "(tree fragment)":3
14121  * def __reduce_cython__(self):
14122  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14123  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
14124  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14125  */
14126 
14127   /* function exit code */
14128   __pyx_L1_error:;
14129   __Pyx_XDECREF(__pyx_t_1);
14130   __Pyx_AddTraceback("pygame._sdl2.video.Image.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14131   __pyx_r = NULL;
14132   __Pyx_XGIVEREF(__pyx_r);
14133   __Pyx_RefNannyFinishContext();
14134   return __pyx_r;
14135 }
14136 
14137 /* "pygame/_sdl2/video.pyx":925
14138  *
14139  *     @classmethod
14140  *     def from_window(cls, Window window):             # <<<<<<<<<<<<<<
14141  *         cdef Renderer self = cls.__new__(cls)
14142  *         self._win = window
14143  */
14144 
14145 /* Python wrapper */
14146 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_1from_window(PyObject *__pyx_v_cls, PyObject *__pyx_v_window); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_1from_window(PyObject * __pyx_v_cls,PyObject * __pyx_v_window)14147 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_1from_window(PyObject *__pyx_v_cls, PyObject *__pyx_v_window) {
14148   int __pyx_lineno = 0;
14149   const char *__pyx_filename = NULL;
14150   int __pyx_clineno = 0;
14151   PyObject *__pyx_r = 0;
14152   __Pyx_RefNannyDeclarations
14153   __Pyx_RefNannySetupContext("from_window (wrapper)", 0);
14154   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
14155   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(((PyTypeObject*)__pyx_v_cls), ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)__pyx_v_window));
14156 
14157   /* function exit code */
14158   goto __pyx_L0;
14159   __pyx_L1_error:;
14160   __pyx_r = NULL;
14161   __pyx_L0:;
14162   __Pyx_RefNannyFinishContext();
14163   return __pyx_r;
14164 }
14165 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject * __pyx_v_cls,struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_window)14166 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_from_window(PyTypeObject *__pyx_v_cls, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window) {
14167   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self = 0;
14168   Uint8 __pyx_v_defaultColor[4];
14169   PyObject *__pyx_r = NULL;
14170   __Pyx_RefNannyDeclarations
14171   PyObject *__pyx_t_1 = NULL;
14172   int __pyx_t_2;
14173   PyObject *__pyx_t_3 = NULL;
14174   PyObject *__pyx_t_4 = NULL;
14175   int __pyx_t_5;
14176   Uint8 __pyx_t_6[4];
14177   int __pyx_lineno = 0;
14178   const char *__pyx_filename = NULL;
14179   int __pyx_clineno = 0;
14180   __Pyx_RefNannySetupContext("from_window", 0);
14181 
14182   /* "pygame/_sdl2/video.pyx":926
14183  *     @classmethod
14184  *     def from_window(cls, Window window):
14185  *         cdef Renderer self = cls.__new__(cls)             # <<<<<<<<<<<<<<
14186  *         self._win = window
14187  *         if window._is_borrowed:
14188  */
14189   if (unlikely(((PyObject *)__pyx_v_cls) == Py_None)) {
14190     PyErr_SetString(PyExc_TypeError, "object.__new__(X): X is not a type object (NoneType)");
14191     __PYX_ERR(0, 926, __pyx_L1_error)
14192   }
14193   __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_v_cls), __pyx_empty_tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __pyx_L1_error)
14194   __Pyx_GOTREF(__pyx_t_1);
14195   if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video_Renderer)))) __PYX_ERR(0, 926, __pyx_L1_error)
14196   __pyx_v_self = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_t_1);
14197   __pyx_t_1 = 0;
14198 
14199   /* "pygame/_sdl2/video.pyx":927
14200  *     def from_window(cls, Window window):
14201  *         cdef Renderer self = cls.__new__(cls)
14202  *         self._win = window             # <<<<<<<<<<<<<<
14203  *         if window._is_borrowed:
14204  *             self._is_borrowed=1
14205  */
14206   __Pyx_INCREF(((PyObject *)__pyx_v_window));
14207   __Pyx_GIVEREF(((PyObject *)__pyx_v_window));
14208   __Pyx_GOTREF(__pyx_v_self->_win);
14209   __Pyx_DECREF(((PyObject *)__pyx_v_self->_win));
14210   __pyx_v_self->_win = __pyx_v_window;
14211 
14212   /* "pygame/_sdl2/video.pyx":928
14213  *         cdef Renderer self = cls.__new__(cls)
14214  *         self._win = window
14215  *         if window._is_borrowed:             # <<<<<<<<<<<<<<
14216  *             self._is_borrowed=1
14217  *         else:
14218  */
14219   __pyx_t_2 = (__pyx_v_window->_is_borrowed != 0);
14220   if (likely(__pyx_t_2)) {
14221 
14222     /* "pygame/_sdl2/video.pyx":929
14223  *         self._win = window
14224  *         if window._is_borrowed:
14225  *             self._is_borrowed=1             # <<<<<<<<<<<<<<
14226  *         else:
14227  *             raise error()
14228  */
14229     __pyx_v_self->_is_borrowed = 1;
14230 
14231     /* "pygame/_sdl2/video.pyx":928
14232  *         cdef Renderer self = cls.__new__(cls)
14233  *         self._win = window
14234  *         if window._is_borrowed:             # <<<<<<<<<<<<<<
14235  *             self._is_borrowed=1
14236  *         else:
14237  */
14238     goto __pyx_L3;
14239   }
14240 
14241   /* "pygame/_sdl2/video.pyx":931
14242  *             self._is_borrowed=1
14243  *         else:
14244  *             raise error()             # <<<<<<<<<<<<<<
14245  *         if not self._win:
14246  *             raise error()
14247  */
14248   /*else*/ {
14249     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
14250     __Pyx_GOTREF(__pyx_t_3);
14251     __pyx_t_4 = NULL;
14252     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14253       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
14254       if (likely(__pyx_t_4)) {
14255         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14256         __Pyx_INCREF(__pyx_t_4);
14257         __Pyx_INCREF(function);
14258         __Pyx_DECREF_SET(__pyx_t_3, function);
14259       }
14260     }
14261     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
14262     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14263     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error)
14264     __Pyx_GOTREF(__pyx_t_1);
14265     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14266     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14267     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14268     __PYX_ERR(0, 931, __pyx_L1_error)
14269   }
14270   __pyx_L3:;
14271 
14272   /* "pygame/_sdl2/video.pyx":932
14273  *         else:
14274  *             raise error()
14275  *         if not self._win:             # <<<<<<<<<<<<<<
14276  *             raise error()
14277  *
14278  */
14279   __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_win)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 932, __pyx_L1_error)
14280   __pyx_t_5 = ((!__pyx_t_2) != 0);
14281   if (unlikely(__pyx_t_5)) {
14282 
14283     /* "pygame/_sdl2/video.pyx":933
14284  *             raise error()
14285  *         if not self._win:
14286  *             raise error()             # <<<<<<<<<<<<<<
14287  *
14288  *         self._renderer =  SDL_GetRenderer(self._win._win)
14289  */
14290     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error)
14291     __Pyx_GOTREF(__pyx_t_3);
14292     __pyx_t_4 = NULL;
14293     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14294       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
14295       if (likely(__pyx_t_4)) {
14296         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14297         __Pyx_INCREF(__pyx_t_4);
14298         __Pyx_INCREF(function);
14299         __Pyx_DECREF_SET(__pyx_t_3, function);
14300       }
14301     }
14302     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
14303     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14304     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error)
14305     __Pyx_GOTREF(__pyx_t_1);
14306     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14307     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14308     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14309     __PYX_ERR(0, 933, __pyx_L1_error)
14310 
14311     /* "pygame/_sdl2/video.pyx":932
14312  *         else:
14313  *             raise error()
14314  *         if not self._win:             # <<<<<<<<<<<<<<
14315  *             raise error()
14316  *
14317  */
14318   }
14319 
14320   /* "pygame/_sdl2/video.pyx":935
14321  *             raise error()
14322  *
14323  *         self._renderer =  SDL_GetRenderer(self._win._win)             # <<<<<<<<<<<<<<
14324  *         if not self._renderer:
14325  *             raise error()
14326  */
14327   __pyx_v_self->_renderer = SDL_GetRenderer(__pyx_v_self->_win->_win);
14328 
14329   /* "pygame/_sdl2/video.pyx":936
14330  *
14331  *         self._renderer =  SDL_GetRenderer(self._win._win)
14332  *         if not self._renderer:             # <<<<<<<<<<<<<<
14333  *             raise error()
14334  *
14335  */
14336   __pyx_t_5 = ((!(__pyx_v_self->_renderer != 0)) != 0);
14337   if (unlikely(__pyx_t_5)) {
14338 
14339     /* "pygame/_sdl2/video.pyx":937
14340  *         self._renderer =  SDL_GetRenderer(self._win._win)
14341  *         if not self._renderer:
14342  *             raise error()             # <<<<<<<<<<<<<<
14343  *
14344  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
14345  */
14346     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
14347     __Pyx_GOTREF(__pyx_t_3);
14348     __pyx_t_4 = NULL;
14349     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14350       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
14351       if (likely(__pyx_t_4)) {
14352         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14353         __Pyx_INCREF(__pyx_t_4);
14354         __Pyx_INCREF(function);
14355         __Pyx_DECREF_SET(__pyx_t_3, function);
14356       }
14357     }
14358     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
14359     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14360     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error)
14361     __Pyx_GOTREF(__pyx_t_1);
14362     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14363     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14364     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14365     __PYX_ERR(0, 937, __pyx_L1_error)
14366 
14367     /* "pygame/_sdl2/video.pyx":936
14368  *
14369  *         self._renderer =  SDL_GetRenderer(self._win._win)
14370  *         if not self._renderer:             # <<<<<<<<<<<<<<
14371  *             raise error()
14372  *
14373  */
14374   }
14375 
14376   /* "pygame/_sdl2/video.pyx":939
14377  *             raise error()
14378  *
14379  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]             # <<<<<<<<<<<<<<
14380  *         self._draw_color = pgColor_NewLength(defaultColor, 4)
14381  *         self._target = None
14382  */
14383   __pyx_t_6[0] = 0xFF;
14384   __pyx_t_6[1] = 0xFF;
14385   __pyx_t_6[2] = 0xFF;
14386   __pyx_t_6[3] = 0xFF;
14387   memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_6, sizeof(__pyx_v_defaultColor[0]) * (4));
14388 
14389   /* "pygame/_sdl2/video.pyx":940
14390  *
14391  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
14392  *         self._draw_color = pgColor_NewLength(defaultColor, 4)             # <<<<<<<<<<<<<<
14393  *         self._target = None
14394  *         return self
14395  */
14396   __pyx_t_1 = pgColor_NewLength(__pyx_v_defaultColor, 4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
14397   __Pyx_GOTREF(__pyx_t_1);
14398   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 940, __pyx_L1_error)
14399   __Pyx_GIVEREF(__pyx_t_1);
14400   __Pyx_GOTREF(__pyx_v_self->_draw_color);
14401   __Pyx_DECREF(((PyObject *)__pyx_v_self->_draw_color));
14402   __pyx_v_self->_draw_color = ((pgColorObject *)__pyx_t_1);
14403   __pyx_t_1 = 0;
14404 
14405   /* "pygame/_sdl2/video.pyx":941
14406  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
14407  *         self._draw_color = pgColor_NewLength(defaultColor, 4)
14408  *         self._target = None             # <<<<<<<<<<<<<<
14409  *         return self
14410  *
14411  */
14412   __Pyx_INCREF(Py_None);
14413   __Pyx_GIVEREF(Py_None);
14414   __Pyx_GOTREF(__pyx_v_self->_target);
14415   __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
14416   __pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
14417 
14418   /* "pygame/_sdl2/video.pyx":942
14419  *         self._draw_color = pgColor_NewLength(defaultColor, 4)
14420  *         self._target = None
14421  *         return self             # <<<<<<<<<<<<<<
14422  *
14423  *     def __init__(self, Window window, int index=-1,
14424  */
14425   __Pyx_XDECREF(__pyx_r);
14426   __Pyx_INCREF(((PyObject *)__pyx_v_self));
14427   __pyx_r = ((PyObject *)__pyx_v_self);
14428   goto __pyx_L0;
14429 
14430   /* "pygame/_sdl2/video.pyx":925
14431  *
14432  *     @classmethod
14433  *     def from_window(cls, Window window):             # <<<<<<<<<<<<<<
14434  *         cdef Renderer self = cls.__new__(cls)
14435  *         self._win = window
14436  */
14437 
14438   /* function exit code */
14439   __pyx_L1_error:;
14440   __Pyx_XDECREF(__pyx_t_1);
14441   __Pyx_XDECREF(__pyx_t_3);
14442   __Pyx_XDECREF(__pyx_t_4);
14443   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.from_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
14444   __pyx_r = NULL;
14445   __pyx_L0:;
14446   __Pyx_XDECREF((PyObject *)__pyx_v_self);
14447   __Pyx_XGIVEREF(__pyx_r);
14448   __Pyx_RefNannyFinishContext();
14449   return __pyx_r;
14450 }
14451 
14452 /* "pygame/_sdl2/video.pyx":944
14453  *         return self
14454  *
14455  *     def __init__(self, Window window, int index=-1,             # <<<<<<<<<<<<<<
14456  *                  int accelerated=-1, bint vsync=False,
14457  *                  bint target_texture=False):
14458  */
14459 
14460 /* Python wrapper */
14461 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14462 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_2__init__[] = " Create a 2D rendering context for a window.\n\n        :param Window window: where rendering is displayed.\n        :param int index: index of rendering driver to initialize,\n                          or -1 to init the first supporting requested options.\n        :param int accelerated: if 1, the renderer uses hardware acceleration.\n                                if 0, the renderer is a software fallback.\n                                -1 gives precedence to renderers using hardware acceleration.\n        :param bool vsync: .present() is synchronized with the refresh rate.\n        :param bool target_texture: the renderer supports rendering to texture.\n        ";
14463 #if CYTHON_COMPILING_IN_CPYTHON
14464 struct wrapperbase __pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__;
14465 #endif
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)14466 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14467   struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window = 0;
14468   int __pyx_v_index;
14469   int __pyx_v_accelerated;
14470   int __pyx_v_vsync;
14471   int __pyx_v_target_texture;
14472   int __pyx_lineno = 0;
14473   const char *__pyx_filename = NULL;
14474   int __pyx_clineno = 0;
14475   int __pyx_r;
14476   __Pyx_RefNannyDeclarations
14477   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
14478   {
14479     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_window,&__pyx_n_s_index,&__pyx_n_s_accelerated,&__pyx_n_s_vsync,&__pyx_n_s_target_texture,0};
14480     PyObject* values[5] = {0,0,0,0,0};
14481     if (unlikely(__pyx_kwds)) {
14482       Py_ssize_t kw_args;
14483       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14484       switch (pos_args) {
14485         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
14486         CYTHON_FALLTHROUGH;
14487         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14488         CYTHON_FALLTHROUGH;
14489         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14490         CYTHON_FALLTHROUGH;
14491         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14492         CYTHON_FALLTHROUGH;
14493         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14494         CYTHON_FALLTHROUGH;
14495         case  0: break;
14496         default: goto __pyx_L5_argtuple_error;
14497       }
14498       kw_args = PyDict_Size(__pyx_kwds);
14499       switch (pos_args) {
14500         case  0:
14501         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window)) != 0)) kw_args--;
14502         else goto __pyx_L5_argtuple_error;
14503         CYTHON_FALLTHROUGH;
14504         case  1:
14505         if (kw_args > 0) {
14506           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index);
14507           if (value) { values[1] = value; kw_args--; }
14508         }
14509         CYTHON_FALLTHROUGH;
14510         case  2:
14511         if (kw_args > 0) {
14512           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_accelerated);
14513           if (value) { values[2] = value; kw_args--; }
14514         }
14515         CYTHON_FALLTHROUGH;
14516         case  3:
14517         if (kw_args > 0) {
14518           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vsync);
14519           if (value) { values[3] = value; kw_args--; }
14520         }
14521         CYTHON_FALLTHROUGH;
14522         case  4:
14523         if (kw_args > 0) {
14524           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target_texture);
14525           if (value) { values[4] = value; kw_args--; }
14526         }
14527       }
14528       if (unlikely(kw_args > 0)) {
14529         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 944, __pyx_L3_error)
14530       }
14531     } else {
14532       switch (PyTuple_GET_SIZE(__pyx_args)) {
14533         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
14534         CYTHON_FALLTHROUGH;
14535         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14536         CYTHON_FALLTHROUGH;
14537         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14538         CYTHON_FALLTHROUGH;
14539         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14540         CYTHON_FALLTHROUGH;
14541         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14542         break;
14543         default: goto __pyx_L5_argtuple_error;
14544       }
14545     }
14546     __pyx_v_window = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)values[0]);
14547     if (values[1]) {
14548       __pyx_v_index = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error)
14549     } else {
14550       __pyx_v_index = ((int)-1);
14551     }
14552     if (values[2]) {
14553       __pyx_v_accelerated = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_accelerated == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
14554     } else {
14555       __pyx_v_accelerated = ((int)-1);
14556     }
14557     if (values[3]) {
14558       __pyx_v_vsync = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_vsync == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
14559     } else {
14560 
14561       /* "pygame/_sdl2/video.pyx":945
14562  *
14563  *     def __init__(self, Window window, int index=-1,
14564  *                  int accelerated=-1, bint vsync=False,             # <<<<<<<<<<<<<<
14565  *                  bint target_texture=False):
14566  *         """ Create a 2D rendering context for a window.
14567  */
14568       __pyx_v_vsync = ((int)0);
14569     }
14570     if (values[4]) {
14571       __pyx_v_target_texture = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_target_texture == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 946, __pyx_L3_error)
14572     } else {
14573 
14574       /* "pygame/_sdl2/video.pyx":946
14575  *     def __init__(self, Window window, int index=-1,
14576  *                  int accelerated=-1, bint vsync=False,
14577  *                  bint target_texture=False):             # <<<<<<<<<<<<<<
14578  *         """ Create a 2D rendering context for a window.
14579  *
14580  */
14581       __pyx_v_target_texture = ((int)0);
14582     }
14583   }
14584   goto __pyx_L4_argument_unpacking_done;
14585   __pyx_L5_argtuple_error:;
14586   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 944, __pyx_L3_error)
14587   __pyx_L3_error:;
14588   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14589   __Pyx_RefNannyFinishContext();
14590   return -1;
14591   __pyx_L4_argument_unpacking_done:;
14592   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_6pygame_5_sdl2_5video_Window, 1, "window", 0))) __PYX_ERR(0, 944, __pyx_L1_error)
14593   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), __pyx_v_window, __pyx_v_index, __pyx_v_accelerated, __pyx_v_vsync, __pyx_v_target_texture);
14594 
14595   /* "pygame/_sdl2/video.pyx":944
14596  *         return self
14597  *
14598  *     def __init__(self, Window window, int index=-1,             # <<<<<<<<<<<<<<
14599  *                  int accelerated=-1, bint vsync=False,
14600  *                  bint target_texture=False):
14601  */
14602 
14603   /* function exit code */
14604   goto __pyx_L0;
14605   __pyx_L1_error:;
14606   __pyx_r = -1;
14607   __pyx_L0:;
14608   __Pyx_RefNannyFinishContext();
14609   return __pyx_r;
14610 }
14611 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,struct __pyx_obj_6pygame_5_sdl2_5video_Window * __pyx_v_window,int __pyx_v_index,int __pyx_v_accelerated,int __pyx_v_vsync,int __pyx_v_target_texture)14612 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_2__init__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, struct __pyx_obj_6pygame_5_sdl2_5video_Window *__pyx_v_window, int __pyx_v_index, int __pyx_v_accelerated, int __pyx_v_vsync, int __pyx_v_target_texture) {
14613   PyObject *__pyx_v_flags = NULL;
14614   Uint8 __pyx_v_defaultColor[4];
14615   int __pyx_r;
14616   __Pyx_RefNannyDeclarations
14617   int __pyx_t_1;
14618   PyObject *__pyx_t_2 = NULL;
14619   PyObject *__pyx_t_3 = NULL;
14620   Uint32 __pyx_t_4;
14621   PyObject *__pyx_t_5 = NULL;
14622   Uint8 __pyx_t_6[4];
14623   int __pyx_lineno = 0;
14624   const char *__pyx_filename = NULL;
14625   int __pyx_clineno = 0;
14626   __Pyx_RefNannySetupContext("__init__", 0);
14627 
14628   /* "pygame/_sdl2/video.pyx":960
14629  *         # https://wiki.libsdl.org/SDL_CreateRenderer
14630  *         # https://wiki.libsdl.org/SDL_RendererFlags
14631  *         flags = 0             # <<<<<<<<<<<<<<
14632  *         if accelerated >= 0:
14633  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
14634  */
14635   __Pyx_INCREF(__pyx_int_0);
14636   __pyx_v_flags = __pyx_int_0;
14637 
14638   /* "pygame/_sdl2/video.pyx":961
14639  *         # https://wiki.libsdl.org/SDL_RendererFlags
14640  *         flags = 0
14641  *         if accelerated >= 0:             # <<<<<<<<<<<<<<
14642  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
14643  *         if vsync:
14644  */
14645   __pyx_t_1 = ((__pyx_v_accelerated >= 0) != 0);
14646   if (__pyx_t_1) {
14647 
14648     /* "pygame/_sdl2/video.pyx":962
14649  *         flags = 0
14650  *         if accelerated >= 0:
14651  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE             # <<<<<<<<<<<<<<
14652  *         if vsync:
14653  *             flags |= _SDL_RENDERER_PRESENTVSYNC
14654  */
14655     if ((__pyx_v_accelerated != 0)) {
14656       __pyx_t_3 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_ACCELERATED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error)
14657       __Pyx_GOTREF(__pyx_t_3);
14658       __pyx_t_2 = __pyx_t_3;
14659       __pyx_t_3 = 0;
14660     } else {
14661       __pyx_t_3 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_SOFTWARE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error)
14662       __Pyx_GOTREF(__pyx_t_3);
14663       __pyx_t_2 = __pyx_t_3;
14664       __pyx_t_3 = 0;
14665     }
14666     __pyx_t_3 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error)
14667     __Pyx_GOTREF(__pyx_t_3);
14668     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14669     __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_3);
14670     __pyx_t_3 = 0;
14671 
14672     /* "pygame/_sdl2/video.pyx":961
14673  *         # https://wiki.libsdl.org/SDL_RendererFlags
14674  *         flags = 0
14675  *         if accelerated >= 0:             # <<<<<<<<<<<<<<
14676  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
14677  *         if vsync:
14678  */
14679   }
14680 
14681   /* "pygame/_sdl2/video.pyx":963
14682  *         if accelerated >= 0:
14683  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
14684  *         if vsync:             # <<<<<<<<<<<<<<
14685  *             flags |= _SDL_RENDERER_PRESENTVSYNC
14686  *         if target_texture:
14687  */
14688   __pyx_t_1 = (__pyx_v_vsync != 0);
14689   if (__pyx_t_1) {
14690 
14691     /* "pygame/_sdl2/video.pyx":964
14692  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
14693  *         if vsync:
14694  *             flags |= _SDL_RENDERER_PRESENTVSYNC             # <<<<<<<<<<<<<<
14695  *         if target_texture:
14696  *             flags |= _SDL_RENDERER_TARGETTEXTURE
14697  */
14698     __pyx_t_3 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_PRESENTVSYNC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 964, __pyx_L1_error)
14699     __Pyx_GOTREF(__pyx_t_3);
14700     __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
14701     __Pyx_GOTREF(__pyx_t_2);
14702     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14703     __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_2);
14704     __pyx_t_2 = 0;
14705 
14706     /* "pygame/_sdl2/video.pyx":963
14707  *         if accelerated >= 0:
14708  *             flags |= _SDL_RENDERER_ACCELERATED if accelerated else _SDL_RENDERER_SOFTWARE
14709  *         if vsync:             # <<<<<<<<<<<<<<
14710  *             flags |= _SDL_RENDERER_PRESENTVSYNC
14711  *         if target_texture:
14712  */
14713   }
14714 
14715   /* "pygame/_sdl2/video.pyx":965
14716  *         if vsync:
14717  *             flags |= _SDL_RENDERER_PRESENTVSYNC
14718  *         if target_texture:             # <<<<<<<<<<<<<<
14719  *             flags |= _SDL_RENDERER_TARGETTEXTURE
14720  *
14721  */
14722   __pyx_t_1 = (__pyx_v_target_texture != 0);
14723   if (__pyx_t_1) {
14724 
14725     /* "pygame/_sdl2/video.pyx":966
14726  *             flags |= _SDL_RENDERER_PRESENTVSYNC
14727  *         if target_texture:
14728  *             flags |= _SDL_RENDERER_TARGETTEXTURE             # <<<<<<<<<<<<<<
14729  *
14730  *         self._renderer = SDL_CreateRenderer(window._win, index, flags)
14731  */
14732     __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_RENDERER_TARGETTEXTURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
14733     __Pyx_GOTREF(__pyx_t_2);
14734     __pyx_t_3 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error)
14735     __Pyx_GOTREF(__pyx_t_3);
14736     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14737     __Pyx_DECREF_SET(__pyx_v_flags, __pyx_t_3);
14738     __pyx_t_3 = 0;
14739 
14740     /* "pygame/_sdl2/video.pyx":965
14741  *         if vsync:
14742  *             flags |= _SDL_RENDERER_PRESENTVSYNC
14743  *         if target_texture:             # <<<<<<<<<<<<<<
14744  *             flags |= _SDL_RENDERER_TARGETTEXTURE
14745  *
14746  */
14747   }
14748 
14749   /* "pygame/_sdl2/video.pyx":968
14750  *             flags |= _SDL_RENDERER_TARGETTEXTURE
14751  *
14752  *         self._renderer = SDL_CreateRenderer(window._win, index, flags)             # <<<<<<<<<<<<<<
14753  *         if not self._renderer:
14754  *             raise error()
14755  */
14756   __pyx_t_4 = __Pyx_PyInt_As_Uint32(__pyx_v_flags); if (unlikely((__pyx_t_4 == ((Uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 968, __pyx_L1_error)
14757   __pyx_v_self->_renderer = SDL_CreateRenderer(__pyx_v_window->_win, __pyx_v_index, __pyx_t_4);
14758 
14759   /* "pygame/_sdl2/video.pyx":969
14760  *
14761  *         self._renderer = SDL_CreateRenderer(window._win, index, flags)
14762  *         if not self._renderer:             # <<<<<<<<<<<<<<
14763  *             raise error()
14764  *
14765  */
14766   __pyx_t_1 = ((!(__pyx_v_self->_renderer != 0)) != 0);
14767   if (unlikely(__pyx_t_1)) {
14768 
14769     /* "pygame/_sdl2/video.pyx":970
14770  *         self._renderer = SDL_CreateRenderer(window._win, index, flags)
14771  *         if not self._renderer:
14772  *             raise error()             # <<<<<<<<<<<<<<
14773  *
14774  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
14775  */
14776     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
14777     __Pyx_GOTREF(__pyx_t_2);
14778     __pyx_t_5 = NULL;
14779     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
14780       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
14781       if (likely(__pyx_t_5)) {
14782         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
14783         __Pyx_INCREF(__pyx_t_5);
14784         __Pyx_INCREF(function);
14785         __Pyx_DECREF_SET(__pyx_t_2, function);
14786       }
14787     }
14788     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
14789     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14790     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 970, __pyx_L1_error)
14791     __Pyx_GOTREF(__pyx_t_3);
14792     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14793     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14794     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14795     __PYX_ERR(0, 970, __pyx_L1_error)
14796 
14797     /* "pygame/_sdl2/video.pyx":969
14798  *
14799  *         self._renderer = SDL_CreateRenderer(window._win, index, flags)
14800  *         if not self._renderer:             # <<<<<<<<<<<<<<
14801  *             raise error()
14802  *
14803  */
14804   }
14805 
14806   /* "pygame/_sdl2/video.pyx":972
14807  *             raise error()
14808  *
14809  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]             # <<<<<<<<<<<<<<
14810  *         self._draw_color = pgColor_NewLength(defaultColor, 4)
14811  *         self._target = None
14812  */
14813   __pyx_t_6[0] = 0xFF;
14814   __pyx_t_6[1] = 0xFF;
14815   __pyx_t_6[2] = 0xFF;
14816   __pyx_t_6[3] = 0xFF;
14817   memcpy(&(__pyx_v_defaultColor[0]), __pyx_t_6, sizeof(__pyx_v_defaultColor[0]) * (4));
14818 
14819   /* "pygame/_sdl2/video.pyx":973
14820  *
14821  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
14822  *         self._draw_color = pgColor_NewLength(defaultColor, 4)             # <<<<<<<<<<<<<<
14823  *         self._target = None
14824  *         self._win = window
14825  */
14826   __pyx_t_3 = pgColor_NewLength(__pyx_v_defaultColor, 4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 973, __pyx_L1_error)
14827   __Pyx_GOTREF(__pyx_t_3);
14828   if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pygame_5_sdl2_5video_Color))))) __PYX_ERR(0, 973, __pyx_L1_error)
14829   __Pyx_GIVEREF(__pyx_t_3);
14830   __Pyx_GOTREF(__pyx_v_self->_draw_color);
14831   __Pyx_DECREF(((PyObject *)__pyx_v_self->_draw_color));
14832   __pyx_v_self->_draw_color = ((pgColorObject *)__pyx_t_3);
14833   __pyx_t_3 = 0;
14834 
14835   /* "pygame/_sdl2/video.pyx":974
14836  *         cdef Uint8[4] defaultColor = [255, 255, 255, 255]
14837  *         self._draw_color = pgColor_NewLength(defaultColor, 4)
14838  *         self._target = None             # <<<<<<<<<<<<<<
14839  *         self._win = window
14840  *         self._is_borrowed=0
14841  */
14842   __Pyx_INCREF(Py_None);
14843   __Pyx_GIVEREF(Py_None);
14844   __Pyx_GOTREF(__pyx_v_self->_target);
14845   __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
14846   __pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
14847 
14848   /* "pygame/_sdl2/video.pyx":975
14849  *         self._draw_color = pgColor_NewLength(defaultColor, 4)
14850  *         self._target = None
14851  *         self._win = window             # <<<<<<<<<<<<<<
14852  *         self._is_borrowed=0
14853  *
14854  */
14855   __Pyx_INCREF(((PyObject *)__pyx_v_window));
14856   __Pyx_GIVEREF(((PyObject *)__pyx_v_window));
14857   __Pyx_GOTREF(__pyx_v_self->_win);
14858   __Pyx_DECREF(((PyObject *)__pyx_v_self->_win));
14859   __pyx_v_self->_win = __pyx_v_window;
14860 
14861   /* "pygame/_sdl2/video.pyx":976
14862  *         self._target = None
14863  *         self._win = window
14864  *         self._is_borrowed=0             # <<<<<<<<<<<<<<
14865  *
14866  *     def __dealloc__(self):
14867  */
14868   __pyx_v_self->_is_borrowed = 0;
14869 
14870   /* "pygame/_sdl2/video.pyx":944
14871  *         return self
14872  *
14873  *     def __init__(self, Window window, int index=-1,             # <<<<<<<<<<<<<<
14874  *                  int accelerated=-1, bint vsync=False,
14875  *                  bint target_texture=False):
14876  */
14877 
14878   /* function exit code */
14879   __pyx_r = 0;
14880   goto __pyx_L0;
14881   __pyx_L1_error:;
14882   __Pyx_XDECREF(__pyx_t_2);
14883   __Pyx_XDECREF(__pyx_t_3);
14884   __Pyx_XDECREF(__pyx_t_5);
14885   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14886   __pyx_r = -1;
14887   __pyx_L0:;
14888   __Pyx_XDECREF(__pyx_v_flags);
14889   __Pyx_RefNannyFinishContext();
14890   return __pyx_r;
14891 }
14892 
14893 /* "pygame/_sdl2/video.pyx":978
14894  *         self._is_borrowed=0
14895  *
14896  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
14897  *         if self._is_borrowed:
14898  *             return
14899  */
14900 
14901 /* Python wrapper */
14902 static void __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_5__dealloc__(PyObject * __pyx_v_self)14903 static void __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5__dealloc__(PyObject *__pyx_v_self) {
14904   __Pyx_RefNannyDeclarations
14905   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
14906   __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
14907 
14908   /* function exit code */
14909   __Pyx_RefNannyFinishContext();
14910 }
14911 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)14912 static void __pyx_pf_6pygame_5_sdl2_5video_8Renderer_4__dealloc__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
14913   __Pyx_RefNannyDeclarations
14914   int __pyx_t_1;
14915   __Pyx_RefNannySetupContext("__dealloc__", 0);
14916 
14917   /* "pygame/_sdl2/video.pyx":979
14918  *
14919  *     def __dealloc__(self):
14920  *         if self._is_borrowed:             # <<<<<<<<<<<<<<
14921  *             return
14922  *         if self._renderer:
14923  */
14924   __pyx_t_1 = (__pyx_v_self->_is_borrowed != 0);
14925   if (__pyx_t_1) {
14926 
14927     /* "pygame/_sdl2/video.pyx":980
14928  *     def __dealloc__(self):
14929  *         if self._is_borrowed:
14930  *             return             # <<<<<<<<<<<<<<
14931  *         if self._renderer:
14932  *             SDL_DestroyRenderer(self._renderer)
14933  */
14934     goto __pyx_L0;
14935 
14936     /* "pygame/_sdl2/video.pyx":979
14937  *
14938  *     def __dealloc__(self):
14939  *         if self._is_borrowed:             # <<<<<<<<<<<<<<
14940  *             return
14941  *         if self._renderer:
14942  */
14943   }
14944 
14945   /* "pygame/_sdl2/video.pyx":981
14946  *         if self._is_borrowed:
14947  *             return
14948  *         if self._renderer:             # <<<<<<<<<<<<<<
14949  *             SDL_DestroyRenderer(self._renderer)
14950  *
14951  */
14952   __pyx_t_1 = (__pyx_v_self->_renderer != 0);
14953   if (__pyx_t_1) {
14954 
14955     /* "pygame/_sdl2/video.pyx":982
14956  *             return
14957  *         if self._renderer:
14958  *             SDL_DestroyRenderer(self._renderer)             # <<<<<<<<<<<<<<
14959  *
14960  *     @property
14961  */
14962     SDL_DestroyRenderer(__pyx_v_self->_renderer);
14963 
14964     /* "pygame/_sdl2/video.pyx":981
14965  *         if self._is_borrowed:
14966  *             return
14967  *         if self._renderer:             # <<<<<<<<<<<<<<
14968  *             SDL_DestroyRenderer(self._renderer)
14969  *
14970  */
14971   }
14972 
14973   /* "pygame/_sdl2/video.pyx":978
14974  *         self._is_borrowed=0
14975  *
14976  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
14977  *         if self._is_borrowed:
14978  *             return
14979  */
14980 
14981   /* function exit code */
14982   __pyx_L0:;
14983   __Pyx_RefNannyFinishContext();
14984 }
14985 
14986 /* "pygame/_sdl2/video.pyx":985
14987  *
14988  *     @property
14989  *     def draw_blend_mode(self):             # <<<<<<<<<<<<<<
14990  *         # https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
14991  *         cdef SDL_BlendMode blendMode
14992  */
14993 
14994 /* Python wrapper */
14995 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_1__get__(PyObject * __pyx_v_self)14996 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_1__get__(PyObject *__pyx_v_self) {
14997   PyObject *__pyx_r = 0;
14998   __Pyx_RefNannyDeclarations
14999   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15000   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
15001 
15002   /* function exit code */
15003   __Pyx_RefNannyFinishContext();
15004   return __pyx_r;
15005 }
15006 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)15007 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
15008   SDL_BlendMode __pyx_v_blendMode;
15009   int __pyx_v_res;
15010   PyObject *__pyx_r = NULL;
15011   __Pyx_RefNannyDeclarations
15012   int __pyx_t_1;
15013   PyObject *__pyx_t_2 = NULL;
15014   PyObject *__pyx_t_3 = NULL;
15015   PyObject *__pyx_t_4 = NULL;
15016   int __pyx_lineno = 0;
15017   const char *__pyx_filename = NULL;
15018   int __pyx_clineno = 0;
15019   __Pyx_RefNannySetupContext("__get__", 0);
15020 
15021   /* "pygame/_sdl2/video.pyx":988
15022  *         # https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
15023  *         cdef SDL_BlendMode blendMode
15024  *         res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)             # <<<<<<<<<<<<<<
15025  *         if res < 0:
15026  *             raise error()
15027  */
15028   __pyx_v_res = SDL_GetRenderDrawBlendMode(__pyx_v_self->_renderer, (&__pyx_v_blendMode));
15029 
15030   /* "pygame/_sdl2/video.pyx":989
15031  *         cdef SDL_BlendMode blendMode
15032  *         res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
15033  *         if res < 0:             # <<<<<<<<<<<<<<
15034  *             raise error()
15035  *
15036  */
15037   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
15038   if (unlikely(__pyx_t_1)) {
15039 
15040     /* "pygame/_sdl2/video.pyx":990
15041  *         res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
15042  *         if res < 0:
15043  *             raise error()             # <<<<<<<<<<<<<<
15044  *
15045  *         return blendMode
15046  */
15047     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error)
15048     __Pyx_GOTREF(__pyx_t_3);
15049     __pyx_t_4 = NULL;
15050     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15051       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15052       if (likely(__pyx_t_4)) {
15053         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15054         __Pyx_INCREF(__pyx_t_4);
15055         __Pyx_INCREF(function);
15056         __Pyx_DECREF_SET(__pyx_t_3, function);
15057       }
15058     }
15059     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
15060     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15061     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
15062     __Pyx_GOTREF(__pyx_t_2);
15063     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15064     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15065     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15066     __PYX_ERR(0, 990, __pyx_L1_error)
15067 
15068     /* "pygame/_sdl2/video.pyx":989
15069  *         cdef SDL_BlendMode blendMode
15070  *         res = SDL_GetRenderDrawBlendMode(self._renderer, &blendMode)
15071  *         if res < 0:             # <<<<<<<<<<<<<<
15072  *             raise error()
15073  *
15074  */
15075   }
15076 
15077   /* "pygame/_sdl2/video.pyx":992
15078  *             raise error()
15079  *
15080  *         return blendMode             # <<<<<<<<<<<<<<
15081  *
15082  *     @draw_blend_mode.setter
15083  */
15084   __Pyx_XDECREF(__pyx_r);
15085   __pyx_t_2 = __Pyx_PyInt_From_SDL_BlendMode(__pyx_v_blendMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 992, __pyx_L1_error)
15086   __Pyx_GOTREF(__pyx_t_2);
15087   __pyx_r = __pyx_t_2;
15088   __pyx_t_2 = 0;
15089   goto __pyx_L0;
15090 
15091   /* "pygame/_sdl2/video.pyx":985
15092  *
15093  *     @property
15094  *     def draw_blend_mode(self):             # <<<<<<<<<<<<<<
15095  *         # https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode
15096  *         cdef SDL_BlendMode blendMode
15097  */
15098 
15099   /* function exit code */
15100   __pyx_L1_error:;
15101   __Pyx_XDECREF(__pyx_t_2);
15102   __Pyx_XDECREF(__pyx_t_3);
15103   __Pyx_XDECREF(__pyx_t_4);
15104   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_blend_mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15105   __pyx_r = NULL;
15106   __pyx_L0:;
15107   __Pyx_XGIVEREF(__pyx_r);
15108   __Pyx_RefNannyFinishContext();
15109   return __pyx_r;
15110 }
15111 
15112 /* "pygame/_sdl2/video.pyx":995
15113  *
15114  *     @draw_blend_mode.setter
15115  *     def draw_blend_mode(self, blendMode):             # <<<<<<<<<<<<<<
15116  *         # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
15117  *         res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
15118  */
15119 
15120 /* Python wrapper */
15121 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_blendMode); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_blendMode)15122 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_blendMode) {
15123   int __pyx_r;
15124   __Pyx_RefNannyDeclarations
15125   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
15126   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_blendMode));
15127 
15128   /* function exit code */
15129   __Pyx_RefNannyFinishContext();
15130   return __pyx_r;
15131 }
15132 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_blendMode)15133 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_blendMode) {
15134   int __pyx_v_res;
15135   int __pyx_r;
15136   __Pyx_RefNannyDeclarations
15137   SDL_BlendMode __pyx_t_1;
15138   int __pyx_t_2;
15139   PyObject *__pyx_t_3 = NULL;
15140   PyObject *__pyx_t_4 = NULL;
15141   PyObject *__pyx_t_5 = NULL;
15142   int __pyx_lineno = 0;
15143   const char *__pyx_filename = NULL;
15144   int __pyx_clineno = 0;
15145   __Pyx_RefNannySetupContext("__set__", 0);
15146 
15147   /* "pygame/_sdl2/video.pyx":997
15148  *     def draw_blend_mode(self, blendMode):
15149  *         # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
15150  *         res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)             # <<<<<<<<<<<<<<
15151  *         if res < 0:
15152  *             raise error()
15153  */
15154   __pyx_t_1 = ((SDL_BlendMode)__Pyx_PyInt_As_SDL_BlendMode(__pyx_v_blendMode)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L1_error)
15155   __pyx_v_res = SDL_SetRenderDrawBlendMode(__pyx_v_self->_renderer, __pyx_t_1);
15156 
15157   /* "pygame/_sdl2/video.pyx":998
15158  *         # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
15159  *         res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
15160  *         if res < 0:             # <<<<<<<<<<<<<<
15161  *             raise error()
15162  *
15163  */
15164   __pyx_t_2 = ((__pyx_v_res < 0) != 0);
15165   if (unlikely(__pyx_t_2)) {
15166 
15167     /* "pygame/_sdl2/video.pyx":999
15168  *         res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
15169  *         if res < 0:
15170  *             raise error()             # <<<<<<<<<<<<<<
15171  *
15172  *     @property
15173  */
15174     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
15175     __Pyx_GOTREF(__pyx_t_4);
15176     __pyx_t_5 = NULL;
15177     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
15178       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
15179       if (likely(__pyx_t_5)) {
15180         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
15181         __Pyx_INCREF(__pyx_t_5);
15182         __Pyx_INCREF(function);
15183         __Pyx_DECREF_SET(__pyx_t_4, function);
15184       }
15185     }
15186     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
15187     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15188     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 999, __pyx_L1_error)
15189     __Pyx_GOTREF(__pyx_t_3);
15190     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15191     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15192     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15193     __PYX_ERR(0, 999, __pyx_L1_error)
15194 
15195     /* "pygame/_sdl2/video.pyx":998
15196  *         # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
15197  *         res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
15198  *         if res < 0:             # <<<<<<<<<<<<<<
15199  *             raise error()
15200  *
15201  */
15202   }
15203 
15204   /* "pygame/_sdl2/video.pyx":995
15205  *
15206  *     @draw_blend_mode.setter
15207  *     def draw_blend_mode(self, blendMode):             # <<<<<<<<<<<<<<
15208  *         # https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
15209  *         res = SDL_SetRenderDrawBlendMode(self._renderer, blendMode)
15210  */
15211 
15212   /* function exit code */
15213   __pyx_r = 0;
15214   goto __pyx_L0;
15215   __pyx_L1_error:;
15216   __Pyx_XDECREF(__pyx_t_3);
15217   __Pyx_XDECREF(__pyx_t_4);
15218   __Pyx_XDECREF(__pyx_t_5);
15219   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_blend_mode.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15220   __pyx_r = -1;
15221   __pyx_L0:;
15222   __Pyx_RefNannyFinishContext();
15223   return __pyx_r;
15224 }
15225 
15226 /* "pygame/_sdl2/video.pyx":1002
15227  *
15228  *     @property
15229  *     def draw_color(self):             # <<<<<<<<<<<<<<
15230  *         """ Color used by the drawing functions.
15231  *         """
15232  */
15233 
15234 /* Python wrapper */
15235 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_1__get__(PyObject * __pyx_v_self)15236 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_1__get__(PyObject *__pyx_v_self) {
15237   PyObject *__pyx_r = 0;
15238   __Pyx_RefNannyDeclarations
15239   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15240   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
15241 
15242   /* function exit code */
15243   __Pyx_RefNannyFinishContext();
15244   return __pyx_r;
15245 }
15246 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)15247 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
15248   PyObject *__pyx_r = NULL;
15249   __Pyx_RefNannyDeclarations
15250   __Pyx_RefNannySetupContext("__get__", 0);
15251 
15252   /* "pygame/_sdl2/video.pyx":1005
15253  *         """ Color used by the drawing functions.
15254  *         """
15255  *         return self._draw_color             # <<<<<<<<<<<<<<
15256  *
15257  *     @draw_color.setter
15258  */
15259   __Pyx_XDECREF(__pyx_r);
15260   __Pyx_INCREF(((PyObject *)__pyx_v_self->_draw_color));
15261   __pyx_r = ((PyObject *)__pyx_v_self->_draw_color);
15262   goto __pyx_L0;
15263 
15264   /* "pygame/_sdl2/video.pyx":1002
15265  *
15266  *     @property
15267  *     def draw_color(self):             # <<<<<<<<<<<<<<
15268  *         """ Color used by the drawing functions.
15269  *         """
15270  */
15271 
15272   /* function exit code */
15273   __pyx_L0:;
15274   __Pyx_XGIVEREF(__pyx_r);
15275   __Pyx_RefNannyFinishContext();
15276   return __pyx_r;
15277 }
15278 
15279 /* "pygame/_sdl2/video.pyx":1008
15280  *
15281  *     @draw_color.setter
15282  *     def draw_color(self, new_value):             # <<<<<<<<<<<<<<
15283  *         """ color used by the drawing functions.
15284  *         """
15285  */
15286 
15287 /* Python wrapper */
15288 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_value); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_new_value)15289 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_new_value) {
15290   int __pyx_r;
15291   __Pyx_RefNannyDeclarations
15292   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
15293   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_new_value));
15294 
15295   /* function exit code */
15296   __Pyx_RefNannyFinishContext();
15297   return __pyx_r;
15298 }
15299 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_new_value)15300 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10draw_color_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_new_value) {
15301   int __pyx_v_res;
15302   int __pyx_r;
15303   __Pyx_RefNannyDeclarations
15304   PyObject *__pyx_t_1 = NULL;
15305   Uint8 __pyx_t_2;
15306   Uint8 __pyx_t_3;
15307   Uint8 __pyx_t_4;
15308   Uint8 __pyx_t_5;
15309   int __pyx_t_6;
15310   PyObject *__pyx_t_7 = NULL;
15311   PyObject *__pyx_t_8 = NULL;
15312   int __pyx_lineno = 0;
15313   const char *__pyx_filename = NULL;
15314   int __pyx_clineno = 0;
15315   __Pyx_RefNannySetupContext("__set__", 0);
15316 
15317   /* "pygame/_sdl2/video.pyx":1012
15318  *         """
15319  *         # https://wiki.libsdl.org/SDL_SetRenderDrawColor
15320  *         self._draw_color[:] = new_value             # <<<<<<<<<<<<<<
15321  *         res = SDL_SetRenderDrawColor(self._renderer,
15322  *                                      new_value[0],
15323  */
15324   if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_self->_draw_color), __pyx_v_new_value, 0, 0, NULL, NULL, &__pyx_slice__26, 0, 0, 1) < 0) __PYX_ERR(0, 1012, __pyx_L1_error)
15325 
15326   /* "pygame/_sdl2/video.pyx":1014
15327  *         self._draw_color[:] = new_value
15328  *         res = SDL_SetRenderDrawColor(self._renderer,
15329  *                                      new_value[0],             # <<<<<<<<<<<<<<
15330  *                                      new_value[1],
15331  *                                      new_value[2],
15332  */
15333   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
15334   __Pyx_GOTREF(__pyx_t_1);
15335   __pyx_t_2 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_2 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error)
15336   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15337 
15338   /* "pygame/_sdl2/video.pyx":1015
15339  *         res = SDL_SetRenderDrawColor(self._renderer,
15340  *                                      new_value[0],
15341  *                                      new_value[1],             # <<<<<<<<<<<<<<
15342  *                                      new_value[2],
15343  *                                      new_value[3])
15344  */
15345   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error)
15346   __Pyx_GOTREF(__pyx_t_1);
15347   __pyx_t_3 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_3 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error)
15348   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15349 
15350   /* "pygame/_sdl2/video.pyx":1016
15351  *                                      new_value[0],
15352  *                                      new_value[1],
15353  *                                      new_value[2],             # <<<<<<<<<<<<<<
15354  *                                      new_value[3])
15355  *         if res < 0:
15356  */
15357   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error)
15358   __Pyx_GOTREF(__pyx_t_1);
15359   __pyx_t_4 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_4 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1016, __pyx_L1_error)
15360   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15361 
15362   /* "pygame/_sdl2/video.pyx":1017
15363  *                                      new_value[1],
15364  *                                      new_value[2],
15365  *                                      new_value[3])             # <<<<<<<<<<<<<<
15366  *         if res < 0:
15367  *             raise error()
15368  */
15369   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_new_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1017, __pyx_L1_error)
15370   __Pyx_GOTREF(__pyx_t_1);
15371   __pyx_t_5 = __Pyx_PyInt_As_Uint8(__pyx_t_1); if (unlikely((__pyx_t_5 == ((Uint8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1017, __pyx_L1_error)
15372   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15373 
15374   /* "pygame/_sdl2/video.pyx":1013
15375  *         # https://wiki.libsdl.org/SDL_SetRenderDrawColor
15376  *         self._draw_color[:] = new_value
15377  *         res = SDL_SetRenderDrawColor(self._renderer,             # <<<<<<<<<<<<<<
15378  *                                      new_value[0],
15379  *                                      new_value[1],
15380  */
15381   __pyx_v_res = SDL_SetRenderDrawColor(__pyx_v_self->_renderer, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5);
15382 
15383   /* "pygame/_sdl2/video.pyx":1018
15384  *                                      new_value[2],
15385  *                                      new_value[3])
15386  *         if res < 0:             # <<<<<<<<<<<<<<
15387  *             raise error()
15388  *
15389  */
15390   __pyx_t_6 = ((__pyx_v_res < 0) != 0);
15391   if (unlikely(__pyx_t_6)) {
15392 
15393     /* "pygame/_sdl2/video.pyx":1019
15394  *                                      new_value[3])
15395  *         if res < 0:
15396  *             raise error()             # <<<<<<<<<<<<<<
15397  *
15398  *     def clear(self):
15399  */
15400     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1019, __pyx_L1_error)
15401     __Pyx_GOTREF(__pyx_t_7);
15402     __pyx_t_8 = NULL;
15403     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
15404       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
15405       if (likely(__pyx_t_8)) {
15406         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
15407         __Pyx_INCREF(__pyx_t_8);
15408         __Pyx_INCREF(function);
15409         __Pyx_DECREF_SET(__pyx_t_7, function);
15410       }
15411     }
15412     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
15413     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
15414     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error)
15415     __Pyx_GOTREF(__pyx_t_1);
15416     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15417     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15418     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15419     __PYX_ERR(0, 1019, __pyx_L1_error)
15420 
15421     /* "pygame/_sdl2/video.pyx":1018
15422  *                                      new_value[2],
15423  *                                      new_value[3])
15424  *         if res < 0:             # <<<<<<<<<<<<<<
15425  *             raise error()
15426  *
15427  */
15428   }
15429 
15430   /* "pygame/_sdl2/video.pyx":1008
15431  *
15432  *     @draw_color.setter
15433  *     def draw_color(self, new_value):             # <<<<<<<<<<<<<<
15434  *         """ color used by the drawing functions.
15435  *         """
15436  */
15437 
15438   /* function exit code */
15439   __pyx_r = 0;
15440   goto __pyx_L0;
15441   __pyx_L1_error:;
15442   __Pyx_XDECREF(__pyx_t_1);
15443   __Pyx_XDECREF(__pyx_t_7);
15444   __Pyx_XDECREF(__pyx_t_8);
15445   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_color.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15446   __pyx_r = -1;
15447   __pyx_L0:;
15448   __Pyx_RefNannyFinishContext();
15449   return __pyx_r;
15450 }
15451 
15452 /* "pygame/_sdl2/video.pyx":1021
15453  *             raise error()
15454  *
15455  *     def clear(self):             # <<<<<<<<<<<<<<
15456  *         """ Clear the current rendering target with the drawing color.
15457  *         """
15458  */
15459 
15460 /* Python wrapper */
15461 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
15462 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_6clear[] = " Clear the current rendering target with the drawing color.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_7clear(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15463 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_7clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15464   PyObject *__pyx_r = 0;
15465   __Pyx_RefNannyDeclarations
15466   __Pyx_RefNannySetupContext("clear (wrapper)", 0);
15467   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
15468 
15469   /* function exit code */
15470   __Pyx_RefNannyFinishContext();
15471   return __pyx_r;
15472 }
15473 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)15474 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6clear(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
15475   int __pyx_v_res;
15476   PyObject *__pyx_r = NULL;
15477   __Pyx_RefNannyDeclarations
15478   int __pyx_t_1;
15479   PyObject *__pyx_t_2 = NULL;
15480   PyObject *__pyx_t_3 = NULL;
15481   PyObject *__pyx_t_4 = NULL;
15482   int __pyx_lineno = 0;
15483   const char *__pyx_filename = NULL;
15484   int __pyx_clineno = 0;
15485   __Pyx_RefNannySetupContext("clear", 0);
15486 
15487   /* "pygame/_sdl2/video.pyx":1025
15488  *         """
15489  *         # https://wiki.libsdl.org/SDL_RenderClear
15490  *         res = SDL_RenderClear(self._renderer)             # <<<<<<<<<<<<<<
15491  *         if res < 0:
15492  *             raise error()
15493  */
15494   __pyx_v_res = SDL_RenderClear(__pyx_v_self->_renderer);
15495 
15496   /* "pygame/_sdl2/video.pyx":1026
15497  *         # https://wiki.libsdl.org/SDL_RenderClear
15498  *         res = SDL_RenderClear(self._renderer)
15499  *         if res < 0:             # <<<<<<<<<<<<<<
15500  *             raise error()
15501  *
15502  */
15503   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
15504   if (unlikely(__pyx_t_1)) {
15505 
15506     /* "pygame/_sdl2/video.pyx":1027
15507  *         res = SDL_RenderClear(self._renderer)
15508  *         if res < 0:
15509  *             raise error()             # <<<<<<<<<<<<<<
15510  *
15511  *     def present(self):
15512  */
15513     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1027, __pyx_L1_error)
15514     __Pyx_GOTREF(__pyx_t_3);
15515     __pyx_t_4 = NULL;
15516     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15517       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15518       if (likely(__pyx_t_4)) {
15519         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15520         __Pyx_INCREF(__pyx_t_4);
15521         __Pyx_INCREF(function);
15522         __Pyx_DECREF_SET(__pyx_t_3, function);
15523       }
15524     }
15525     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
15526     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15527     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1027, __pyx_L1_error)
15528     __Pyx_GOTREF(__pyx_t_2);
15529     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15530     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15531     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15532     __PYX_ERR(0, 1027, __pyx_L1_error)
15533 
15534     /* "pygame/_sdl2/video.pyx":1026
15535  *         # https://wiki.libsdl.org/SDL_RenderClear
15536  *         res = SDL_RenderClear(self._renderer)
15537  *         if res < 0:             # <<<<<<<<<<<<<<
15538  *             raise error()
15539  *
15540  */
15541   }
15542 
15543   /* "pygame/_sdl2/video.pyx":1021
15544  *             raise error()
15545  *
15546  *     def clear(self):             # <<<<<<<<<<<<<<
15547  *         """ Clear the current rendering target with the drawing color.
15548  *         """
15549  */
15550 
15551   /* function exit code */
15552   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15553   goto __pyx_L0;
15554   __pyx_L1_error:;
15555   __Pyx_XDECREF(__pyx_t_2);
15556   __Pyx_XDECREF(__pyx_t_3);
15557   __Pyx_XDECREF(__pyx_t_4);
15558   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
15559   __pyx_r = NULL;
15560   __pyx_L0:;
15561   __Pyx_XGIVEREF(__pyx_r);
15562   __Pyx_RefNannyFinishContext();
15563   return __pyx_r;
15564 }
15565 
15566 /* "pygame/_sdl2/video.pyx":1029
15567  *             raise error()
15568  *
15569  *     def present(self):             # <<<<<<<<<<<<<<
15570  *         """ Present the composed backbuffer to the screen.
15571  *
15572  */
15573 
15574 /* Python wrapper */
15575 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_9present(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
15576 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_8present[] = " Present the composed backbuffer to the screen.\n\n        Updates the screen with any rendering performed since previous call.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_9present(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15577 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_9present(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15578   PyObject *__pyx_r = 0;
15579   __Pyx_RefNannyDeclarations
15580   __Pyx_RefNannySetupContext("present (wrapper)", 0);
15581   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
15582 
15583   /* function exit code */
15584   __Pyx_RefNannyFinishContext();
15585   return __pyx_r;
15586 }
15587 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)15588 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_8present(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
15589   PyObject *__pyx_r = NULL;
15590   __Pyx_RefNannyDeclarations
15591   __Pyx_RefNannySetupContext("present", 0);
15592 
15593   /* "pygame/_sdl2/video.pyx":1035
15594  *         """
15595  *         # https://wiki.libsdl.org/SDL_RenderPresent
15596  *         SDL_RenderPresent(self._renderer)             # <<<<<<<<<<<<<<
15597  *
15598  *     cpdef get_viewport(self):
15599  */
15600   SDL_RenderPresent(__pyx_v_self->_renderer);
15601 
15602   /* "pygame/_sdl2/video.pyx":1029
15603  *             raise error()
15604  *
15605  *     def present(self):             # <<<<<<<<<<<<<<
15606  *         """ Present the composed backbuffer to the screen.
15607  *
15608  */
15609 
15610   /* function exit code */
15611   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15612   __Pyx_XGIVEREF(__pyx_r);
15613   __Pyx_RefNannyFinishContext();
15614   return __pyx_r;
15615 }
15616 
15617 /* "pygame/_sdl2/video.pyx":1037
15618  *         SDL_RenderPresent(self._renderer)
15619  *
15620  *     cpdef get_viewport(self):             # <<<<<<<<<<<<<<
15621  *         """ Returns the drawing area on the target.
15622  *
15623  */
15624 
15625 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,int __pyx_skip_dispatch)15626 static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, int __pyx_skip_dispatch) {
15627   SDL_Rect __pyx_v_rect;
15628   PyObject *__pyx_r = NULL;
15629   __Pyx_RefNannyDeclarations
15630   PyObject *__pyx_t_1 = NULL;
15631   PyObject *__pyx_t_2 = NULL;
15632   PyObject *__pyx_t_3 = NULL;
15633   PyObject *__pyx_t_4 = NULL;
15634   int __pyx_lineno = 0;
15635   const char *__pyx_filename = NULL;
15636   int __pyx_clineno = 0;
15637   __Pyx_RefNannySetupContext("get_viewport", 0);
15638   /* Check if called by wrapper */
15639   if (unlikely(__pyx_skip_dispatch)) ;
15640   /* Check if overridden in Python */
15641   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
15642     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
15643     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
15644     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
15645       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
15646       #endif
15647       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_viewport); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1037, __pyx_L1_error)
15648       __Pyx_GOTREF(__pyx_t_1);
15649       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport)) {
15650         __Pyx_XDECREF(__pyx_r);
15651         __Pyx_INCREF(__pyx_t_1);
15652         __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
15653         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15654           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15655           if (likely(__pyx_t_4)) {
15656             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15657             __Pyx_INCREF(__pyx_t_4);
15658             __Pyx_INCREF(function);
15659             __Pyx_DECREF_SET(__pyx_t_3, function);
15660           }
15661         }
15662         __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
15663         __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15664         if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
15665         __Pyx_GOTREF(__pyx_t_2);
15666         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15667         __pyx_r = __pyx_t_2;
15668         __pyx_t_2 = 0;
15669         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15670         goto __pyx_L0;
15671       }
15672       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
15673       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
15674       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
15675       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
15676         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
15677       }
15678       #endif
15679       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15680       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
15681     }
15682     #endif
15683   }
15684 
15685   /* "pygame/_sdl2/video.pyx":1044
15686  *         # https://wiki.libsdl.org/SDL_RenderGetViewport
15687  *         cdef SDL_Rect rect
15688  *         SDL_RenderGetViewport(self._renderer, &rect)             # <<<<<<<<<<<<<<
15689  *         return pgRect_New(&rect)
15690  *
15691  */
15692   SDL_RenderGetViewport(__pyx_v_self->_renderer, (&__pyx_v_rect));
15693 
15694   /* "pygame/_sdl2/video.pyx":1045
15695  *         cdef SDL_Rect rect
15696  *         SDL_RenderGetViewport(self._renderer, &rect)
15697  *         return pgRect_New(&rect)             # <<<<<<<<<<<<<<
15698  *
15699  *     @property
15700  */
15701   __Pyx_XDECREF(__pyx_r);
15702   __pyx_t_1 = pgRect_New((&__pyx_v_rect)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1045, __pyx_L1_error)
15703   __Pyx_GOTREF(__pyx_t_1);
15704   __pyx_r = __pyx_t_1;
15705   __pyx_t_1 = 0;
15706   goto __pyx_L0;
15707 
15708   /* "pygame/_sdl2/video.pyx":1037
15709  *         SDL_RenderPresent(self._renderer)
15710  *
15711  *     cpdef get_viewport(self):             # <<<<<<<<<<<<<<
15712  *         """ Returns the drawing area on the target.
15713  *
15714  */
15715 
15716   /* function exit code */
15717   __pyx_L1_error:;
15718   __Pyx_XDECREF(__pyx_t_1);
15719   __Pyx_XDECREF(__pyx_t_2);
15720   __Pyx_XDECREF(__pyx_t_3);
15721   __Pyx_XDECREF(__pyx_t_4);
15722   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.get_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename);
15723   __pyx_r = 0;
15724   __pyx_L0:;
15725   __Pyx_XGIVEREF(__pyx_r);
15726   __Pyx_RefNannyFinishContext();
15727   return __pyx_r;
15728 }
15729 
15730 /* Python wrapper */
15731 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
15732 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_10get_viewport[] = " Returns the drawing area on the target.\n\n        :rtype: pygame.Rect\n        ";
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15733 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15734   PyObject *__pyx_r = 0;
15735   __Pyx_RefNannyDeclarations
15736   __Pyx_RefNannySetupContext("get_viewport (wrapper)", 0);
15737   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
15738 
15739   /* function exit code */
15740   __Pyx_RefNannyFinishContext();
15741   return __pyx_r;
15742 }
15743 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)15744 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_10get_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
15745   PyObject *__pyx_r = NULL;
15746   __Pyx_RefNannyDeclarations
15747   PyObject *__pyx_t_1 = NULL;
15748   int __pyx_lineno = 0;
15749   const char *__pyx_filename = NULL;
15750   int __pyx_clineno = 0;
15751   __Pyx_RefNannySetupContext("get_viewport", 0);
15752   __Pyx_XDECREF(__pyx_r);
15753   __pyx_t_1 = __pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1037, __pyx_L1_error)
15754   __Pyx_GOTREF(__pyx_t_1);
15755   __pyx_r = __pyx_t_1;
15756   __pyx_t_1 = 0;
15757   goto __pyx_L0;
15758 
15759   /* function exit code */
15760   __pyx_L1_error:;
15761   __Pyx_XDECREF(__pyx_t_1);
15762   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.get_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename);
15763   __pyx_r = NULL;
15764   __pyx_L0:;
15765   __Pyx_XGIVEREF(__pyx_r);
15766   __Pyx_RefNannyFinishContext();
15767   return __pyx_r;
15768 }
15769 
15770 /* "pygame/_sdl2/video.pyx":1048
15771  *
15772  *     @property
15773  *     def logical_size(self):             # <<<<<<<<<<<<<<
15774  *         cdef int w
15775  *         cdef int h
15776  */
15777 
15778 /* Python wrapper */
15779 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_1__get__(PyObject * __pyx_v_self)15780 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_1__get__(PyObject *__pyx_v_self) {
15781   PyObject *__pyx_r = 0;
15782   __Pyx_RefNannyDeclarations
15783   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15784   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
15785 
15786   /* function exit code */
15787   __Pyx_RefNannyFinishContext();
15788   return __pyx_r;
15789 }
15790 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)15791 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
15792   int __pyx_v_w;
15793   int __pyx_v_h;
15794   PyObject *__pyx_r = NULL;
15795   __Pyx_RefNannyDeclarations
15796   PyObject *__pyx_t_1 = NULL;
15797   PyObject *__pyx_t_2 = NULL;
15798   PyObject *__pyx_t_3 = NULL;
15799   int __pyx_lineno = 0;
15800   const char *__pyx_filename = NULL;
15801   int __pyx_clineno = 0;
15802   __Pyx_RefNannySetupContext("__get__", 0);
15803 
15804   /* "pygame/_sdl2/video.pyx":1051
15805  *         cdef int w
15806  *         cdef int h
15807  *         SDL_RenderGetLogicalSize(self._renderer, &w, &h)             # <<<<<<<<<<<<<<
15808  *         return (w, h)
15809  *
15810  */
15811   SDL_RenderGetLogicalSize(__pyx_v_self->_renderer, (&__pyx_v_w), (&__pyx_v_h));
15812 
15813   /* "pygame/_sdl2/video.pyx":1052
15814  *         cdef int h
15815  *         SDL_RenderGetLogicalSize(self._renderer, &w, &h)
15816  *         return (w, h)             # <<<<<<<<<<<<<<
15817  *
15818  *     @logical_size.setter
15819  */
15820   __Pyx_XDECREF(__pyx_r);
15821   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1052, __pyx_L1_error)
15822   __Pyx_GOTREF(__pyx_t_1);
15823   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1052, __pyx_L1_error)
15824   __Pyx_GOTREF(__pyx_t_2);
15825   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1052, __pyx_L1_error)
15826   __Pyx_GOTREF(__pyx_t_3);
15827   __Pyx_GIVEREF(__pyx_t_1);
15828   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
15829   __Pyx_GIVEREF(__pyx_t_2);
15830   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
15831   __pyx_t_1 = 0;
15832   __pyx_t_2 = 0;
15833   __pyx_r = __pyx_t_3;
15834   __pyx_t_3 = 0;
15835   goto __pyx_L0;
15836 
15837   /* "pygame/_sdl2/video.pyx":1048
15838  *
15839  *     @property
15840  *     def logical_size(self):             # <<<<<<<<<<<<<<
15841  *         cdef int w
15842  *         cdef int h
15843  */
15844 
15845   /* function exit code */
15846   __pyx_L1_error:;
15847   __Pyx_XDECREF(__pyx_t_1);
15848   __Pyx_XDECREF(__pyx_t_2);
15849   __Pyx_XDECREF(__pyx_t_3);
15850   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.logical_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15851   __pyx_r = NULL;
15852   __pyx_L0:;
15853   __Pyx_XGIVEREF(__pyx_r);
15854   __Pyx_RefNannyFinishContext();
15855   return __pyx_r;
15856 }
15857 
15858 /* "pygame/_sdl2/video.pyx":1055
15859  *
15860  *     @logical_size.setter
15861  *     def logical_size(self, size):             # <<<<<<<<<<<<<<
15862  *         cdef int w = size[0]
15863  *         cdef int h = size[1]
15864  */
15865 
15866 /* Python wrapper */
15867 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_size)15868 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
15869   int __pyx_r;
15870   __Pyx_RefNannyDeclarations
15871   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
15872   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_size));
15873 
15874   /* function exit code */
15875   __Pyx_RefNannyFinishContext();
15876   return __pyx_r;
15877 }
15878 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_size)15879 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12logical_size_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_size) {
15880   int __pyx_v_w;
15881   int __pyx_v_h;
15882   int __pyx_r;
15883   __Pyx_RefNannyDeclarations
15884   PyObject *__pyx_t_1 = NULL;
15885   int __pyx_t_2;
15886   int __pyx_t_3;
15887   PyObject *__pyx_t_4 = NULL;
15888   PyObject *__pyx_t_5 = NULL;
15889   int __pyx_lineno = 0;
15890   const char *__pyx_filename = NULL;
15891   int __pyx_clineno = 0;
15892   __Pyx_RefNannySetupContext("__set__", 0);
15893 
15894   /* "pygame/_sdl2/video.pyx":1056
15895  *     @logical_size.setter
15896  *     def logical_size(self, size):
15897  *         cdef int w = size[0]             # <<<<<<<<<<<<<<
15898  *         cdef int h = size[1]
15899  *         if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):
15900  */
15901   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1056, __pyx_L1_error)
15902   __Pyx_GOTREF(__pyx_t_1);
15903   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1056, __pyx_L1_error)
15904   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15905   __pyx_v_w = __pyx_t_2;
15906 
15907   /* "pygame/_sdl2/video.pyx":1057
15908  *     def logical_size(self, size):
15909  *         cdef int w = size[0]
15910  *         cdef int h = size[1]             # <<<<<<<<<<<<<<
15911  *         if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):
15912  *             raise error()
15913  */
15914   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error)
15915   __Pyx_GOTREF(__pyx_t_1);
15916   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1057, __pyx_L1_error)
15917   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15918   __pyx_v_h = __pyx_t_2;
15919 
15920   /* "pygame/_sdl2/video.pyx":1058
15921  *         cdef int w = size[0]
15922  *         cdef int h = size[1]
15923  *         if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):             # <<<<<<<<<<<<<<
15924  *             raise error()
15925  *
15926  */
15927   __pyx_t_3 = ((SDL_RenderSetLogicalSize(__pyx_v_self->_renderer, __pyx_v_w, __pyx_v_h) != 0) != 0);
15928   if (unlikely(__pyx_t_3)) {
15929 
15930     /* "pygame/_sdl2/video.pyx":1059
15931  *         cdef int h = size[1]
15932  *         if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):
15933  *             raise error()             # <<<<<<<<<<<<<<
15934  *
15935  *     @property
15936  */
15937     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1059, __pyx_L1_error)
15938     __Pyx_GOTREF(__pyx_t_4);
15939     __pyx_t_5 = NULL;
15940     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
15941       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
15942       if (likely(__pyx_t_5)) {
15943         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
15944         __Pyx_INCREF(__pyx_t_5);
15945         __Pyx_INCREF(function);
15946         __Pyx_DECREF_SET(__pyx_t_4, function);
15947       }
15948     }
15949     __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
15950     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15951     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1059, __pyx_L1_error)
15952     __Pyx_GOTREF(__pyx_t_1);
15953     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15954     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15955     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15956     __PYX_ERR(0, 1059, __pyx_L1_error)
15957 
15958     /* "pygame/_sdl2/video.pyx":1058
15959  *         cdef int w = size[0]
15960  *         cdef int h = size[1]
15961  *         if (SDL_RenderSetLogicalSize(self._renderer, w, h) != 0):             # <<<<<<<<<<<<<<
15962  *             raise error()
15963  *
15964  */
15965   }
15966 
15967   /* "pygame/_sdl2/video.pyx":1055
15968  *
15969  *     @logical_size.setter
15970  *     def logical_size(self, size):             # <<<<<<<<<<<<<<
15971  *         cdef int w = size[0]
15972  *         cdef int h = size[1]
15973  */
15974 
15975   /* function exit code */
15976   __pyx_r = 0;
15977   goto __pyx_L0;
15978   __pyx_L1_error:;
15979   __Pyx_XDECREF(__pyx_t_1);
15980   __Pyx_XDECREF(__pyx_t_4);
15981   __Pyx_XDECREF(__pyx_t_5);
15982   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.logical_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15983   __pyx_r = -1;
15984   __pyx_L0:;
15985   __Pyx_RefNannyFinishContext();
15986   return __pyx_r;
15987 }
15988 
15989 /* "pygame/_sdl2/video.pyx":1062
15990  *
15991  *     @property
15992  *     def scale(self):             # <<<<<<<<<<<<<<
15993  *         cdef float x
15994  *         cdef float y
15995  */
15996 
15997 /* Python wrapper */
15998 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_1__get__(PyObject * __pyx_v_self)15999 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_1__get__(PyObject *__pyx_v_self) {
16000   PyObject *__pyx_r = 0;
16001   __Pyx_RefNannyDeclarations
16002   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16003   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
16004 
16005   /* function exit code */
16006   __Pyx_RefNannyFinishContext();
16007   return __pyx_r;
16008 }
16009 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)16010 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
16011   float __pyx_v_x;
16012   float __pyx_v_y;
16013   PyObject *__pyx_r = NULL;
16014   __Pyx_RefNannyDeclarations
16015   PyObject *__pyx_t_1 = NULL;
16016   PyObject *__pyx_t_2 = NULL;
16017   PyObject *__pyx_t_3 = NULL;
16018   int __pyx_lineno = 0;
16019   const char *__pyx_filename = NULL;
16020   int __pyx_clineno = 0;
16021   __Pyx_RefNannySetupContext("__get__", 0);
16022 
16023   /* "pygame/_sdl2/video.pyx":1065
16024  *         cdef float x
16025  *         cdef float y
16026  *         SDL_RenderGetScale(self._renderer, &x, &y);             # <<<<<<<<<<<<<<
16027  *         return (x, y)
16028  *
16029  */
16030   SDL_RenderGetScale(__pyx_v_self->_renderer, (&__pyx_v_x), (&__pyx_v_y));
16031 
16032   /* "pygame/_sdl2/video.pyx":1066
16033  *         cdef float y
16034  *         SDL_RenderGetScale(self._renderer, &x, &y);
16035  *         return (x, y)             # <<<<<<<<<<<<<<
16036  *
16037  *     @scale.setter
16038  */
16039   __Pyx_XDECREF(__pyx_r);
16040   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1066, __pyx_L1_error)
16041   __Pyx_GOTREF(__pyx_t_1);
16042   __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1066, __pyx_L1_error)
16043   __Pyx_GOTREF(__pyx_t_2);
16044   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1066, __pyx_L1_error)
16045   __Pyx_GOTREF(__pyx_t_3);
16046   __Pyx_GIVEREF(__pyx_t_1);
16047   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
16048   __Pyx_GIVEREF(__pyx_t_2);
16049   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
16050   __pyx_t_1 = 0;
16051   __pyx_t_2 = 0;
16052   __pyx_r = __pyx_t_3;
16053   __pyx_t_3 = 0;
16054   goto __pyx_L0;
16055 
16056   /* "pygame/_sdl2/video.pyx":1062
16057  *
16058  *     @property
16059  *     def scale(self):             # <<<<<<<<<<<<<<
16060  *         cdef float x
16061  *         cdef float y
16062  */
16063 
16064   /* function exit code */
16065   __pyx_L1_error:;
16066   __Pyx_XDECREF(__pyx_t_1);
16067   __Pyx_XDECREF(__pyx_t_2);
16068   __Pyx_XDECREF(__pyx_t_3);
16069   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.scale.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16070   __pyx_r = NULL;
16071   __pyx_L0:;
16072   __Pyx_XGIVEREF(__pyx_r);
16073   __Pyx_RefNannyFinishContext();
16074   return __pyx_r;
16075 }
16076 
16077 /* "pygame/_sdl2/video.pyx":1069
16078  *
16079  *     @scale.setter
16080  *     def scale(self, scale):             # <<<<<<<<<<<<<<
16081  *         cdef float x = scale[0]
16082  *         cdef float y = scale[1]
16083  */
16084 
16085 /* Python wrapper */
16086 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scale); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_scale)16087 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scale) {
16088   int __pyx_r;
16089   __Pyx_RefNannyDeclarations
16090   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
16091   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_scale));
16092 
16093   /* function exit code */
16094   __Pyx_RefNannyFinishContext();
16095   return __pyx_r;
16096 }
16097 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_scale)16098 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_5scale_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_scale) {
16099   float __pyx_v_x;
16100   float __pyx_v_y;
16101   int __pyx_r;
16102   __Pyx_RefNannyDeclarations
16103   PyObject *__pyx_t_1 = NULL;
16104   float __pyx_t_2;
16105   int __pyx_t_3;
16106   PyObject *__pyx_t_4 = NULL;
16107   PyObject *__pyx_t_5 = NULL;
16108   int __pyx_lineno = 0;
16109   const char *__pyx_filename = NULL;
16110   int __pyx_clineno = 0;
16111   __Pyx_RefNannySetupContext("__set__", 0);
16112 
16113   /* "pygame/_sdl2/video.pyx":1070
16114  *     @scale.setter
16115  *     def scale(self, scale):
16116  *         cdef float x = scale[0]             # <<<<<<<<<<<<<<
16117  *         cdef float y = scale[1]
16118  *         if (SDL_RenderSetScale(self._renderer, x, y) != 0):
16119  */
16120   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_scale, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1070, __pyx_L1_error)
16121   __Pyx_GOTREF(__pyx_t_1);
16122   __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1070, __pyx_L1_error)
16123   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16124   __pyx_v_x = __pyx_t_2;
16125 
16126   /* "pygame/_sdl2/video.pyx":1071
16127  *     def scale(self, scale):
16128  *         cdef float x = scale[0]
16129  *         cdef float y = scale[1]             # <<<<<<<<<<<<<<
16130  *         if (SDL_RenderSetScale(self._renderer, x, y) != 0):
16131  *             raise error()
16132  */
16133   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_scale, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error)
16134   __Pyx_GOTREF(__pyx_t_1);
16135   __pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1071, __pyx_L1_error)
16136   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16137   __pyx_v_y = __pyx_t_2;
16138 
16139   /* "pygame/_sdl2/video.pyx":1072
16140  *         cdef float x = scale[0]
16141  *         cdef float y = scale[1]
16142  *         if (SDL_RenderSetScale(self._renderer, x, y) != 0):             # <<<<<<<<<<<<<<
16143  *             raise error()
16144  *
16145  */
16146   __pyx_t_3 = ((SDL_RenderSetScale(__pyx_v_self->_renderer, __pyx_v_x, __pyx_v_y) != 0) != 0);
16147   if (unlikely(__pyx_t_3)) {
16148 
16149     /* "pygame/_sdl2/video.pyx":1073
16150  *         cdef float y = scale[1]
16151  *         if (SDL_RenderSetScale(self._renderer, x, y) != 0):
16152  *             raise error()             # <<<<<<<<<<<<<<
16153  *
16154  *     # TODO ifdef
16155  */
16156     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1073, __pyx_L1_error)
16157     __Pyx_GOTREF(__pyx_t_4);
16158     __pyx_t_5 = NULL;
16159     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16160       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16161       if (likely(__pyx_t_5)) {
16162         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16163         __Pyx_INCREF(__pyx_t_5);
16164         __Pyx_INCREF(function);
16165         __Pyx_DECREF_SET(__pyx_t_4, function);
16166       }
16167     }
16168     __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
16169     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16170     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1073, __pyx_L1_error)
16171     __Pyx_GOTREF(__pyx_t_1);
16172     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16173     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16174     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16175     __PYX_ERR(0, 1073, __pyx_L1_error)
16176 
16177     /* "pygame/_sdl2/video.pyx":1072
16178  *         cdef float x = scale[0]
16179  *         cdef float y = scale[1]
16180  *         if (SDL_RenderSetScale(self._renderer, x, y) != 0):             # <<<<<<<<<<<<<<
16181  *             raise error()
16182  *
16183  */
16184   }
16185 
16186   /* "pygame/_sdl2/video.pyx":1069
16187  *
16188  *     @scale.setter
16189  *     def scale(self, scale):             # <<<<<<<<<<<<<<
16190  *         cdef float x = scale[0]
16191  *         cdef float y = scale[1]
16192  */
16193 
16194   /* function exit code */
16195   __pyx_r = 0;
16196   goto __pyx_L0;
16197   __pyx_L1_error:;
16198   __Pyx_XDECREF(__pyx_t_1);
16199   __Pyx_XDECREF(__pyx_t_4);
16200   __Pyx_XDECREF(__pyx_t_5);
16201   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.scale.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16202   __pyx_r = -1;
16203   __pyx_L0:;
16204   __Pyx_RefNannyFinishContext();
16205   return __pyx_r;
16206 }
16207 
16208 /* "pygame/_sdl2/video.pyx":1079
16209  *     #     return SDL_RenderGetIntegerScale(self._renderer)
16210  *
16211  *     def set_viewport(self, area):             # <<<<<<<<<<<<<<
16212  *         """ Set the drawing area on the target.
16213  *         If this is set to ``None``, the entire target will be used.
16214  */
16215 
16216 /* Python wrapper */
16217 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject *__pyx_v_self, PyObject *__pyx_v_area); /*proto*/
16218 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_12set_viewport[] = " Set the drawing area on the target.\n        If this is set to ``None``, the entire target will be used.\n\n        :param area: A ``pygame.Rect`` or tuple representing the\n                     drawing area on the target, or None.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject * __pyx_v_self,PyObject * __pyx_v_area)16219 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport(PyObject *__pyx_v_self, PyObject *__pyx_v_area) {
16220   PyObject *__pyx_r = 0;
16221   __Pyx_RefNannyDeclarations
16222   __Pyx_RefNannySetupContext("set_viewport (wrapper)", 0);
16223   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_area));
16224 
16225   /* function exit code */
16226   __Pyx_RefNannyFinishContext();
16227   return __pyx_r;
16228 }
16229 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_area)16230 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_12set_viewport(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_area) {
16231   SDL_Rect __pyx_v_tmprect;
16232   SDL_Rect *__pyx_v_rectptr;
16233   PyObject *__pyx_r = NULL;
16234   __Pyx_RefNannyDeclarations
16235   int __pyx_t_1;
16236   int __pyx_t_2;
16237   PyObject *__pyx_t_3 = NULL;
16238   PyObject *__pyx_t_4 = NULL;
16239   PyObject *__pyx_t_5 = NULL;
16240   int __pyx_lineno = 0;
16241   const char *__pyx_filename = NULL;
16242   int __pyx_clineno = 0;
16243   __Pyx_RefNannySetupContext("set_viewport", 0);
16244 
16245   /* "pygame/_sdl2/video.pyx":1087
16246  *         """
16247  *         # https://wiki.libsdl.org/SDL_RenderSetViewport
16248  *         if area is None:             # <<<<<<<<<<<<<<
16249  *             if SDL_RenderSetViewport(self._renderer, NULL) < 0:
16250  *                 raise error()
16251  */
16252   __pyx_t_1 = (__pyx_v_area == Py_None);
16253   __pyx_t_2 = (__pyx_t_1 != 0);
16254   if (__pyx_t_2) {
16255 
16256     /* "pygame/_sdl2/video.pyx":1088
16257  *         # https://wiki.libsdl.org/SDL_RenderSetViewport
16258  *         if area is None:
16259  *             if SDL_RenderSetViewport(self._renderer, NULL) < 0:             # <<<<<<<<<<<<<<
16260  *                 raise error()
16261  *             return
16262  */
16263     __pyx_t_2 = ((SDL_RenderSetViewport(__pyx_v_self->_renderer, NULL) < 0) != 0);
16264     if (unlikely(__pyx_t_2)) {
16265 
16266       /* "pygame/_sdl2/video.pyx":1089
16267  *         if area is None:
16268  *             if SDL_RenderSetViewport(self._renderer, NULL) < 0:
16269  *                 raise error()             # <<<<<<<<<<<<<<
16270  *             return
16271  *
16272  */
16273       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1089, __pyx_L1_error)
16274       __Pyx_GOTREF(__pyx_t_4);
16275       __pyx_t_5 = NULL;
16276       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16277         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16278         if (likely(__pyx_t_5)) {
16279           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16280           __Pyx_INCREF(__pyx_t_5);
16281           __Pyx_INCREF(function);
16282           __Pyx_DECREF_SET(__pyx_t_4, function);
16283         }
16284       }
16285       __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
16286       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16287       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L1_error)
16288       __Pyx_GOTREF(__pyx_t_3);
16289       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16290       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16291       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16292       __PYX_ERR(0, 1089, __pyx_L1_error)
16293 
16294       /* "pygame/_sdl2/video.pyx":1088
16295  *         # https://wiki.libsdl.org/SDL_RenderSetViewport
16296  *         if area is None:
16297  *             if SDL_RenderSetViewport(self._renderer, NULL) < 0:             # <<<<<<<<<<<<<<
16298  *                 raise error()
16299  *             return
16300  */
16301     }
16302 
16303     /* "pygame/_sdl2/video.pyx":1090
16304  *             if SDL_RenderSetViewport(self._renderer, NULL) < 0:
16305  *                 raise error()
16306  *             return             # <<<<<<<<<<<<<<
16307  *
16308  *         cdef SDL_Rect tmprect
16309  */
16310     __Pyx_XDECREF(__pyx_r);
16311     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16312     goto __pyx_L0;
16313 
16314     /* "pygame/_sdl2/video.pyx":1087
16315  *         """
16316  *         # https://wiki.libsdl.org/SDL_RenderSetViewport
16317  *         if area is None:             # <<<<<<<<<<<<<<
16318  *             if SDL_RenderSetViewport(self._renderer, NULL) < 0:
16319  *                 raise error()
16320  */
16321   }
16322 
16323   /* "pygame/_sdl2/video.pyx":1093
16324  *
16325  *         cdef SDL_Rect tmprect
16326  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)             # <<<<<<<<<<<<<<
16327  *         if rectptr == NULL:
16328  *             raise TypeError('expected a rectangle')
16329  */
16330   __pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_tmprect));
16331 
16332   /* "pygame/_sdl2/video.pyx":1094
16333  *         cdef SDL_Rect tmprect
16334  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
16335  *         if rectptr == NULL:             # <<<<<<<<<<<<<<
16336  *             raise TypeError('expected a rectangle')
16337  *
16338  */
16339   __pyx_t_2 = ((__pyx_v_rectptr == NULL) != 0);
16340   if (unlikely(__pyx_t_2)) {
16341 
16342     /* "pygame/_sdl2/video.pyx":1095
16343  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
16344  *         if rectptr == NULL:
16345  *             raise TypeError('expected a rectangle')             # <<<<<<<<<<<<<<
16346  *
16347  *         if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
16348  */
16349     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L1_error)
16350     __Pyx_GOTREF(__pyx_t_3);
16351     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16352     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16353     __PYX_ERR(0, 1095, __pyx_L1_error)
16354 
16355     /* "pygame/_sdl2/video.pyx":1094
16356  *         cdef SDL_Rect tmprect
16357  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
16358  *         if rectptr == NULL:             # <<<<<<<<<<<<<<
16359  *             raise TypeError('expected a rectangle')
16360  *
16361  */
16362   }
16363 
16364   /* "pygame/_sdl2/video.pyx":1097
16365  *             raise TypeError('expected a rectangle')
16366  *
16367  *         if SDL_RenderSetViewport(self._renderer, rectptr) < 0:             # <<<<<<<<<<<<<<
16368  *             raise error()
16369  *
16370  */
16371   __pyx_t_2 = ((SDL_RenderSetViewport(__pyx_v_self->_renderer, __pyx_v_rectptr) < 0) != 0);
16372   if (unlikely(__pyx_t_2)) {
16373 
16374     /* "pygame/_sdl2/video.pyx":1098
16375  *
16376  *         if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
16377  *             raise error()             # <<<<<<<<<<<<<<
16378  *
16379  *
16380  */
16381     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1098, __pyx_L1_error)
16382     __Pyx_GOTREF(__pyx_t_4);
16383     __pyx_t_5 = NULL;
16384     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16385       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16386       if (likely(__pyx_t_5)) {
16387         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16388         __Pyx_INCREF(__pyx_t_5);
16389         __Pyx_INCREF(function);
16390         __Pyx_DECREF_SET(__pyx_t_4, function);
16391       }
16392     }
16393     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
16394     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16395     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1098, __pyx_L1_error)
16396     __Pyx_GOTREF(__pyx_t_3);
16397     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16398     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16399     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16400     __PYX_ERR(0, 1098, __pyx_L1_error)
16401 
16402     /* "pygame/_sdl2/video.pyx":1097
16403  *             raise TypeError('expected a rectangle')
16404  *
16405  *         if SDL_RenderSetViewport(self._renderer, rectptr) < 0:             # <<<<<<<<<<<<<<
16406  *             raise error()
16407  *
16408  */
16409   }
16410 
16411   /* "pygame/_sdl2/video.pyx":1079
16412  *     #     return SDL_RenderGetIntegerScale(self._renderer)
16413  *
16414  *     def set_viewport(self, area):             # <<<<<<<<<<<<<<
16415  *         """ Set the drawing area on the target.
16416  *         If this is set to ``None``, the entire target will be used.
16417  */
16418 
16419   /* function exit code */
16420   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16421   goto __pyx_L0;
16422   __pyx_L1_error:;
16423   __Pyx_XDECREF(__pyx_t_3);
16424   __Pyx_XDECREF(__pyx_t_4);
16425   __Pyx_XDECREF(__pyx_t_5);
16426   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.set_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename);
16427   __pyx_r = NULL;
16428   __pyx_L0:;
16429   __Pyx_XGIVEREF(__pyx_r);
16430   __Pyx_RefNannyFinishContext();
16431   return __pyx_r;
16432 }
16433 
16434 /* "pygame/_sdl2/video.pyx":1102
16435  *
16436  *     @property
16437  *     def target(self):             # <<<<<<<<<<<<<<
16438  *         """ The current render target. Set to ``None`` for the default target.
16439  *
16440  */
16441 
16442 /* Python wrapper */
16443 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_1__get__(PyObject * __pyx_v_self)16444 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_1__get__(PyObject *__pyx_v_self) {
16445   PyObject *__pyx_r = 0;
16446   __Pyx_RefNannyDeclarations
16447   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16448   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
16449 
16450   /* function exit code */
16451   __Pyx_RefNannyFinishContext();
16452   return __pyx_r;
16453 }
16454 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)16455 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target___get__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
16456   PyObject *__pyx_r = NULL;
16457   __Pyx_RefNannyDeclarations
16458   __Pyx_RefNannySetupContext("__get__", 0);
16459 
16460   /* "pygame/_sdl2/video.pyx":1108
16461  *         """
16462  *         # https://wiki.libsdl.org/SDL_GetRenderTarget
16463  *         return self._target             # <<<<<<<<<<<<<<
16464  *
16465  *     @target.setter
16466  */
16467   __Pyx_XDECREF(__pyx_r);
16468   __Pyx_INCREF(((PyObject *)__pyx_v_self->_target));
16469   __pyx_r = ((PyObject *)__pyx_v_self->_target);
16470   goto __pyx_L0;
16471 
16472   /* "pygame/_sdl2/video.pyx":1102
16473  *
16474  *     @property
16475  *     def target(self):             # <<<<<<<<<<<<<<
16476  *         """ The current render target. Set to ``None`` for the default target.
16477  *
16478  */
16479 
16480   /* function exit code */
16481   __pyx_L0:;
16482   __Pyx_XGIVEREF(__pyx_r);
16483   __Pyx_RefNannyFinishContext();
16484   return __pyx_r;
16485 }
16486 
16487 /* "pygame/_sdl2/video.pyx":1111
16488  *
16489  *     @target.setter
16490  *     def target(self, newtarget):             # <<<<<<<<<<<<<<
16491  *         # https://wiki.libsdl.org/SDL_SetRenderTarget
16492  *         if newtarget is None:
16493  */
16494 
16495 /* Python wrapper */
16496 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_newtarget); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_newtarget)16497 static int __pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_newtarget) {
16498   int __pyx_r;
16499   __Pyx_RefNannyDeclarations
16500   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
16501   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_newtarget));
16502 
16503   /* function exit code */
16504   __Pyx_RefNannyFinishContext();
16505   return __pyx_r;
16506 }
16507 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_newtarget)16508 static int __pyx_pf_6pygame_5_sdl2_5video_8Renderer_6target_2__set__(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_newtarget) {
16509   int __pyx_r;
16510   __Pyx_RefNannyDeclarations
16511   int __pyx_t_1;
16512   int __pyx_t_2;
16513   PyObject *__pyx_t_3 = NULL;
16514   PyObject *__pyx_t_4 = NULL;
16515   PyObject *__pyx_t_5 = NULL;
16516   int __pyx_lineno = 0;
16517   const char *__pyx_filename = NULL;
16518   int __pyx_clineno = 0;
16519   __Pyx_RefNannySetupContext("__set__", 0);
16520 
16521   /* "pygame/_sdl2/video.pyx":1113
16522  *     def target(self, newtarget):
16523  *         # https://wiki.libsdl.org/SDL_SetRenderTarget
16524  *         if newtarget is None:             # <<<<<<<<<<<<<<
16525  *             self._target = None
16526  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:
16527  */
16528   __pyx_t_1 = (__pyx_v_newtarget == Py_None);
16529   __pyx_t_2 = (__pyx_t_1 != 0);
16530   if (__pyx_t_2) {
16531 
16532     /* "pygame/_sdl2/video.pyx":1114
16533  *         # https://wiki.libsdl.org/SDL_SetRenderTarget
16534  *         if newtarget is None:
16535  *             self._target = None             # <<<<<<<<<<<<<<
16536  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:
16537  *                 raise error()
16538  */
16539     __Pyx_INCREF(Py_None);
16540     __Pyx_GIVEREF(Py_None);
16541     __Pyx_GOTREF(__pyx_v_self->_target);
16542     __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
16543     __pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None);
16544 
16545     /* "pygame/_sdl2/video.pyx":1115
16546  *         if newtarget is None:
16547  *             self._target = None
16548  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:             # <<<<<<<<<<<<<<
16549  *                 raise error()
16550  *         elif isinstance(newtarget, Texture):
16551  */
16552     __pyx_t_2 = ((SDL_SetRenderTarget(__pyx_v_self->_renderer, NULL) < 0) != 0);
16553     if (unlikely(__pyx_t_2)) {
16554 
16555       /* "pygame/_sdl2/video.pyx":1116
16556  *             self._target = None
16557  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:
16558  *                 raise error()             # <<<<<<<<<<<<<<
16559  *         elif isinstance(newtarget, Texture):
16560  *             self._target = newtarget
16561  */
16562       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error)
16563       __Pyx_GOTREF(__pyx_t_4);
16564       __pyx_t_5 = NULL;
16565       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16566         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16567         if (likely(__pyx_t_5)) {
16568           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16569           __Pyx_INCREF(__pyx_t_5);
16570           __Pyx_INCREF(function);
16571           __Pyx_DECREF_SET(__pyx_t_4, function);
16572         }
16573       }
16574       __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
16575       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16576       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error)
16577       __Pyx_GOTREF(__pyx_t_3);
16578       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16579       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16580       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16581       __PYX_ERR(0, 1116, __pyx_L1_error)
16582 
16583       /* "pygame/_sdl2/video.pyx":1115
16584  *         if newtarget is None:
16585  *             self._target = None
16586  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:             # <<<<<<<<<<<<<<
16587  *                 raise error()
16588  *         elif isinstance(newtarget, Texture):
16589  */
16590     }
16591 
16592     /* "pygame/_sdl2/video.pyx":1113
16593  *     def target(self, newtarget):
16594  *         # https://wiki.libsdl.org/SDL_SetRenderTarget
16595  *         if newtarget is None:             # <<<<<<<<<<<<<<
16596  *             self._target = None
16597  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:
16598  */
16599     goto __pyx_L3;
16600   }
16601 
16602   /* "pygame/_sdl2/video.pyx":1117
16603  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:
16604  *                 raise error()
16605  *         elif isinstance(newtarget, Texture):             # <<<<<<<<<<<<<<
16606  *             self._target = newtarget
16607  *             if SDL_SetRenderTarget(self._renderer,
16608  */
16609   __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_newtarget, __pyx_ptype_6pygame_5_sdl2_5video_Texture);
16610   __pyx_t_1 = (__pyx_t_2 != 0);
16611   if (likely(__pyx_t_1)) {
16612 
16613     /* "pygame/_sdl2/video.pyx":1118
16614  *                 raise error()
16615  *         elif isinstance(newtarget, Texture):
16616  *             self._target = newtarget             # <<<<<<<<<<<<<<
16617  *             if SDL_SetRenderTarget(self._renderer,
16618  *                                    self._target._tex) < 0:
16619  */
16620     if (!(likely(((__pyx_v_newtarget) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_newtarget, __pyx_ptype_6pygame_5_sdl2_5video_Texture))))) __PYX_ERR(0, 1118, __pyx_L1_error)
16621     __pyx_t_3 = __pyx_v_newtarget;
16622     __Pyx_INCREF(__pyx_t_3);
16623     __Pyx_GIVEREF(__pyx_t_3);
16624     __Pyx_GOTREF(__pyx_v_self->_target);
16625     __Pyx_DECREF(((PyObject *)__pyx_v_self->_target));
16626     __pyx_v_self->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_t_3);
16627     __pyx_t_3 = 0;
16628 
16629     /* "pygame/_sdl2/video.pyx":1120
16630  *             self._target = newtarget
16631  *             if SDL_SetRenderTarget(self._renderer,
16632  *                                    self._target._tex) < 0:             # <<<<<<<<<<<<<<
16633  *                 raise error()
16634  *         else:
16635  */
16636     __pyx_t_1 = ((SDL_SetRenderTarget(__pyx_v_self->_renderer, __pyx_v_self->_target->_tex) < 0) != 0);
16637 
16638     /* "pygame/_sdl2/video.pyx":1119
16639  *         elif isinstance(newtarget, Texture):
16640  *             self._target = newtarget
16641  *             if SDL_SetRenderTarget(self._renderer,             # <<<<<<<<<<<<<<
16642  *                                    self._target._tex) < 0:
16643  *                 raise error()
16644  */
16645     if (unlikely(__pyx_t_1)) {
16646 
16647       /* "pygame/_sdl2/video.pyx":1121
16648  *             if SDL_SetRenderTarget(self._renderer,
16649  *                                    self._target._tex) < 0:
16650  *                 raise error()             # <<<<<<<<<<<<<<
16651  *         else:
16652  *             raise TypeError('target must be a Texture or None')
16653  */
16654       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error)
16655       __Pyx_GOTREF(__pyx_t_4);
16656       __pyx_t_5 = NULL;
16657       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16658         __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16659         if (likely(__pyx_t_5)) {
16660           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16661           __Pyx_INCREF(__pyx_t_5);
16662           __Pyx_INCREF(function);
16663           __Pyx_DECREF_SET(__pyx_t_4, function);
16664         }
16665       }
16666       __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
16667       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16668       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1121, __pyx_L1_error)
16669       __Pyx_GOTREF(__pyx_t_3);
16670       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16671       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16672       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16673       __PYX_ERR(0, 1121, __pyx_L1_error)
16674 
16675       /* "pygame/_sdl2/video.pyx":1119
16676  *         elif isinstance(newtarget, Texture):
16677  *             self._target = newtarget
16678  *             if SDL_SetRenderTarget(self._renderer,             # <<<<<<<<<<<<<<
16679  *                                    self._target._tex) < 0:
16680  *                 raise error()
16681  */
16682     }
16683 
16684     /* "pygame/_sdl2/video.pyx":1117
16685  *             if SDL_SetRenderTarget(self._renderer, NULL) < 0:
16686  *                 raise error()
16687  *         elif isinstance(newtarget, Texture):             # <<<<<<<<<<<<<<
16688  *             self._target = newtarget
16689  *             if SDL_SetRenderTarget(self._renderer,
16690  */
16691     goto __pyx_L3;
16692   }
16693 
16694   /* "pygame/_sdl2/video.pyx":1123
16695  *                 raise error()
16696  *         else:
16697  *             raise TypeError('target must be a Texture or None')             # <<<<<<<<<<<<<<
16698  *
16699  *     cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):
16700  */
16701   /*else*/ {
16702     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
16703     __Pyx_GOTREF(__pyx_t_3);
16704     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16705     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16706     __PYX_ERR(0, 1123, __pyx_L1_error)
16707   }
16708   __pyx_L3:;
16709 
16710   /* "pygame/_sdl2/video.pyx":1111
16711  *
16712  *     @target.setter
16713  *     def target(self, newtarget):             # <<<<<<<<<<<<<<
16714  *         # https://wiki.libsdl.org/SDL_SetRenderTarget
16715  *         if newtarget is None:
16716  */
16717 
16718   /* function exit code */
16719   __pyx_r = 0;
16720   goto __pyx_L0;
16721   __pyx_L1_error:;
16722   __Pyx_XDECREF(__pyx_t_3);
16723   __Pyx_XDECREF(__pyx_t_4);
16724   __Pyx_XDECREF(__pyx_t_5);
16725   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.target.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16726   __pyx_r = -1;
16727   __pyx_L0:;
16728   __Pyx_RefNannyFinishContext();
16729   return __pyx_r;
16730 }
16731 
16732 /* "pygame/_sdl2/video.pyx":1125
16733  *             raise TypeError('target must be a Texture or None')
16734  *
16735  *     cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):             # <<<<<<<<<<<<<<
16736  *         """ Only for compatibility.
16737  *         Textures created by different Renderers cannot shared with each other!
16738  */
16739 
16740 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_source,int __pyx_skip_dispatch,struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit * __pyx_optional_args)16741 static PyObject *__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_source, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit *__pyx_optional_args) {
16742   pgRectObject *__pyx_v_dest = ((pgRectObject *)Py_None);
16743   pgRectObject *__pyx_v_area = ((pgRectObject *)Py_None);
16744   int __pyx_v_special_flags = ((int)0);
16745   PyObject *__pyx_r = NULL;
16746   __Pyx_RefNannyDeclarations
16747   PyObject *__pyx_t_1 = NULL;
16748   PyObject *__pyx_t_2 = NULL;
16749   PyObject *__pyx_t_3 = NULL;
16750   PyObject *__pyx_t_4 = NULL;
16751   PyObject *__pyx_t_5 = NULL;
16752   int __pyx_t_6;
16753   PyObject *__pyx_t_7 = NULL;
16754   int __pyx_t_8;
16755   int __pyx_t_9;
16756   struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw __pyx_t_10;
16757   struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw __pyx_t_11;
16758   int __pyx_lineno = 0;
16759   const char *__pyx_filename = NULL;
16760   int __pyx_clineno = 0;
16761   __Pyx_RefNannySetupContext("blit", 0);
16762   if (__pyx_optional_args) {
16763     if (__pyx_optional_args->__pyx_n > 0) {
16764       __pyx_v_dest = __pyx_optional_args->dest;
16765       if (__pyx_optional_args->__pyx_n > 1) {
16766         __pyx_v_area = __pyx_optional_args->area;
16767         if (__pyx_optional_args->__pyx_n > 2) {
16768           __pyx_v_special_flags = __pyx_optional_args->special_flags;
16769         }
16770       }
16771     }
16772   }
16773   /* Check if called by wrapper */
16774   if (unlikely(__pyx_skip_dispatch)) ;
16775   /* Check if overridden in Python */
16776   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
16777     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
16778     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
16779     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
16780       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
16781       #endif
16782       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1125, __pyx_L1_error)
16783       __Pyx_GOTREF(__pyx_t_1);
16784       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit)) {
16785         __Pyx_XDECREF(__pyx_r);
16786         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_special_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
16787         __Pyx_GOTREF(__pyx_t_3);
16788         __Pyx_INCREF(__pyx_t_1);
16789         __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
16790         __pyx_t_6 = 0;
16791         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16792           __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16793           if (likely(__pyx_t_5)) {
16794             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16795             __Pyx_INCREF(__pyx_t_5);
16796             __Pyx_INCREF(function);
16797             __Pyx_DECREF_SET(__pyx_t_4, function);
16798             __pyx_t_6 = 1;
16799           }
16800         }
16801         #if CYTHON_FAST_PYCALL
16802         if (PyFunction_Check(__pyx_t_4)) {
16803           PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_source, ((PyObject *)__pyx_v_dest), ((PyObject *)__pyx_v_area), __pyx_t_3};
16804           __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error)
16805           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16806           __Pyx_GOTREF(__pyx_t_2);
16807           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16808         } else
16809         #endif
16810         #if CYTHON_FAST_PYCCALL
16811         if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
16812           PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_source, ((PyObject *)__pyx_v_dest), ((PyObject *)__pyx_v_area), __pyx_t_3};
16813           __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error)
16814           __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16815           __Pyx_GOTREF(__pyx_t_2);
16816           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16817         } else
16818         #endif
16819         {
16820           __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1125, __pyx_L1_error)
16821           __Pyx_GOTREF(__pyx_t_7);
16822           if (__pyx_t_5) {
16823             __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
16824           }
16825           __Pyx_INCREF(__pyx_v_source);
16826           __Pyx_GIVEREF(__pyx_v_source);
16827           PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_source);
16828           __Pyx_INCREF(((PyObject *)__pyx_v_dest));
16829           __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
16830           PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_dest));
16831           __Pyx_INCREF(((PyObject *)__pyx_v_area));
16832           __Pyx_GIVEREF(((PyObject *)__pyx_v_area));
16833           PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, ((PyObject *)__pyx_v_area));
16834           __Pyx_GIVEREF(__pyx_t_3);
16835           PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_t_3);
16836           __pyx_t_3 = 0;
16837           __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error)
16838           __Pyx_GOTREF(__pyx_t_2);
16839           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16840         }
16841         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16842         __pyx_r = __pyx_t_2;
16843         __pyx_t_2 = 0;
16844         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16845         goto __pyx_L0;
16846       }
16847       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
16848       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
16849       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
16850       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
16851         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
16852       }
16853       #endif
16854       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16855       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
16856     }
16857     #endif
16858   }
16859 
16860   /* "pygame/_sdl2/video.pyx":1133
16861  *         :param special_flags: have no effect at this moment.
16862  *         """
16863  *         if isinstance(source, Texture):             # <<<<<<<<<<<<<<
16864  *             (<Texture>source).draw(area, dest)
16865  *         elif isinstance(source, Image):
16866  */
16867   __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_source, __pyx_ptype_6pygame_5_sdl2_5video_Texture);
16868   __pyx_t_9 = (__pyx_t_8 != 0);
16869   if (__pyx_t_9) {
16870 
16871     /* "pygame/_sdl2/video.pyx":1134
16872  *         """
16873  *         if isinstance(source, Texture):
16874  *             (<Texture>source).draw(area, dest)             # <<<<<<<<<<<<<<
16875  *         elif isinstance(source, Image):
16876  *             (<Image>source).draw(area, dest)
16877  */
16878     __pyx_t_10.__pyx_n = 2;
16879     __pyx_t_10.srcrect = ((PyObject *)__pyx_v_area);
16880     __pyx_t_10.dstrect = ((PyObject *)__pyx_v_dest);
16881     ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture *)((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_source)->__pyx_vtab)->draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)__pyx_v_source), 0, &__pyx_t_10);
16882 
16883     /* "pygame/_sdl2/video.pyx":1133
16884  *         :param special_flags: have no effect at this moment.
16885  *         """
16886  *         if isinstance(source, Texture):             # <<<<<<<<<<<<<<
16887  *             (<Texture>source).draw(area, dest)
16888  *         elif isinstance(source, Image):
16889  */
16890     goto __pyx_L3;
16891   }
16892 
16893   /* "pygame/_sdl2/video.pyx":1135
16894  *         if isinstance(source, Texture):
16895  *             (<Texture>source).draw(area, dest)
16896  *         elif isinstance(source, Image):             # <<<<<<<<<<<<<<
16897  *             (<Image>source).draw(area, dest)
16898  *         elif not hasattr(source, 'draw'):
16899  */
16900   __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_source, __pyx_ptype_6pygame_5_sdl2_5video_Image);
16901   __pyx_t_8 = (__pyx_t_9 != 0);
16902   if (__pyx_t_8) {
16903 
16904     /* "pygame/_sdl2/video.pyx":1136
16905  *             (<Texture>source).draw(area, dest)
16906  *         elif isinstance(source, Image):
16907  *             (<Image>source).draw(area, dest)             # <<<<<<<<<<<<<<
16908  *         elif not hasattr(source, 'draw'):
16909  *             raise TypeError('source must be drawable')
16910  */
16911     __pyx_t_11.__pyx_n = 2;
16912     __pyx_t_11.srcrect = ((PyObject *)__pyx_v_area);
16913     __pyx_t_11.dstrect = ((PyObject *)__pyx_v_dest);
16914     ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image *)((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_source)->__pyx_vtab)->draw(((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)__pyx_v_source), 0, &__pyx_t_11);
16915 
16916     /* "pygame/_sdl2/video.pyx":1135
16917  *         if isinstance(source, Texture):
16918  *             (<Texture>source).draw(area, dest)
16919  *         elif isinstance(source, Image):             # <<<<<<<<<<<<<<
16920  *             (<Image>source).draw(area, dest)
16921  *         elif not hasattr(source, 'draw'):
16922  */
16923     goto __pyx_L3;
16924   }
16925 
16926   /* "pygame/_sdl2/video.pyx":1137
16927  *         elif isinstance(source, Image):
16928  *             (<Image>source).draw(area, dest)
16929  *         elif not hasattr(source, 'draw'):             # <<<<<<<<<<<<<<
16930  *             raise TypeError('source must be drawable')
16931  *         else:
16932  */
16933   __pyx_t_8 = __Pyx_HasAttr(__pyx_v_source, __pyx_n_s_draw); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1137, __pyx_L1_error)
16934   __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
16935   if (unlikely(__pyx_t_9)) {
16936 
16937     /* "pygame/_sdl2/video.pyx":1138
16938  *             (<Image>source).draw(area, dest)
16939  *         elif not hasattr(source, 'draw'):
16940  *             raise TypeError('source must be drawable')             # <<<<<<<<<<<<<<
16941  *         else:
16942  *             source.draw(area, dest)
16943  */
16944     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
16945     __Pyx_GOTREF(__pyx_t_1);
16946     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16947     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16948     __PYX_ERR(0, 1138, __pyx_L1_error)
16949 
16950     /* "pygame/_sdl2/video.pyx":1137
16951  *         elif isinstance(source, Image):
16952  *             (<Image>source).draw(area, dest)
16953  *         elif not hasattr(source, 'draw'):             # <<<<<<<<<<<<<<
16954  *             raise TypeError('source must be drawable')
16955  *         else:
16956  */
16957   }
16958 
16959   /* "pygame/_sdl2/video.pyx":1140
16960  *             raise TypeError('source must be drawable')
16961  *         else:
16962  *             source.draw(area, dest)             # <<<<<<<<<<<<<<
16963  *
16964  *         if not dest:
16965  */
16966   /*else*/ {
16967     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1140, __pyx_L1_error)
16968     __Pyx_GOTREF(__pyx_t_2);
16969     __pyx_t_4 = NULL;
16970     __pyx_t_6 = 0;
16971     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
16972       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
16973       if (likely(__pyx_t_4)) {
16974         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
16975         __Pyx_INCREF(__pyx_t_4);
16976         __Pyx_INCREF(function);
16977         __Pyx_DECREF_SET(__pyx_t_2, function);
16978         __pyx_t_6 = 1;
16979       }
16980     }
16981     #if CYTHON_FAST_PYCALL
16982     if (PyFunction_Check(__pyx_t_2)) {
16983       PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_area), ((PyObject *)__pyx_v_dest)};
16984       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
16985       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
16986       __Pyx_GOTREF(__pyx_t_1);
16987     } else
16988     #endif
16989     #if CYTHON_FAST_PYCCALL
16990     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
16991       PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_area), ((PyObject *)__pyx_v_dest)};
16992       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
16993       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
16994       __Pyx_GOTREF(__pyx_t_1);
16995     } else
16996     #endif
16997     {
16998       __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1140, __pyx_L1_error)
16999       __Pyx_GOTREF(__pyx_t_7);
17000       if (__pyx_t_4) {
17001         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
17002       }
17003       __Pyx_INCREF(((PyObject *)__pyx_v_area));
17004       __Pyx_GIVEREF(((PyObject *)__pyx_v_area));
17005       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_area));
17006       __Pyx_INCREF(((PyObject *)__pyx_v_dest));
17007       __Pyx_GIVEREF(((PyObject *)__pyx_v_dest));
17008       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_dest));
17009       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error)
17010       __Pyx_GOTREF(__pyx_t_1);
17011       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17012     }
17013     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17014     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17015   }
17016   __pyx_L3:;
17017 
17018   /* "pygame/_sdl2/video.pyx":1142
17019  *             source.draw(area, dest)
17020  *
17021  *         if not dest:             # <<<<<<<<<<<<<<
17022  *             return self.get_viewport()
17023  *         return dest
17024  */
17025   __pyx_t_9 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_dest)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1142, __pyx_L1_error)
17026   __pyx_t_8 = ((!__pyx_t_9) != 0);
17027   if (__pyx_t_8) {
17028 
17029     /* "pygame/_sdl2/video.pyx":1143
17030  *
17031  *         if not dest:
17032  *             return self.get_viewport()             # <<<<<<<<<<<<<<
17033  *         return dest
17034  *
17035  */
17036     __Pyx_XDECREF(__pyx_r);
17037     __pyx_t_1 = ((struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self->__pyx_vtab)->get_viewport(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
17038     __Pyx_GOTREF(__pyx_t_1);
17039     __pyx_r = __pyx_t_1;
17040     __pyx_t_1 = 0;
17041     goto __pyx_L0;
17042 
17043     /* "pygame/_sdl2/video.pyx":1142
17044  *             source.draw(area, dest)
17045  *
17046  *         if not dest:             # <<<<<<<<<<<<<<
17047  *             return self.get_viewport()
17048  *         return dest
17049  */
17050   }
17051 
17052   /* "pygame/_sdl2/video.pyx":1144
17053  *         if not dest:
17054  *             return self.get_viewport()
17055  *         return dest             # <<<<<<<<<<<<<<
17056  *
17057  *     def draw_line(self, p1, p2):
17058  */
17059   __Pyx_XDECREF(__pyx_r);
17060   __Pyx_INCREF(((PyObject *)__pyx_v_dest));
17061   __pyx_r = ((PyObject *)__pyx_v_dest);
17062   goto __pyx_L0;
17063 
17064   /* "pygame/_sdl2/video.pyx":1125
17065  *             raise TypeError('target must be a Texture or None')
17066  *
17067  *     cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):             # <<<<<<<<<<<<<<
17068  *         """ Only for compatibility.
17069  *         Textures created by different Renderers cannot shared with each other!
17070  */
17071 
17072   /* function exit code */
17073   __pyx_L1_error:;
17074   __Pyx_XDECREF(__pyx_t_1);
17075   __Pyx_XDECREF(__pyx_t_2);
17076   __Pyx_XDECREF(__pyx_t_3);
17077   __Pyx_XDECREF(__pyx_t_4);
17078   __Pyx_XDECREF(__pyx_t_5);
17079   __Pyx_XDECREF(__pyx_t_7);
17080   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
17081   __pyx_r = 0;
17082   __pyx_L0:;
17083   __Pyx_XGIVEREF(__pyx_r);
17084   __Pyx_RefNannyFinishContext();
17085   return __pyx_r;
17086 }
17087 
17088 /* Python wrapper */
17089 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17090 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_14blit[] = " Only for compatibility.\n        Textures created by different Renderers cannot shared with each other!\n        :param source: A Texture or Image to draw.\n        :param dest: destination on the render target.\n        :param area: the portion of source texture.\n        :param special_flags: have no effect at this moment.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17091 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17092   PyObject *__pyx_v_source = 0;
17093   pgRectObject *__pyx_v_dest = 0;
17094   pgRectObject *__pyx_v_area = 0;
17095   int __pyx_v_special_flags;
17096   int __pyx_lineno = 0;
17097   const char *__pyx_filename = NULL;
17098   int __pyx_clineno = 0;
17099   PyObject *__pyx_r = 0;
17100   __Pyx_RefNannyDeclarations
17101   __Pyx_RefNannySetupContext("blit (wrapper)", 0);
17102   {
17103     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_dest,&__pyx_n_s_area,&__pyx_n_s_special_flags,0};
17104     PyObject* values[4] = {0,0,0,0};
17105     values[1] = (PyObject *)((pgRectObject *)Py_None);
17106     values[2] = (PyObject *)((pgRectObject *)Py_None);
17107     if (unlikely(__pyx_kwds)) {
17108       Py_ssize_t kw_args;
17109       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17110       switch (pos_args) {
17111         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17112         CYTHON_FALLTHROUGH;
17113         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17114         CYTHON_FALLTHROUGH;
17115         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17116         CYTHON_FALLTHROUGH;
17117         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17118         CYTHON_FALLTHROUGH;
17119         case  0: break;
17120         default: goto __pyx_L5_argtuple_error;
17121       }
17122       kw_args = PyDict_Size(__pyx_kwds);
17123       switch (pos_args) {
17124         case  0:
17125         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
17126         else goto __pyx_L5_argtuple_error;
17127         CYTHON_FALLTHROUGH;
17128         case  1:
17129         if (kw_args > 0) {
17130           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dest);
17131           if (value) { values[1] = value; kw_args--; }
17132         }
17133         CYTHON_FALLTHROUGH;
17134         case  2:
17135         if (kw_args > 0) {
17136           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_area);
17137           if (value) { values[2] = value; kw_args--; }
17138         }
17139         CYTHON_FALLTHROUGH;
17140         case  3:
17141         if (kw_args > 0) {
17142           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_special_flags);
17143           if (value) { values[3] = value; kw_args--; }
17144         }
17145       }
17146       if (unlikely(kw_args > 0)) {
17147         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blit") < 0)) __PYX_ERR(0, 1125, __pyx_L3_error)
17148       }
17149     } else {
17150       switch (PyTuple_GET_SIZE(__pyx_args)) {
17151         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17152         CYTHON_FALLTHROUGH;
17153         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17154         CYTHON_FALLTHROUGH;
17155         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17156         CYTHON_FALLTHROUGH;
17157         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17158         break;
17159         default: goto __pyx_L5_argtuple_error;
17160       }
17161     }
17162     __pyx_v_source = values[0];
17163     __pyx_v_dest = ((pgRectObject *)values[1]);
17164     __pyx_v_area = ((pgRectObject *)values[2]);
17165     if (values[3]) {
17166       __pyx_v_special_flags = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_special_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1125, __pyx_L3_error)
17167     } else {
17168       __pyx_v_special_flags = ((int)0);
17169     }
17170   }
17171   goto __pyx_L4_argument_unpacking_done;
17172   __pyx_L5_argtuple_error:;
17173   __Pyx_RaiseArgtupleInvalid("blit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1125, __pyx_L3_error)
17174   __pyx_L3_error:;
17175   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
17176   __Pyx_RefNannyFinishContext();
17177   return NULL;
17178   __pyx_L4_argument_unpacking_done:;
17179   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dest), __pyx_ptype_6pygame_5_sdl2_5video_Rect, 1, "dest", 0))) __PYX_ERR(0, 1125, __pyx_L1_error)
17180   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_area), __pyx_ptype_6pygame_5_sdl2_5video_Rect, 1, "area", 0))) __PYX_ERR(0, 1125, __pyx_L1_error)
17181   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), __pyx_v_source, __pyx_v_dest, __pyx_v_area, __pyx_v_special_flags);
17182 
17183   /* function exit code */
17184   goto __pyx_L0;
17185   __pyx_L1_error:;
17186   __pyx_r = NULL;
17187   __pyx_L0:;
17188   __Pyx_RefNannyFinishContext();
17189   return __pyx_r;
17190 }
17191 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_source,pgRectObject * __pyx_v_dest,pgRectObject * __pyx_v_area,int __pyx_v_special_flags)17192 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_14blit(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_source, pgRectObject *__pyx_v_dest, pgRectObject *__pyx_v_area, int __pyx_v_special_flags) {
17193   PyObject *__pyx_r = NULL;
17194   __Pyx_RefNannyDeclarations
17195   PyObject *__pyx_t_1 = NULL;
17196   struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit __pyx_t_2;
17197   int __pyx_lineno = 0;
17198   const char *__pyx_filename = NULL;
17199   int __pyx_clineno = 0;
17200   __Pyx_RefNannySetupContext("blit", 0);
17201   __Pyx_XDECREF(__pyx_r);
17202   __pyx_t_2.__pyx_n = 3;
17203   __pyx_t_2.dest = __pyx_v_dest;
17204   __pyx_t_2.area = __pyx_v_area;
17205   __pyx_t_2.special_flags = __pyx_v_special_flags;
17206   __pyx_t_1 = __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer->blit(__pyx_v_self, __pyx_v_source, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1125, __pyx_L1_error)
17207   __Pyx_GOTREF(__pyx_t_1);
17208   __pyx_r = __pyx_t_1;
17209   __pyx_t_1 = 0;
17210   goto __pyx_L0;
17211 
17212   /* function exit code */
17213   __pyx_L1_error:;
17214   __Pyx_XDECREF(__pyx_t_1);
17215   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
17216   __pyx_r = NULL;
17217   __pyx_L0:;
17218   __Pyx_XGIVEREF(__pyx_r);
17219   __Pyx_RefNannyFinishContext();
17220   return __pyx_r;
17221 }
17222 
17223 /* "pygame/_sdl2/video.pyx":1146
17224  *         return dest
17225  *
17226  *     def draw_line(self, p1, p2):             # <<<<<<<<<<<<<<
17227  *         # https://wiki.libsdl.org/SDL_RenderDrawLine
17228  *         res = SDL_RenderDrawLine(self._renderer,
17229  */
17230 
17231 /* Python wrapper */
17232 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17233 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17234   PyObject *__pyx_v_p1 = 0;
17235   PyObject *__pyx_v_p2 = 0;
17236   int __pyx_lineno = 0;
17237   const char *__pyx_filename = NULL;
17238   int __pyx_clineno = 0;
17239   PyObject *__pyx_r = 0;
17240   __Pyx_RefNannyDeclarations
17241   __Pyx_RefNannySetupContext("draw_line (wrapper)", 0);
17242   {
17243     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p1,&__pyx_n_s_p2,0};
17244     PyObject* values[2] = {0,0};
17245     if (unlikely(__pyx_kwds)) {
17246       Py_ssize_t kw_args;
17247       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17248       switch (pos_args) {
17249         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17250         CYTHON_FALLTHROUGH;
17251         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17252         CYTHON_FALLTHROUGH;
17253         case  0: break;
17254         default: goto __pyx_L5_argtuple_error;
17255       }
17256       kw_args = PyDict_Size(__pyx_kwds);
17257       switch (pos_args) {
17258         case  0:
17259         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p1)) != 0)) kw_args--;
17260         else goto __pyx_L5_argtuple_error;
17261         CYTHON_FALLTHROUGH;
17262         case  1:
17263         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--;
17264         else {
17265           __Pyx_RaiseArgtupleInvalid("draw_line", 1, 2, 2, 1); __PYX_ERR(0, 1146, __pyx_L3_error)
17266         }
17267       }
17268       if (unlikely(kw_args > 0)) {
17269         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_line") < 0)) __PYX_ERR(0, 1146, __pyx_L3_error)
17270       }
17271     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
17272       goto __pyx_L5_argtuple_error;
17273     } else {
17274       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17275       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17276     }
17277     __pyx_v_p1 = values[0];
17278     __pyx_v_p2 = values[1];
17279   }
17280   goto __pyx_L4_argument_unpacking_done;
17281   __pyx_L5_argtuple_error:;
17282   __Pyx_RaiseArgtupleInvalid("draw_line", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1146, __pyx_L3_error)
17283   __pyx_L3_error:;
17284   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
17285   __Pyx_RefNannyFinishContext();
17286   return NULL;
17287   __pyx_L4_argument_unpacking_done:;
17288   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), __pyx_v_p1, __pyx_v_p2);
17289 
17290   /* function exit code */
17291   __Pyx_RefNannyFinishContext();
17292   return __pyx_r;
17293 }
17294 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_p1,PyObject * __pyx_v_p2)17295 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_16draw_line(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_p1, PyObject *__pyx_v_p2) {
17296   int __pyx_v_res;
17297   PyObject *__pyx_r = NULL;
17298   __Pyx_RefNannyDeclarations
17299   PyObject *__pyx_t_1 = NULL;
17300   int __pyx_t_2;
17301   int __pyx_t_3;
17302   int __pyx_t_4;
17303   int __pyx_t_5;
17304   int __pyx_t_6;
17305   PyObject *__pyx_t_7 = NULL;
17306   PyObject *__pyx_t_8 = NULL;
17307   int __pyx_lineno = 0;
17308   const char *__pyx_filename = NULL;
17309   int __pyx_clineno = 0;
17310   __Pyx_RefNannySetupContext("draw_line", 0);
17311 
17312   /* "pygame/_sdl2/video.pyx":1149
17313  *         # https://wiki.libsdl.org/SDL_RenderDrawLine
17314  *         res = SDL_RenderDrawLine(self._renderer,
17315  *                                  p1[0], p1[1],             # <<<<<<<<<<<<<<
17316  *                                  p2[0], p2[1])
17317  *         if res < 0:
17318  */
17319   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
17320   __Pyx_GOTREF(__pyx_t_1);
17321   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1149, __pyx_L1_error)
17322   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17323   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
17324   __Pyx_GOTREF(__pyx_t_1);
17325   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1149, __pyx_L1_error)
17326   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17327 
17328   /* "pygame/_sdl2/video.pyx":1150
17329  *         res = SDL_RenderDrawLine(self._renderer,
17330  *                                  p1[0], p1[1],
17331  *                                  p2[0], p2[1])             # <<<<<<<<<<<<<<
17332  *         if res < 0:
17333  *             raise error()
17334  */
17335   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
17336   __Pyx_GOTREF(__pyx_t_1);
17337   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1150, __pyx_L1_error)
17338   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17339   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_p2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
17340   __Pyx_GOTREF(__pyx_t_1);
17341   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1150, __pyx_L1_error)
17342   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17343 
17344   /* "pygame/_sdl2/video.pyx":1148
17345  *     def draw_line(self, p1, p2):
17346  *         # https://wiki.libsdl.org/SDL_RenderDrawLine
17347  *         res = SDL_RenderDrawLine(self._renderer,             # <<<<<<<<<<<<<<
17348  *                                  p1[0], p1[1],
17349  *                                  p2[0], p2[1])
17350  */
17351   __pyx_v_res = SDL_RenderDrawLine(__pyx_v_self->_renderer, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5);
17352 
17353   /* "pygame/_sdl2/video.pyx":1151
17354  *                                  p1[0], p1[1],
17355  *                                  p2[0], p2[1])
17356  *         if res < 0:             # <<<<<<<<<<<<<<
17357  *             raise error()
17358  *
17359  */
17360   __pyx_t_6 = ((__pyx_v_res < 0) != 0);
17361   if (unlikely(__pyx_t_6)) {
17362 
17363     /* "pygame/_sdl2/video.pyx":1152
17364  *                                  p2[0], p2[1])
17365  *         if res < 0:
17366  *             raise error()             # <<<<<<<<<<<<<<
17367  *
17368  *     def draw_point(self, point):
17369  */
17370     __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1152, __pyx_L1_error)
17371     __Pyx_GOTREF(__pyx_t_7);
17372     __pyx_t_8 = NULL;
17373     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
17374       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
17375       if (likely(__pyx_t_8)) {
17376         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
17377         __Pyx_INCREF(__pyx_t_8);
17378         __Pyx_INCREF(function);
17379         __Pyx_DECREF_SET(__pyx_t_7, function);
17380       }
17381     }
17382     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
17383     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17384     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1152, __pyx_L1_error)
17385     __Pyx_GOTREF(__pyx_t_1);
17386     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17387     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17388     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17389     __PYX_ERR(0, 1152, __pyx_L1_error)
17390 
17391     /* "pygame/_sdl2/video.pyx":1151
17392  *                                  p1[0], p1[1],
17393  *                                  p2[0], p2[1])
17394  *         if res < 0:             # <<<<<<<<<<<<<<
17395  *             raise error()
17396  *
17397  */
17398   }
17399 
17400   /* "pygame/_sdl2/video.pyx":1146
17401  *         return dest
17402  *
17403  *     def draw_line(self, p1, p2):             # <<<<<<<<<<<<<<
17404  *         # https://wiki.libsdl.org/SDL_RenderDrawLine
17405  *         res = SDL_RenderDrawLine(self._renderer,
17406  */
17407 
17408   /* function exit code */
17409   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17410   goto __pyx_L0;
17411   __pyx_L1_error:;
17412   __Pyx_XDECREF(__pyx_t_1);
17413   __Pyx_XDECREF(__pyx_t_7);
17414   __Pyx_XDECREF(__pyx_t_8);
17415   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
17416   __pyx_r = NULL;
17417   __pyx_L0:;
17418   __Pyx_XGIVEREF(__pyx_r);
17419   __Pyx_RefNannyFinishContext();
17420   return __pyx_r;
17421 }
17422 
17423 /* "pygame/_sdl2/video.pyx":1154
17424  *             raise error()
17425  *
17426  *     def draw_point(self, point):             # <<<<<<<<<<<<<<
17427  *         # https://wiki.libsdl.org/SDL_RenderDrawPoint
17428  *         res = SDL_RenderDrawPoint(self._renderer,
17429  */
17430 
17431 /* Python wrapper */
17432 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point(PyObject *__pyx_v_self, PyObject *__pyx_v_point); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point(PyObject * __pyx_v_self,PyObject * __pyx_v_point)17433 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point(PyObject *__pyx_v_self, PyObject *__pyx_v_point) {
17434   PyObject *__pyx_r = 0;
17435   __Pyx_RefNannyDeclarations
17436   __Pyx_RefNannySetupContext("draw_point (wrapper)", 0);
17437   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_point));
17438 
17439   /* function exit code */
17440   __Pyx_RefNannyFinishContext();
17441   return __pyx_r;
17442 }
17443 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_point)17444 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_18draw_point(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_point) {
17445   int __pyx_v_res;
17446   PyObject *__pyx_r = NULL;
17447   __Pyx_RefNannyDeclarations
17448   PyObject *__pyx_t_1 = NULL;
17449   int __pyx_t_2;
17450   int __pyx_t_3;
17451   int __pyx_t_4;
17452   PyObject *__pyx_t_5 = NULL;
17453   PyObject *__pyx_t_6 = NULL;
17454   int __pyx_lineno = 0;
17455   const char *__pyx_filename = NULL;
17456   int __pyx_clineno = 0;
17457   __Pyx_RefNannySetupContext("draw_point", 0);
17458 
17459   /* "pygame/_sdl2/video.pyx":1157
17460  *         # https://wiki.libsdl.org/SDL_RenderDrawPoint
17461  *         res = SDL_RenderDrawPoint(self._renderer,
17462  *                                   point[0], point[1])             # <<<<<<<<<<<<<<
17463  *         if res < 0:
17464  *             raise error()
17465  */
17466   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_point, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
17467   __Pyx_GOTREF(__pyx_t_1);
17468   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L1_error)
17469   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17470   __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_point, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
17471   __Pyx_GOTREF(__pyx_t_1);
17472   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1157, __pyx_L1_error)
17473   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17474 
17475   /* "pygame/_sdl2/video.pyx":1156
17476  *     def draw_point(self, point):
17477  *         # https://wiki.libsdl.org/SDL_RenderDrawPoint
17478  *         res = SDL_RenderDrawPoint(self._renderer,             # <<<<<<<<<<<<<<
17479  *                                   point[0], point[1])
17480  *         if res < 0:
17481  */
17482   __pyx_v_res = SDL_RenderDrawPoint(__pyx_v_self->_renderer, __pyx_t_2, __pyx_t_3);
17483 
17484   /* "pygame/_sdl2/video.pyx":1158
17485  *         res = SDL_RenderDrawPoint(self._renderer,
17486  *                                   point[0], point[1])
17487  *         if res < 0:             # <<<<<<<<<<<<<<
17488  *             raise error()
17489  *
17490  */
17491   __pyx_t_4 = ((__pyx_v_res < 0) != 0);
17492   if (unlikely(__pyx_t_4)) {
17493 
17494     /* "pygame/_sdl2/video.pyx":1159
17495  *                                   point[0], point[1])
17496  *         if res < 0:
17497  *             raise error()             # <<<<<<<<<<<<<<
17498  *
17499  *     def draw_rect(self, rect):
17500  */
17501     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1159, __pyx_L1_error)
17502     __Pyx_GOTREF(__pyx_t_5);
17503     __pyx_t_6 = NULL;
17504     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
17505       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
17506       if (likely(__pyx_t_6)) {
17507         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
17508         __Pyx_INCREF(__pyx_t_6);
17509         __Pyx_INCREF(function);
17510         __Pyx_DECREF_SET(__pyx_t_5, function);
17511       }
17512     }
17513     __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
17514     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17515     if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1159, __pyx_L1_error)
17516     __Pyx_GOTREF(__pyx_t_1);
17517     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17518     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17519     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17520     __PYX_ERR(0, 1159, __pyx_L1_error)
17521 
17522     /* "pygame/_sdl2/video.pyx":1158
17523  *         res = SDL_RenderDrawPoint(self._renderer,
17524  *                                   point[0], point[1])
17525  *         if res < 0:             # <<<<<<<<<<<<<<
17526  *             raise error()
17527  *
17528  */
17529   }
17530 
17531   /* "pygame/_sdl2/video.pyx":1154
17532  *             raise error()
17533  *
17534  *     def draw_point(self, point):             # <<<<<<<<<<<<<<
17535  *         # https://wiki.libsdl.org/SDL_RenderDrawPoint
17536  *         res = SDL_RenderDrawPoint(self._renderer,
17537  */
17538 
17539   /* function exit code */
17540   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17541   goto __pyx_L0;
17542   __pyx_L1_error:;
17543   __Pyx_XDECREF(__pyx_t_1);
17544   __Pyx_XDECREF(__pyx_t_5);
17545   __Pyx_XDECREF(__pyx_t_6);
17546   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
17547   __pyx_r = NULL;
17548   __pyx_L0:;
17549   __Pyx_XGIVEREF(__pyx_r);
17550   __Pyx_RefNannyFinishContext();
17551   return __pyx_r;
17552 }
17553 
17554 /* "pygame/_sdl2/video.pyx":1161
17555  *             raise error()
17556  *
17557  *     def draw_rect(self, rect):             # <<<<<<<<<<<<<<
17558  *         # https://wiki.libsdl.org/SDL_RenderDrawRect
17559  *         cdef SDL_Rect _rect
17560  */
17561 
17562 /* Python wrapper */
17563 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect(PyObject * __pyx_v_self,PyObject * __pyx_v_rect)17564 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect) {
17565   PyObject *__pyx_r = 0;
17566   __Pyx_RefNannyDeclarations
17567   __Pyx_RefNannySetupContext("draw_rect (wrapper)", 0);
17568   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_rect));
17569 
17570   /* function exit code */
17571   __Pyx_RefNannyFinishContext();
17572   return __pyx_r;
17573 }
17574 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_rect)17575 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_20draw_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_rect) {
17576   SDL_Rect __pyx_v__rect;
17577   SDL_Rect *__pyx_v_rectptr;
17578   int __pyx_v_res;
17579   PyObject *__pyx_r = NULL;
17580   __Pyx_RefNannyDeclarations
17581   int __pyx_t_1;
17582   PyObject *__pyx_t_2 = NULL;
17583   PyObject *__pyx_t_3 = NULL;
17584   PyObject *__pyx_t_4 = NULL;
17585   int __pyx_lineno = 0;
17586   const char *__pyx_filename = NULL;
17587   int __pyx_clineno = 0;
17588   __Pyx_RefNannySetupContext("draw_rect", 0);
17589 
17590   /* "pygame/_sdl2/video.pyx":1164
17591  *         # https://wiki.libsdl.org/SDL_RenderDrawRect
17592  *         cdef SDL_Rect _rect
17593  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)             # <<<<<<<<<<<<<<
17594  *         if rectptr == NULL:
17595  *             raise TypeError('expected a rectangle')
17596  */
17597   __pyx_v_rectptr = pgRect_FromObject(__pyx_v_rect, (&__pyx_v__rect));
17598 
17599   /* "pygame/_sdl2/video.pyx":1165
17600  *         cdef SDL_Rect _rect
17601  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
17602  *         if rectptr == NULL:             # <<<<<<<<<<<<<<
17603  *             raise TypeError('expected a rectangle')
17604  *         res = SDL_RenderDrawRect(self._renderer, rectptr)
17605  */
17606   __pyx_t_1 = ((__pyx_v_rectptr == NULL) != 0);
17607   if (unlikely(__pyx_t_1)) {
17608 
17609     /* "pygame/_sdl2/video.pyx":1166
17610  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
17611  *         if rectptr == NULL:
17612  *             raise TypeError('expected a rectangle')             # <<<<<<<<<<<<<<
17613  *         res = SDL_RenderDrawRect(self._renderer, rectptr)
17614  *         if res < 0:
17615  */
17616     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1166, __pyx_L1_error)
17617     __Pyx_GOTREF(__pyx_t_2);
17618     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17619     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17620     __PYX_ERR(0, 1166, __pyx_L1_error)
17621 
17622     /* "pygame/_sdl2/video.pyx":1165
17623  *         cdef SDL_Rect _rect
17624  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
17625  *         if rectptr == NULL:             # <<<<<<<<<<<<<<
17626  *             raise TypeError('expected a rectangle')
17627  *         res = SDL_RenderDrawRect(self._renderer, rectptr)
17628  */
17629   }
17630 
17631   /* "pygame/_sdl2/video.pyx":1167
17632  *         if rectptr == NULL:
17633  *             raise TypeError('expected a rectangle')
17634  *         res = SDL_RenderDrawRect(self._renderer, rectptr)             # <<<<<<<<<<<<<<
17635  *         if res < 0:
17636  *             raise error()
17637  */
17638   __pyx_v_res = SDL_RenderDrawRect(__pyx_v_self->_renderer, __pyx_v_rectptr);
17639 
17640   /* "pygame/_sdl2/video.pyx":1168
17641  *             raise TypeError('expected a rectangle')
17642  *         res = SDL_RenderDrawRect(self._renderer, rectptr)
17643  *         if res < 0:             # <<<<<<<<<<<<<<
17644  *             raise error()
17645  *
17646  */
17647   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
17648   if (unlikely(__pyx_t_1)) {
17649 
17650     /* "pygame/_sdl2/video.pyx":1169
17651  *         res = SDL_RenderDrawRect(self._renderer, rectptr)
17652  *         if res < 0:
17653  *             raise error()             # <<<<<<<<<<<<<<
17654  *
17655  *     def fill_rect(self, rect):
17656  */
17657     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1169, __pyx_L1_error)
17658     __Pyx_GOTREF(__pyx_t_3);
17659     __pyx_t_4 = NULL;
17660     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
17661       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
17662       if (likely(__pyx_t_4)) {
17663         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
17664         __Pyx_INCREF(__pyx_t_4);
17665         __Pyx_INCREF(function);
17666         __Pyx_DECREF_SET(__pyx_t_3, function);
17667       }
17668     }
17669     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
17670     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17671     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1169, __pyx_L1_error)
17672     __Pyx_GOTREF(__pyx_t_2);
17673     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17674     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17675     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17676     __PYX_ERR(0, 1169, __pyx_L1_error)
17677 
17678     /* "pygame/_sdl2/video.pyx":1168
17679  *             raise TypeError('expected a rectangle')
17680  *         res = SDL_RenderDrawRect(self._renderer, rectptr)
17681  *         if res < 0:             # <<<<<<<<<<<<<<
17682  *             raise error()
17683  *
17684  */
17685   }
17686 
17687   /* "pygame/_sdl2/video.pyx":1161
17688  *             raise error()
17689  *
17690  *     def draw_rect(self, rect):             # <<<<<<<<<<<<<<
17691  *         # https://wiki.libsdl.org/SDL_RenderDrawRect
17692  *         cdef SDL_Rect _rect
17693  */
17694 
17695   /* function exit code */
17696   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17697   goto __pyx_L0;
17698   __pyx_L1_error:;
17699   __Pyx_XDECREF(__pyx_t_2);
17700   __Pyx_XDECREF(__pyx_t_3);
17701   __Pyx_XDECREF(__pyx_t_4);
17702   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.draw_rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
17703   __pyx_r = NULL;
17704   __pyx_L0:;
17705   __Pyx_XGIVEREF(__pyx_r);
17706   __Pyx_RefNannyFinishContext();
17707   return __pyx_r;
17708 }
17709 
17710 /* "pygame/_sdl2/video.pyx":1171
17711  *             raise error()
17712  *
17713  *     def fill_rect(self, rect):             # <<<<<<<<<<<<<<
17714  *         # https://wiki.libsdl.org/SDL_RenderFillRect
17715  *         cdef SDL_Rect _rect
17716  */
17717 
17718 /* Python wrapper */
17719 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect(PyObject * __pyx_v_self,PyObject * __pyx_v_rect)17720 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect(PyObject *__pyx_v_self, PyObject *__pyx_v_rect) {
17721   PyObject *__pyx_r = 0;
17722   __Pyx_RefNannyDeclarations
17723   __Pyx_RefNannySetupContext("fill_rect (wrapper)", 0);
17724   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v_rect));
17725 
17726   /* function exit code */
17727   __Pyx_RefNannyFinishContext();
17728   return __pyx_r;
17729 }
17730 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_rect)17731 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_22fill_rect(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_rect) {
17732   SDL_Rect __pyx_v__rect;
17733   SDL_Rect *__pyx_v_rectptr;
17734   int __pyx_v_res;
17735   PyObject *__pyx_r = NULL;
17736   __Pyx_RefNannyDeclarations
17737   int __pyx_t_1;
17738   PyObject *__pyx_t_2 = NULL;
17739   PyObject *__pyx_t_3 = NULL;
17740   PyObject *__pyx_t_4 = NULL;
17741   int __pyx_lineno = 0;
17742   const char *__pyx_filename = NULL;
17743   int __pyx_clineno = 0;
17744   __Pyx_RefNannySetupContext("fill_rect", 0);
17745 
17746   /* "pygame/_sdl2/video.pyx":1174
17747  *         # https://wiki.libsdl.org/SDL_RenderFillRect
17748  *         cdef SDL_Rect _rect
17749  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)             # <<<<<<<<<<<<<<
17750  *         if rectptr == NULL:
17751  *             raise TypeError('expected a rectangle')
17752  */
17753   __pyx_v_rectptr = pgRect_FromObject(__pyx_v_rect, (&__pyx_v__rect));
17754 
17755   /* "pygame/_sdl2/video.pyx":1175
17756  *         cdef SDL_Rect _rect
17757  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
17758  *         if rectptr == NULL:             # <<<<<<<<<<<<<<
17759  *             raise TypeError('expected a rectangle')
17760  *         res = SDL_RenderFillRect(self._renderer, rectptr)
17761  */
17762   __pyx_t_1 = ((__pyx_v_rectptr == NULL) != 0);
17763   if (unlikely(__pyx_t_1)) {
17764 
17765     /* "pygame/_sdl2/video.pyx":1176
17766  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
17767  *         if rectptr == NULL:
17768  *             raise TypeError('expected a rectangle')             # <<<<<<<<<<<<<<
17769  *         res = SDL_RenderFillRect(self._renderer, rectptr)
17770  *
17771  */
17772     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
17773     __Pyx_GOTREF(__pyx_t_2);
17774     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17775     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17776     __PYX_ERR(0, 1176, __pyx_L1_error)
17777 
17778     /* "pygame/_sdl2/video.pyx":1175
17779  *         cdef SDL_Rect _rect
17780  *         cdef SDL_Rect *rectptr = pgRect_FromObject(rect, &_rect)
17781  *         if rectptr == NULL:             # <<<<<<<<<<<<<<
17782  *             raise TypeError('expected a rectangle')
17783  *         res = SDL_RenderFillRect(self._renderer, rectptr)
17784  */
17785   }
17786 
17787   /* "pygame/_sdl2/video.pyx":1177
17788  *         if rectptr == NULL:
17789  *             raise TypeError('expected a rectangle')
17790  *         res = SDL_RenderFillRect(self._renderer, rectptr)             # <<<<<<<<<<<<<<
17791  *
17792  *         if res < 0:
17793  */
17794   __pyx_v_res = SDL_RenderFillRect(__pyx_v_self->_renderer, __pyx_v_rectptr);
17795 
17796   /* "pygame/_sdl2/video.pyx":1179
17797  *         res = SDL_RenderFillRect(self._renderer, rectptr)
17798  *
17799  *         if res < 0:             # <<<<<<<<<<<<<<
17800  *             raise error()
17801  *
17802  */
17803   __pyx_t_1 = ((__pyx_v_res < 0) != 0);
17804   if (unlikely(__pyx_t_1)) {
17805 
17806     /* "pygame/_sdl2/video.pyx":1180
17807  *
17808  *         if res < 0:
17809  *             raise error()             # <<<<<<<<<<<<<<
17810  *
17811  *     def to_surface(self, surface=None, area=None):
17812  */
17813     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
17814     __Pyx_GOTREF(__pyx_t_3);
17815     __pyx_t_4 = NULL;
17816     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
17817       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
17818       if (likely(__pyx_t_4)) {
17819         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
17820         __Pyx_INCREF(__pyx_t_4);
17821         __Pyx_INCREF(function);
17822         __Pyx_DECREF_SET(__pyx_t_3, function);
17823       }
17824     }
17825     __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
17826     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17827     if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
17828     __Pyx_GOTREF(__pyx_t_2);
17829     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17830     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17831     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17832     __PYX_ERR(0, 1180, __pyx_L1_error)
17833 
17834     /* "pygame/_sdl2/video.pyx":1179
17835  *         res = SDL_RenderFillRect(self._renderer, rectptr)
17836  *
17837  *         if res < 0:             # <<<<<<<<<<<<<<
17838  *             raise error()
17839  *
17840  */
17841   }
17842 
17843   /* "pygame/_sdl2/video.pyx":1171
17844  *             raise error()
17845  *
17846  *     def fill_rect(self, rect):             # <<<<<<<<<<<<<<
17847  *         # https://wiki.libsdl.org/SDL_RenderFillRect
17848  *         cdef SDL_Rect _rect
17849  */
17850 
17851   /* function exit code */
17852   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17853   goto __pyx_L0;
17854   __pyx_L1_error:;
17855   __Pyx_XDECREF(__pyx_t_2);
17856   __Pyx_XDECREF(__pyx_t_3);
17857   __Pyx_XDECREF(__pyx_t_4);
17858   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.fill_rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
17859   __pyx_r = NULL;
17860   __pyx_L0:;
17861   __Pyx_XGIVEREF(__pyx_r);
17862   __Pyx_RefNannyFinishContext();
17863   return __pyx_r;
17864 }
17865 
17866 /* "pygame/_sdl2/video.pyx":1182
17867  *             raise error()
17868  *
17869  *     def to_surface(self, surface=None, area=None):             # <<<<<<<<<<<<<<
17870  *         # https://wiki.libsdl.org/SDL_RenderReadPixels
17871  *         """
17872  */
17873 
17874 /* Python wrapper */
17875 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25to_surface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17876 static char __pyx_doc_6pygame_5_sdl2_5video_8Renderer_24to_surface[] = "\n            Read pixels from the current rendering target and create a pygame.Surface.\n            WARNING: This is a very slow operation, and should not be used frequently.\n\n        :param surface: A surface to read the pixel data into.\n                        It must be large enough to fit the area, or ``ValueError`` is\n                        raised.\n                        If ``None``, a new surface is returned.\n        :param area: The area of the screen to read pixels from. The area is\n                     clipped to fit inside the viewport.\n                     If ``None``, the entire viewport is used.\n        ";
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25to_surface(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17877 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25to_surface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17878   PyObject *__pyx_v_surface = 0;
17879   PyObject *__pyx_v_area = 0;
17880   int __pyx_lineno = 0;
17881   const char *__pyx_filename = NULL;
17882   int __pyx_clineno = 0;
17883   PyObject *__pyx_r = 0;
17884   __Pyx_RefNannyDeclarations
17885   __Pyx_RefNannySetupContext("to_surface (wrapper)", 0);
17886   {
17887     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_area,0};
17888     PyObject* values[2] = {0,0};
17889     values[0] = ((PyObject *)Py_None);
17890     values[1] = ((PyObject *)Py_None);
17891     if (unlikely(__pyx_kwds)) {
17892       Py_ssize_t kw_args;
17893       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17894       switch (pos_args) {
17895         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17896         CYTHON_FALLTHROUGH;
17897         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17898         CYTHON_FALLTHROUGH;
17899         case  0: break;
17900         default: goto __pyx_L5_argtuple_error;
17901       }
17902       kw_args = PyDict_Size(__pyx_kwds);
17903       switch (pos_args) {
17904         case  0:
17905         if (kw_args > 0) {
17906           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface);
17907           if (value) { values[0] = value; kw_args--; }
17908         }
17909         CYTHON_FALLTHROUGH;
17910         case  1:
17911         if (kw_args > 0) {
17912           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_area);
17913           if (value) { values[1] = value; kw_args--; }
17914         }
17915       }
17916       if (unlikely(kw_args > 0)) {
17917         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "to_surface") < 0)) __PYX_ERR(0, 1182, __pyx_L3_error)
17918       }
17919     } else {
17920       switch (PyTuple_GET_SIZE(__pyx_args)) {
17921         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17922         CYTHON_FALLTHROUGH;
17923         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17924         CYTHON_FALLTHROUGH;
17925         case  0: break;
17926         default: goto __pyx_L5_argtuple_error;
17927       }
17928     }
17929     __pyx_v_surface = values[0];
17930     __pyx_v_area = values[1];
17931   }
17932   goto __pyx_L4_argument_unpacking_done;
17933   __pyx_L5_argtuple_error:;
17934   __Pyx_RaiseArgtupleInvalid("to_surface", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1182, __pyx_L3_error)
17935   __pyx_L3_error:;
17936   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.to_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
17937   __Pyx_RefNannyFinishContext();
17938   return NULL;
17939   __pyx_L4_argument_unpacking_done:;
17940   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_24to_surface(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), __pyx_v_surface, __pyx_v_area);
17941 
17942   /* function exit code */
17943   __Pyx_RefNannyFinishContext();
17944   return __pyx_r;
17945 }
17946 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24to_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,PyObject * __pyx_v_surface,PyObject * __pyx_v_area)17947 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_24to_surface(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, PyObject *__pyx_v_surface, PyObject *__pyx_v_area) {
17948   Uint32 __pyx_v_format;
17949   SDL_Rect __pyx_v_rarea;
17950   SDL_Rect __pyx_v_tempviewport;
17951   SDL_Rect *__pyx_v_areaparam;
17952   SDL_Surface *__pyx_v_surf;
17953   SDL_Rect *__pyx_v_rectptr;
17954   PyObject *__pyx_r = NULL;
17955   __Pyx_RefNannyDeclarations
17956   int __pyx_t_1;
17957   int __pyx_t_2;
17958   PyObject *__pyx_t_3 = NULL;
17959   int __pyx_t_4;
17960   PyObject *__pyx_t_5 = NULL;
17961   PyObject *__pyx_t_6 = NULL;
17962   pgSurfaceObject *__pyx_t_7;
17963   Uint32 __pyx_t_8;
17964   int __pyx_lineno = 0;
17965   const char *__pyx_filename = NULL;
17966   int __pyx_clineno = 0;
17967   __Pyx_RefNannySetupContext("to_surface", 0);
17968   __Pyx_INCREF(__pyx_v_surface);
17969 
17970   /* "pygame/_sdl2/video.pyx":1204
17971  *
17972  *         # obtain area to use
17973  *         if area is not None:             # <<<<<<<<<<<<<<
17974  *
17975  *             rectptr = pgRect_FromObject(area, &rarea)
17976  */
17977   __pyx_t_1 = (__pyx_v_area != Py_None);
17978   __pyx_t_2 = (__pyx_t_1 != 0);
17979   if (__pyx_t_2) {
17980 
17981     /* "pygame/_sdl2/video.pyx":1206
17982  *         if area is not None:
17983  *
17984  *             rectptr = pgRect_FromObject(area, &rarea)             # <<<<<<<<<<<<<<
17985  *             if rectptr == NULL:
17986  *                 raise TypeError('area must be None or a rect')
17987  */
17988     __pyx_v_rectptr = pgRect_FromObject(__pyx_v_area, (&__pyx_v_rarea));
17989 
17990     /* "pygame/_sdl2/video.pyx":1207
17991  *
17992  *             rectptr = pgRect_FromObject(area, &rarea)
17993  *             if rectptr == NULL:             # <<<<<<<<<<<<<<
17994  *                 raise TypeError('area must be None or a rect')
17995  *
17996  */
17997     __pyx_t_2 = ((__pyx_v_rectptr == NULL) != 0);
17998     if (unlikely(__pyx_t_2)) {
17999 
18000       /* "pygame/_sdl2/video.pyx":1208
18001  *             rectptr = pgRect_FromObject(area, &rarea)
18002  *             if rectptr == NULL:
18003  *                 raise TypeError('area must be None or a rect')             # <<<<<<<<<<<<<<
18004  *
18005  *             # clip area
18006  */
18007       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1208, __pyx_L1_error)
18008       __Pyx_GOTREF(__pyx_t_3);
18009       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18010       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18011       __PYX_ERR(0, 1208, __pyx_L1_error)
18012 
18013       /* "pygame/_sdl2/video.pyx":1207
18014  *
18015  *             rectptr = pgRect_FromObject(area, &rarea)
18016  *             if rectptr == NULL:             # <<<<<<<<<<<<<<
18017  *                 raise TypeError('area must be None or a rect')
18018  *
18019  */
18020     }
18021 
18022     /* "pygame/_sdl2/video.pyx":1211
18023  *
18024  *             # clip area
18025  *             SDL_RenderGetViewport(self._renderer, &tempviewport)             # <<<<<<<<<<<<<<
18026  *             SDL_IntersectRect(rectptr, &tempviewport, rectptr)
18027  *
18028  */
18029     SDL_RenderGetViewport(__pyx_v_self->_renderer, (&__pyx_v_tempviewport));
18030 
18031     /* "pygame/_sdl2/video.pyx":1212
18032  *             # clip area
18033  *             SDL_RenderGetViewport(self._renderer, &tempviewport)
18034  *             SDL_IntersectRect(rectptr, &tempviewport, rectptr)             # <<<<<<<<<<<<<<
18035  *
18036  *             areaparam = rectptr
18037  */
18038     (void)(SDL_IntersectRect(__pyx_v_rectptr, (&__pyx_v_tempviewport), __pyx_v_rectptr));
18039 
18040     /* "pygame/_sdl2/video.pyx":1214
18041  *             SDL_IntersectRect(rectptr, &tempviewport, rectptr)
18042  *
18043  *             areaparam = rectptr             # <<<<<<<<<<<<<<
18044  *             rarea.x = rectptr.x
18045  *             rarea.y = rectptr.y
18046  */
18047     __pyx_v_areaparam = __pyx_v_rectptr;
18048 
18049     /* "pygame/_sdl2/video.pyx":1215
18050  *
18051  *             areaparam = rectptr
18052  *             rarea.x = rectptr.x             # <<<<<<<<<<<<<<
18053  *             rarea.y = rectptr.y
18054  *             rarea.w = rectptr.w
18055  */
18056     __pyx_t_4 = __pyx_v_rectptr->x;
18057     __pyx_v_rarea.x = __pyx_t_4;
18058 
18059     /* "pygame/_sdl2/video.pyx":1216
18060  *             areaparam = rectptr
18061  *             rarea.x = rectptr.x
18062  *             rarea.y = rectptr.y             # <<<<<<<<<<<<<<
18063  *             rarea.w = rectptr.w
18064  *             rarea.h = rectptr.h
18065  */
18066     __pyx_t_4 = __pyx_v_rectptr->y;
18067     __pyx_v_rarea.y = __pyx_t_4;
18068 
18069     /* "pygame/_sdl2/video.pyx":1217
18070  *             rarea.x = rectptr.x
18071  *             rarea.y = rectptr.y
18072  *             rarea.w = rectptr.w             # <<<<<<<<<<<<<<
18073  *             rarea.h = rectptr.h
18074  *         else:
18075  */
18076     __pyx_t_4 = __pyx_v_rectptr->w;
18077     __pyx_v_rarea.w = __pyx_t_4;
18078 
18079     /* "pygame/_sdl2/video.pyx":1218
18080  *             rarea.y = rectptr.y
18081  *             rarea.w = rectptr.w
18082  *             rarea.h = rectptr.h             # <<<<<<<<<<<<<<
18083  *         else:
18084  *             SDL_RenderGetViewport(self._renderer, &rarea)
18085  */
18086     __pyx_t_4 = __pyx_v_rectptr->h;
18087     __pyx_v_rarea.h = __pyx_t_4;
18088 
18089     /* "pygame/_sdl2/video.pyx":1204
18090  *
18091  *         # obtain area to use
18092  *         if area is not None:             # <<<<<<<<<<<<<<
18093  *
18094  *             rectptr = pgRect_FromObject(area, &rarea)
18095  */
18096     goto __pyx_L3;
18097   }
18098 
18099   /* "pygame/_sdl2/video.pyx":1220
18100  *             rarea.h = rectptr.h
18101  *         else:
18102  *             SDL_RenderGetViewport(self._renderer, &rarea)             # <<<<<<<<<<<<<<
18103  *             areaparam = NULL
18104  *
18105  */
18106   /*else*/ {
18107     SDL_RenderGetViewport(__pyx_v_self->_renderer, (&__pyx_v_rarea));
18108 
18109     /* "pygame/_sdl2/video.pyx":1221
18110  *         else:
18111  *             SDL_RenderGetViewport(self._renderer, &rarea)
18112  *             areaparam = NULL             # <<<<<<<<<<<<<<
18113  *
18114  *         # prepare surface
18115  */
18116     __pyx_v_areaparam = NULL;
18117   }
18118   __pyx_L3:;
18119 
18120   /* "pygame/_sdl2/video.pyx":1224
18121  *
18122  *         # prepare surface
18123  *         if surface is None:             # <<<<<<<<<<<<<<
18124  *             # create a new surface
18125  *             format = SDL_GetWindowPixelFormat(self._win._win)
18126  */
18127   __pyx_t_2 = (__pyx_v_surface == Py_None);
18128   __pyx_t_1 = (__pyx_t_2 != 0);
18129   if (__pyx_t_1) {
18130 
18131     /* "pygame/_sdl2/video.pyx":1226
18132  *         if surface is None:
18133  *             # create a new surface
18134  *             format = SDL_GetWindowPixelFormat(self._win._win)             # <<<<<<<<<<<<<<
18135  *             if format == SDL_PIXELFORMAT_UNKNOWN:
18136  *                 raise error()
18137  */
18138     __pyx_v_format = SDL_GetWindowPixelFormat(__pyx_v_self->_win->_win);
18139 
18140     /* "pygame/_sdl2/video.pyx":1227
18141  *             # create a new surface
18142  *             format = SDL_GetWindowPixelFormat(self._win._win)
18143  *             if format == SDL_PIXELFORMAT_UNKNOWN:             # <<<<<<<<<<<<<<
18144  *                 raise error()
18145  *
18146  */
18147     __pyx_t_1 = ((__pyx_v_format == SDL_PIXELFORMAT_UNKNOWN) != 0);
18148     if (unlikely(__pyx_t_1)) {
18149 
18150       /* "pygame/_sdl2/video.pyx":1228
18151  *             format = SDL_GetWindowPixelFormat(self._win._win)
18152  *             if format == SDL_PIXELFORMAT_UNKNOWN:
18153  *                 raise error()             # <<<<<<<<<<<<<<
18154  *
18155  *             surf = SDL_CreateRGBSurfaceWithFormat(
18156  */
18157       __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1228, __pyx_L1_error)
18158       __Pyx_GOTREF(__pyx_t_5);
18159       __pyx_t_6 = NULL;
18160       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
18161         __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
18162         if (likely(__pyx_t_6)) {
18163           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
18164           __Pyx_INCREF(__pyx_t_6);
18165           __Pyx_INCREF(function);
18166           __Pyx_DECREF_SET(__pyx_t_5, function);
18167         }
18168       }
18169       __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
18170       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
18171       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1228, __pyx_L1_error)
18172       __Pyx_GOTREF(__pyx_t_3);
18173       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18174       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18175       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18176       __PYX_ERR(0, 1228, __pyx_L1_error)
18177 
18178       /* "pygame/_sdl2/video.pyx":1227
18179  *             # create a new surface
18180  *             format = SDL_GetWindowPixelFormat(self._win._win)
18181  *             if format == SDL_PIXELFORMAT_UNKNOWN:             # <<<<<<<<<<<<<<
18182  *                 raise error()
18183  *
18184  */
18185     }
18186 
18187     /* "pygame/_sdl2/video.pyx":1230
18188  *                 raise error()
18189  *
18190  *             surf = SDL_CreateRGBSurfaceWithFormat(             # <<<<<<<<<<<<<<
18191  *                 0,
18192  *                 rarea.w, rarea.h,
18193  */
18194     __pyx_v_surf = SDL_CreateRGBSurfaceWithFormat(0, __pyx_v_rarea.w, __pyx_v_rarea.h, SDL_BITSPERPIXEL(__pyx_v_format), __pyx_v_format);
18195 
18196     /* "pygame/_sdl2/video.pyx":1235
18197  *                 SDL_BITSPERPIXEL(format),
18198  *                 format)
18199  *             if surf == NULL:             # <<<<<<<<<<<<<<
18200  *                 raise MemoryError("not enough memory for the surface")
18201  *
18202  */
18203     __pyx_t_1 = ((__pyx_v_surf == NULL) != 0);
18204     if (unlikely(__pyx_t_1)) {
18205 
18206       /* "pygame/_sdl2/video.pyx":1236
18207  *                 format)
18208  *             if surf == NULL:
18209  *                 raise MemoryError("not enough memory for the surface")             # <<<<<<<<<<<<<<
18210  *
18211  *             surface = <object>pgSurface_New2(surf, 1)
18212  */
18213       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error)
18214       __Pyx_GOTREF(__pyx_t_3);
18215       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18216       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18217       __PYX_ERR(0, 1236, __pyx_L1_error)
18218 
18219       /* "pygame/_sdl2/video.pyx":1235
18220  *                 SDL_BITSPERPIXEL(format),
18221  *                 format)
18222  *             if surf == NULL:             # <<<<<<<<<<<<<<
18223  *                 raise MemoryError("not enough memory for the surface")
18224  *
18225  */
18226     }
18227 
18228     /* "pygame/_sdl2/video.pyx":1238
18229  *                 raise MemoryError("not enough memory for the surface")
18230  *
18231  *             surface = <object>pgSurface_New2(surf, 1)             # <<<<<<<<<<<<<<
18232  *         elif pgSurface_Check(surface):
18233  *             surf = pgSurface_AsSurface(surface)
18234  */
18235     __pyx_t_7 = pgSurface_New2(__pyx_v_surf, 1);
18236     __pyx_t_3 = ((PyObject *)__pyx_t_7);
18237     __Pyx_INCREF(__pyx_t_3);
18238     __Pyx_DECREF_SET(__pyx_v_surface, __pyx_t_3);
18239     __pyx_t_3 = 0;
18240 
18241     /* "pygame/_sdl2/video.pyx":1224
18242  *
18243  *         # prepare surface
18244  *         if surface is None:             # <<<<<<<<<<<<<<
18245  *             # create a new surface
18246  *             format = SDL_GetWindowPixelFormat(self._win._win)
18247  */
18248     goto __pyx_L5;
18249   }
18250 
18251   /* "pygame/_sdl2/video.pyx":1239
18252  *
18253  *             surface = <object>pgSurface_New2(surf, 1)
18254  *         elif pgSurface_Check(surface):             # <<<<<<<<<<<<<<
18255  *             surf = pgSurface_AsSurface(surface)
18256  *             if surf.w < rarea.w or surf.h < rarea.h:
18257  */
18258   __pyx_t_1 = (pgSurface_Check(__pyx_v_surface) != 0);
18259   if (likely(__pyx_t_1)) {
18260 
18261     /* "pygame/_sdl2/video.pyx":1240
18262  *             surface = <object>pgSurface_New2(surf, 1)
18263  *         elif pgSurface_Check(surface):
18264  *             surf = pgSurface_AsSurface(surface)             # <<<<<<<<<<<<<<
18265  *             if surf.w < rarea.w or surf.h < rarea.h:
18266  *                 raise ValueError("the surface is too small")
18267  */
18268     __pyx_v_surf = pgSurface_AsSurface(__pyx_v_surface);
18269 
18270     /* "pygame/_sdl2/video.pyx":1241
18271  *         elif pgSurface_Check(surface):
18272  *             surf = pgSurface_AsSurface(surface)
18273  *             if surf.w < rarea.w or surf.h < rarea.h:             # <<<<<<<<<<<<<<
18274  *                 raise ValueError("the surface is too small")
18275  *             format = surf.format.format
18276  */
18277     __pyx_t_2 = ((__pyx_v_surf->w < __pyx_v_rarea.w) != 0);
18278     if (!__pyx_t_2) {
18279     } else {
18280       __pyx_t_1 = __pyx_t_2;
18281       goto __pyx_L9_bool_binop_done;
18282     }
18283     __pyx_t_2 = ((__pyx_v_surf->h < __pyx_v_rarea.h) != 0);
18284     __pyx_t_1 = __pyx_t_2;
18285     __pyx_L9_bool_binop_done:;
18286     if (unlikely(__pyx_t_1)) {
18287 
18288       /* "pygame/_sdl2/video.pyx":1242
18289  *             surf = pgSurface_AsSurface(surface)
18290  *             if surf.w < rarea.w or surf.h < rarea.h:
18291  *                 raise ValueError("the surface is too small")             # <<<<<<<<<<<<<<
18292  *             format = surf.format.format
18293  *         else:
18294  */
18295       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1242, __pyx_L1_error)
18296       __Pyx_GOTREF(__pyx_t_3);
18297       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18298       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18299       __PYX_ERR(0, 1242, __pyx_L1_error)
18300 
18301       /* "pygame/_sdl2/video.pyx":1241
18302  *         elif pgSurface_Check(surface):
18303  *             surf = pgSurface_AsSurface(surface)
18304  *             if surf.w < rarea.w or surf.h < rarea.h:             # <<<<<<<<<<<<<<
18305  *                 raise ValueError("the surface is too small")
18306  *             format = surf.format.format
18307  */
18308     }
18309 
18310     /* "pygame/_sdl2/video.pyx":1243
18311  *             if surf.w < rarea.w or surf.h < rarea.h:
18312  *                 raise ValueError("the surface is too small")
18313  *             format = surf.format.format             # <<<<<<<<<<<<<<
18314  *         else:
18315  *             raise TypeError("'surface' must be a surface or None")
18316  */
18317     __pyx_t_8 = __pyx_v_surf->format->format;
18318     __pyx_v_format = __pyx_t_8;
18319 
18320     /* "pygame/_sdl2/video.pyx":1239
18321  *
18322  *             surface = <object>pgSurface_New2(surf, 1)
18323  *         elif pgSurface_Check(surface):             # <<<<<<<<<<<<<<
18324  *             surf = pgSurface_AsSurface(surface)
18325  *             if surf.w < rarea.w or surf.h < rarea.h:
18326  */
18327     goto __pyx_L5;
18328   }
18329 
18330   /* "pygame/_sdl2/video.pyx":1245
18331  *             format = surf.format.format
18332  *         else:
18333  *             raise TypeError("'surface' must be a surface or None")             # <<<<<<<<<<<<<<
18334  *
18335  *         if SDL_RenderReadPixels(self._renderer,
18336  */
18337   /*else*/ {
18338     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
18339     __Pyx_GOTREF(__pyx_t_3);
18340     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18341     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18342     __PYX_ERR(0, 1245, __pyx_L1_error)
18343   }
18344   __pyx_L5:;
18345 
18346   /* "pygame/_sdl2/video.pyx":1249
18347  *         if SDL_RenderReadPixels(self._renderer,
18348  *                                 areaparam,
18349  *                                 format, surf.pixels, surf.pitch) < 0:             # <<<<<<<<<<<<<<
18350  *             raise error()
18351  *         return surface
18352  */
18353   __pyx_t_1 = ((SDL_RenderReadPixels(__pyx_v_self->_renderer, __pyx_v_areaparam, __pyx_v_format, __pyx_v_surf->pixels, __pyx_v_surf->pitch) < 0) != 0);
18354 
18355   /* "pygame/_sdl2/video.pyx":1247
18356  *             raise TypeError("'surface' must be a surface or None")
18357  *
18358  *         if SDL_RenderReadPixels(self._renderer,             # <<<<<<<<<<<<<<
18359  *                                 areaparam,
18360  *                                 format, surf.pixels, surf.pitch) < 0:
18361  */
18362   if (unlikely(__pyx_t_1)) {
18363 
18364     /* "pygame/_sdl2/video.pyx":1250
18365  *                                 areaparam,
18366  *                                 format, surf.pixels, surf.pitch) < 0:
18367  *             raise error()             # <<<<<<<<<<<<<<
18368  *         return surface
18369  */
18370     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1250, __pyx_L1_error)
18371     __Pyx_GOTREF(__pyx_t_5);
18372     __pyx_t_6 = NULL;
18373     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
18374       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
18375       if (likely(__pyx_t_6)) {
18376         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
18377         __Pyx_INCREF(__pyx_t_6);
18378         __Pyx_INCREF(function);
18379         __Pyx_DECREF_SET(__pyx_t_5, function);
18380       }
18381     }
18382     __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
18383     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
18384     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1250, __pyx_L1_error)
18385     __Pyx_GOTREF(__pyx_t_3);
18386     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18387     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18388     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18389     __PYX_ERR(0, 1250, __pyx_L1_error)
18390 
18391     /* "pygame/_sdl2/video.pyx":1247
18392  *             raise TypeError("'surface' must be a surface or None")
18393  *
18394  *         if SDL_RenderReadPixels(self._renderer,             # <<<<<<<<<<<<<<
18395  *                                 areaparam,
18396  *                                 format, surf.pixels, surf.pitch) < 0:
18397  */
18398   }
18399 
18400   /* "pygame/_sdl2/video.pyx":1251
18401  *                                 format, surf.pixels, surf.pitch) < 0:
18402  *             raise error()
18403  *         return surface             # <<<<<<<<<<<<<<
18404  */
18405   __Pyx_XDECREF(__pyx_r);
18406   __Pyx_INCREF(__pyx_v_surface);
18407   __pyx_r = __pyx_v_surface;
18408   goto __pyx_L0;
18409 
18410   /* "pygame/_sdl2/video.pyx":1182
18411  *             raise error()
18412  *
18413  *     def to_surface(self, surface=None, area=None):             # <<<<<<<<<<<<<<
18414  *         # https://wiki.libsdl.org/SDL_RenderReadPixels
18415  *         """
18416  */
18417 
18418   /* function exit code */
18419   __pyx_L1_error:;
18420   __Pyx_XDECREF(__pyx_t_3);
18421   __Pyx_XDECREF(__pyx_t_5);
18422   __Pyx_XDECREF(__pyx_t_6);
18423   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.to_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
18424   __pyx_r = NULL;
18425   __pyx_L0:;
18426   __Pyx_XDECREF(__pyx_v_surface);
18427   __Pyx_XGIVEREF(__pyx_r);
18428   __Pyx_RefNannyFinishContext();
18429   return __pyx_r;
18430 }
18431 
18432 /* "(tree fragment)":1
18433  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18434  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18435  * def __setstate_cython__(self, __pyx_state):
18436  */
18437 
18438 /* Python wrapper */
18439 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)18440 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
18441   PyObject *__pyx_r = 0;
18442   __Pyx_RefNannyDeclarations
18443   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
18444   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_26__reduce_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self));
18445 
18446   /* function exit code */
18447   __Pyx_RefNannyFinishContext();
18448   return __pyx_r;
18449 }
18450 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self)18451 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self) {
18452   PyObject *__pyx_r = NULL;
18453   __Pyx_RefNannyDeclarations
18454   PyObject *__pyx_t_1 = NULL;
18455   int __pyx_lineno = 0;
18456   const char *__pyx_filename = NULL;
18457   int __pyx_clineno = 0;
18458   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
18459 
18460   /* "(tree fragment)":2
18461  * def __reduce_cython__(self):
18462  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
18463  * def __setstate_cython__(self, __pyx_state):
18464  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18465  */
18466   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
18467   __Pyx_GOTREF(__pyx_t_1);
18468   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18469   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18470   __PYX_ERR(1, 2, __pyx_L1_error)
18471 
18472   /* "(tree fragment)":1
18473  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18474  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18475  * def __setstate_cython__(self, __pyx_state):
18476  */
18477 
18478   /* function exit code */
18479   __pyx_L1_error:;
18480   __Pyx_XDECREF(__pyx_t_1);
18481   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18482   __pyx_r = NULL;
18483   __Pyx_XGIVEREF(__pyx_r);
18484   __Pyx_RefNannyFinishContext();
18485   return __pyx_r;
18486 }
18487 
18488 /* "(tree fragment)":3
18489  * def __reduce_cython__(self):
18490  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18491  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18492  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18493  */
18494 
18495 /* Python wrapper */
18496 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)18497 static PyObject *__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
18498   PyObject *__pyx_r = 0;
18499   __Pyx_RefNannyDeclarations
18500   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
18501   __pyx_r = __pyx_pf_6pygame_5_sdl2_5video_8Renderer_28__setstate_cython__(((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
18502 
18503   /* function exit code */
18504   __Pyx_RefNannyFinishContext();
18505   return __pyx_r;
18506 }
18507 
__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)18508 static PyObject *__pyx_pf_6pygame_5_sdl2_5video_8Renderer_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
18509   PyObject *__pyx_r = NULL;
18510   __Pyx_RefNannyDeclarations
18511   PyObject *__pyx_t_1 = NULL;
18512   int __pyx_lineno = 0;
18513   const char *__pyx_filename = NULL;
18514   int __pyx_clineno = 0;
18515   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
18516 
18517   /* "(tree fragment)":4
18518  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18519  * def __setstate_cython__(self, __pyx_state):
18520  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
18521  */
18522   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
18523   __Pyx_GOTREF(__pyx_t_1);
18524   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18525   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18526   __PYX_ERR(1, 4, __pyx_L1_error)
18527 
18528   /* "(tree fragment)":3
18529  * def __reduce_cython__(self):
18530  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18531  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18532  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
18533  */
18534 
18535   /* function exit code */
18536   __pyx_L1_error:;
18537   __Pyx_XDECREF(__pyx_t_1);
18538   __Pyx_AddTraceback("pygame._sdl2.video.Renderer.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18539   __pyx_r = NULL;
18540   __Pyx_XGIVEREF(__pyx_r);
18541   __Pyx_RefNannyFinishContext();
18542   return __pyx_r;
18543 }
18544 
__pyx_tp_new_6pygame_5_sdl2_5video_Window(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)18545 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Window(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18546   PyObject *o;
18547   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18548     o = (*t->tp_alloc)(t, 0);
18549   } else {
18550     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18551   }
18552   if (unlikely(!o)) return 0;
18553   return o;
18554 }
18555 
__pyx_tp_dealloc_6pygame_5_sdl2_5video_Window(PyObject * o)18556 static void __pyx_tp_dealloc_6pygame_5_sdl2_5video_Window(PyObject *o) {
18557   #if CYTHON_USE_TP_FINALIZE
18558   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
18559     if (PyObject_CallFinalizerFromDealloc(o)) return;
18560   }
18561   #endif
18562   {
18563     PyObject *etype, *eval, *etb;
18564     PyErr_Fetch(&etype, &eval, &etb);
18565     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18566     __pyx_pw_6pygame_5_sdl2_5video_6Window_27__dealloc__(o);
18567     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18568     PyErr_Restore(etype, eval, etb);
18569   }
18570   (*Py_TYPE(o)->tp_free)(o);
18571 }
18572 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_grab(PyObject * o,CYTHON_UNUSED void * x)18573 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_grab(PyObject *o, CYTHON_UNUSED void *x) {
18574   return __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_1__get__(o);
18575 }
18576 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_grab(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18577 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_grab(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18578   if (v) {
18579     return __pyx_pw_6pygame_5_sdl2_5video_6Window_4grab_3__set__(o, v);
18580   }
18581   else {
18582     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18583     return -1;
18584   }
18585 }
18586 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject * o,CYTHON_UNUSED void * x)18587 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject *o, CYTHON_UNUSED void *x) {
18588   return __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_1__get__(o);
18589 }
18590 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18591 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_relative_mouse(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18592   if (v) {
18593     return __pyx_pw_6pygame_5_sdl2_5video_6Window_14relative_mouse_3__set__(o, v);
18594   }
18595   else {
18596     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18597     return -1;
18598   }
18599 }
18600 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_title(PyObject * o,CYTHON_UNUSED void * x)18601 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_title(PyObject *o, CYTHON_UNUSED void *x) {
18602   return __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_1__get__(o);
18603 }
18604 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_title(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18605 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_title(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18606   if (v) {
18607     return __pyx_pw_6pygame_5_sdl2_5video_6Window_5title_3__set__(o, v);
18608   }
18609   else {
18610     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18611     return -1;
18612   }
18613 }
18614 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject * o,CYTHON_UNUSED void * x)18615 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject *o, CYTHON_UNUSED void *x) {
18616   return __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_1__get__(o);
18617 }
18618 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18619 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_resizable(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18620   if (v) {
18621     return __pyx_pw_6pygame_5_sdl2_5video_6Window_9resizable_3__set__(o, v);
18622   }
18623   else {
18624     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18625     return -1;
18626   }
18627 }
18628 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject * o,CYTHON_UNUSED void * x)18629 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject *o, CYTHON_UNUSED void *x) {
18630   return __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_1__get__(o);
18631 }
18632 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18633 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_borderless(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18634   if (v) {
18635     return __pyx_pw_6pygame_5_sdl2_5video_6Window_10borderless_3__set__(o, v);
18636   }
18637   else {
18638     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18639     return -1;
18640   }
18641 }
18642 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_id(PyObject * o,CYTHON_UNUSED void * x)18643 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_id(PyObject *o, CYTHON_UNUSED void *x) {
18644   return __pyx_pw_6pygame_5_sdl2_5video_6Window_2id_1__get__(o);
18645 }
18646 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_size(PyObject * o,CYTHON_UNUSED void * x)18647 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_size(PyObject *o, CYTHON_UNUSED void *x) {
18648   return __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_1__get__(o);
18649 }
18650 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_size(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18651 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18652   if (v) {
18653     return __pyx_pw_6pygame_5_sdl2_5video_6Window_4size_3__set__(o, v);
18654   }
18655   else {
18656     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18657     return -1;
18658   }
18659 }
18660 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_position(PyObject * o,CYTHON_UNUSED void * x)18661 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_position(PyObject *o, CYTHON_UNUSED void *x) {
18662   return __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_1__get__(o);
18663 }
18664 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_position(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18665 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_position(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18666   if (v) {
18667     return __pyx_pw_6pygame_5_sdl2_5video_6Window_8position_3__set__(o, v);
18668   }
18669   else {
18670     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18671     return -1;
18672   }
18673 }
18674 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject * o,CYTHON_UNUSED void * x)18675 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject *o, CYTHON_UNUSED void *x) {
18676   return __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_1__get__(o);
18677 }
18678 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18679 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_opacity(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18680   if (v) {
18681     return __pyx_pw_6pygame_5_sdl2_5video_6Window_7opacity_3__set__(o, v);
18682   }
18683   else {
18684     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18685     return -1;
18686   }
18687 }
18688 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_brightness(PyObject * o,CYTHON_UNUSED void * x)18689 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_brightness(PyObject *o, CYTHON_UNUSED void *x) {
18690   return __pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_1__get__(o);
18691 }
18692 
__pyx_setprop_6pygame_5_sdl2_5video_6Window_brightness(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18693 static int __pyx_setprop_6pygame_5_sdl2_5video_6Window_brightness(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18694   if (v) {
18695     return __pyx_pw_6pygame_5_sdl2_5video_6Window_10brightness_3__set__(o, v);
18696   }
18697   else {
18698     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18699     return -1;
18700   }
18701 }
18702 
__pyx_getprop_6pygame_5_sdl2_5video_6Window_display_index(PyObject * o,CYTHON_UNUSED void * x)18703 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_6Window_display_index(PyObject *o, CYTHON_UNUSED void *x) {
18704   return __pyx_pw_6pygame_5_sdl2_5video_6Window_13display_index_1__get__(o);
18705 }
18706 
18707 static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Window[] = {
18708   {"from_display_module", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_1from_display_module, METH_NOARGS, 0},
18709   {"set_windowed", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_5set_windowed, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_4set_windowed},
18710   {"set_fullscreen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_6Window_7set_fullscreen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_6Window_6set_fullscreen},
18711   {"destroy", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_9destroy, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_8destroy},
18712   {"hide", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_11hide, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_10hide},
18713   {"show", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_13show, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_12show},
18714   {"focus", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_6Window_15focus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_6Window_14focus},
18715   {"restore", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_17restore, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_16restore},
18716   {"maximize", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_19maximize, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_18maximize},
18717   {"minimize", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_21minimize, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_6Window_20minimize},
18718   {"set_icon", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_23set_icon, METH_O, __pyx_doc_6pygame_5_sdl2_5video_6Window_22set_icon},
18719   {"set_modal_for", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_25set_modal_for, METH_O, __pyx_doc_6pygame_5_sdl2_5video_6Window_24set_modal_for},
18720   {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_29__reduce_cython__, METH_NOARGS, 0},
18721   {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_6Window_31__setstate_cython__, METH_O, 0},
18722   {0, 0, 0, 0}
18723 };
18724 
18725 static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Window[] = {
18726   {(char *)"grab", __pyx_getprop_6pygame_5_sdl2_5video_6Window_grab, __pyx_setprop_6pygame_5_sdl2_5video_6Window_grab, (char *)" Window's input grab state (``True`` or ``False``).\n\n        Set it to ``True`` to grab, ``False`` to release.\n\n        When input is grabbed the mouse is confined to the window.\n        If the caller enables a grab while another window is currently grabbed,\n        the other window loses its grab in favor of the caller's window.\n\n        :rtype: bool\n        ", 0},
18727   {(char *)"relative_mouse", __pyx_getprop_6pygame_5_sdl2_5video_6Window_relative_mouse, __pyx_setprop_6pygame_5_sdl2_5video_6Window_relative_mouse, (char *)" Window's relative mouse motion state (``True`` or ``False``).\n\n        Set it to ``True`` to enable, ``False`` to disable.\n        If mouse.set_visible(True) is set the input will be grabbed,\n        and the mouse will enter endless relative motion mode.\n\n        :rtype: bool\n        ", 0},
18728   {(char *)"title", __pyx_getprop_6pygame_5_sdl2_5video_6Window_title, __pyx_setprop_6pygame_5_sdl2_5video_6Window_title, (char *)" The title of the window or u\"\" if there is none.\n        ", 0},
18729   {(char *)"resizable", __pyx_getprop_6pygame_5_sdl2_5video_6Window_resizable, __pyx_setprop_6pygame_5_sdl2_5video_6Window_resizable, (char *)" Sets whether the window is resizable.\n        ", 0},
18730   {(char *)"borderless", __pyx_getprop_6pygame_5_sdl2_5video_6Window_borderless, __pyx_setprop_6pygame_5_sdl2_5video_6Window_borderless, (char *)" Add or remove the border from the actual window.\n\n        .. note:: You can't change the border state of a fullscreen window.\n        ", 0},
18731   {(char *)"id", __pyx_getprop_6pygame_5_sdl2_5video_6Window_id, 0, (char *)" A unique window ID. *Read-only*.\n\n        :rtype: int\n        ", 0},
18732   {(char *)"size", __pyx_getprop_6pygame_5_sdl2_5video_6Window_size, __pyx_setprop_6pygame_5_sdl2_5video_6Window_size, (char *)" The size of the window's client area.", 0},
18733   {(char *)"position", __pyx_getprop_6pygame_5_sdl2_5video_6Window_position, __pyx_setprop_6pygame_5_sdl2_5video_6Window_position, (char *)" Window's screen coordinates, or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED", 0},
18734   {(char *)"opacity", __pyx_getprop_6pygame_5_sdl2_5video_6Window_opacity, __pyx_setprop_6pygame_5_sdl2_5video_6Window_opacity, (char *)" Window opacity. It ranges between 0.0 (fully transparent)\n        and 1.0 (fully opaque).", 0},
18735   {(char *)"brightness", __pyx_getprop_6pygame_5_sdl2_5video_6Window_brightness, __pyx_setprop_6pygame_5_sdl2_5video_6Window_brightness, (char *)" The brightness (gamma multiplier) for the display that owns a given window.\n        0.0 is completely dark and 1.0 is normal brightness.", 0},
18736   {(char *)"display_index", __pyx_getprop_6pygame_5_sdl2_5video_6Window_display_index, 0, (char *)" The index of the display associated with the window. *Read-only*.\n\n        :rtype: int\n        ", 0},
18737   {0, 0, 0, 0, 0}
18738 };
18739 
18740 static PyTypeObject __pyx_type_6pygame_5_sdl2_5video_Window = {
18741   PyVarObject_HEAD_INIT(0, 0)
18742   "pygame._sdl2.video.Window", /*tp_name*/
18743   sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Window), /*tp_basicsize*/
18744   0, /*tp_itemsize*/
18745   __pyx_tp_dealloc_6pygame_5_sdl2_5video_Window, /*tp_dealloc*/
18746   #if PY_VERSION_HEX < 0x030800b4
18747   0, /*tp_print*/
18748   #endif
18749   #if PY_VERSION_HEX >= 0x030800b4
18750   0, /*tp_vectorcall_offset*/
18751   #endif
18752   0, /*tp_getattr*/
18753   0, /*tp_setattr*/
18754   #if PY_MAJOR_VERSION < 3
18755   0, /*tp_compare*/
18756   #endif
18757   #if PY_MAJOR_VERSION >= 3
18758   0, /*tp_as_async*/
18759   #endif
18760   0, /*tp_repr*/
18761   0, /*tp_as_number*/
18762   0, /*tp_as_sequence*/
18763   0, /*tp_as_mapping*/
18764   0, /*tp_hash*/
18765   0, /*tp_call*/
18766   0, /*tp_str*/
18767   0, /*tp_getattro*/
18768   0, /*tp_setattro*/
18769   0, /*tp_as_buffer*/
18770   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
18771   0, /*tp_doc*/
18772   0, /*tp_traverse*/
18773   0, /*tp_clear*/
18774   0, /*tp_richcompare*/
18775   0, /*tp_weaklistoffset*/
18776   0, /*tp_iter*/
18777   0, /*tp_iternext*/
18778   __pyx_methods_6pygame_5_sdl2_5video_Window, /*tp_methods*/
18779   0, /*tp_members*/
18780   __pyx_getsets_6pygame_5_sdl2_5video_Window, /*tp_getset*/
18781   0, /*tp_base*/
18782   0, /*tp_dict*/
18783   0, /*tp_descr_get*/
18784   0, /*tp_descr_set*/
18785   0, /*tp_dictoffset*/
18786   __pyx_pw_6pygame_5_sdl2_5video_6Window_3__init__, /*tp_init*/
18787   0, /*tp_alloc*/
18788   __pyx_tp_new_6pygame_5_sdl2_5video_Window, /*tp_new*/
18789   0, /*tp_free*/
18790   0, /*tp_is_gc*/
18791   0, /*tp_bases*/
18792   0, /*tp_mro*/
18793   0, /*tp_cache*/
18794   0, /*tp_subclasses*/
18795   0, /*tp_weaklist*/
18796   0, /*tp_del*/
18797   0, /*tp_version_tag*/
18798   #if PY_VERSION_HEX >= 0x030400a1
18799   0, /*tp_finalize*/
18800   #endif
18801   #if PY_VERSION_HEX >= 0x030800b1
18802   0, /*tp_vectorcall*/
18803   #endif
18804   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18805   0, /*tp_print*/
18806   #endif
18807 };
18808 static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Renderer __pyx_vtable_6pygame_5_sdl2_5video_Renderer;
18809 
__pyx_tp_new_6pygame_5_sdl2_5video_Renderer(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)18810 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Renderer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18811   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *p;
18812   PyObject *o;
18813   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18814     o = (*t->tp_alloc)(t, 0);
18815   } else {
18816     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18817   }
18818   if (unlikely(!o)) return 0;
18819   p = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)o);
18820   p->__pyx_vtab = __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer;
18821   p->_draw_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
18822   p->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None); Py_INCREF(Py_None);
18823   p->_win = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)Py_None); Py_INCREF(Py_None);
18824   return o;
18825 }
18826 
__pyx_tp_dealloc_6pygame_5_sdl2_5video_Renderer(PyObject * o)18827 static void __pyx_tp_dealloc_6pygame_5_sdl2_5video_Renderer(PyObject *o) {
18828   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)o;
18829   #if CYTHON_USE_TP_FINALIZE
18830   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18831     if (PyObject_CallFinalizerFromDealloc(o)) return;
18832   }
18833   #endif
18834   PyObject_GC_UnTrack(o);
18835   {
18836     PyObject *etype, *eval, *etb;
18837     PyErr_Fetch(&etype, &eval, &etb);
18838     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18839     __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5__dealloc__(o);
18840     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18841     PyErr_Restore(etype, eval, etb);
18842   }
18843   Py_CLEAR(p->_draw_color);
18844   Py_CLEAR(p->_target);
18845   Py_CLEAR(p->_win);
18846   (*Py_TYPE(o)->tp_free)(o);
18847 }
18848 
__pyx_tp_traverse_6pygame_5_sdl2_5video_Renderer(PyObject * o,visitproc v,void * a)18849 static int __pyx_tp_traverse_6pygame_5_sdl2_5video_Renderer(PyObject *o, visitproc v, void *a) {
18850   int e;
18851   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)o;
18852   if (p->_draw_color) {
18853     e = (*v)(((PyObject *)p->_draw_color), a); if (e) return e;
18854   }
18855   if (p->_target) {
18856     e = (*v)(((PyObject *)p->_target), a); if (e) return e;
18857   }
18858   if (p->_win) {
18859     e = (*v)(((PyObject *)p->_win), a); if (e) return e;
18860   }
18861   return 0;
18862 }
18863 
__pyx_tp_clear_6pygame_5_sdl2_5video_Renderer(PyObject * o)18864 static int __pyx_tp_clear_6pygame_5_sdl2_5video_Renderer(PyObject *o) {
18865   PyObject* tmp;
18866   struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)o;
18867   tmp = ((PyObject*)p->_draw_color);
18868   p->_draw_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
18869   Py_XDECREF(tmp);
18870   tmp = ((PyObject*)p->_target);
18871   p->_target = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None); Py_INCREF(Py_None);
18872   Py_XDECREF(tmp);
18873   tmp = ((PyObject*)p->_win);
18874   p->_win = ((struct __pyx_obj_6pygame_5_sdl2_5video_Window *)Py_None); Py_INCREF(Py_None);
18875   Py_XDECREF(tmp);
18876   return 0;
18877 }
18878 
__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode(PyObject * o,CYTHON_UNUSED void * x)18879 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode(PyObject *o, CYTHON_UNUSED void *x) {
18880   return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_1__get__(o);
18881 }
18882 
__pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18883 static int __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18884   if (v) {
18885     return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_15draw_blend_mode_3__set__(o, v);
18886   }
18887   else {
18888     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18889     return -1;
18890   }
18891 }
18892 
__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_color(PyObject * o,CYTHON_UNUSED void * x)18893 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_color(PyObject *o, CYTHON_UNUSED void *x) {
18894   return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_1__get__(o);
18895 }
18896 
__pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_color(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18897 static int __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_color(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18898   if (v) {
18899     return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_10draw_color_3__set__(o, v);
18900   }
18901   else {
18902     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18903     return -1;
18904   }
18905 }
18906 
__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_logical_size(PyObject * o,CYTHON_UNUSED void * x)18907 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_logical_size(PyObject *o, CYTHON_UNUSED void *x) {
18908   return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_1__get__(o);
18909 }
18910 
__pyx_setprop_6pygame_5_sdl2_5video_8Renderer_logical_size(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18911 static int __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_logical_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18912   if (v) {
18913     return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_12logical_size_3__set__(o, v);
18914   }
18915   else {
18916     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18917     return -1;
18918   }
18919 }
18920 
__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_scale(PyObject * o,CYTHON_UNUSED void * x)18921 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_scale(PyObject *o, CYTHON_UNUSED void *x) {
18922   return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_1__get__(o);
18923 }
18924 
__pyx_setprop_6pygame_5_sdl2_5video_8Renderer_scale(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18925 static int __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_scale(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18926   if (v) {
18927     return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_5scale_3__set__(o, v);
18928   }
18929   else {
18930     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18931     return -1;
18932   }
18933 }
18934 
__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_target(PyObject * o,CYTHON_UNUSED void * x)18935 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_8Renderer_target(PyObject *o, CYTHON_UNUSED void *x) {
18936   return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_1__get__(o);
18937 }
18938 
__pyx_setprop_6pygame_5_sdl2_5video_8Renderer_target(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)18939 static int __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_target(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
18940   if (v) {
18941     return __pyx_pw_6pygame_5_sdl2_5video_8Renderer_6target_3__set__(o, v);
18942   }
18943   else {
18944     PyErr_SetString(PyExc_NotImplementedError, "__del__");
18945     return -1;
18946   }
18947 }
18948 
18949 static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Renderer[] = {
18950   {"from_window", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_1from_window, METH_O, 0},
18951   {"clear", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_7clear, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_6clear},
18952   {"present", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_9present, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_8present},
18953   {"get_viewport", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_11get_viewport, METH_NOARGS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_10get_viewport},
18954   {"set_viewport", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_13set_viewport, METH_O, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_12set_viewport},
18955   {"blit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_15blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_14blit},
18956   {"draw_line", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_17draw_line, METH_VARARGS|METH_KEYWORDS, 0},
18957   {"draw_point", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_19draw_point, METH_O, 0},
18958   {"draw_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_21draw_rect, METH_O, 0},
18959   {"fill_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_23fill_rect, METH_O, 0},
18960   {"to_surface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_25to_surface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_8Renderer_24to_surface},
18961   {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_27__reduce_cython__, METH_NOARGS, 0},
18962   {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_8Renderer_29__setstate_cython__, METH_O, 0},
18963   {0, 0, 0, 0}
18964 };
18965 
18966 static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Renderer[] = {
18967   {(char *)"draw_blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_blend_mode, (char *)0, 0},
18968   {(char *)"draw_color", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_draw_color, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_draw_color, (char *)" Color used by the drawing functions.\n        ", 0},
18969   {(char *)"logical_size", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_logical_size, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_logical_size, (char *)0, 0},
18970   {(char *)"scale", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_scale, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_scale, (char *)0, 0},
18971   {(char *)"target", __pyx_getprop_6pygame_5_sdl2_5video_8Renderer_target, __pyx_setprop_6pygame_5_sdl2_5video_8Renderer_target, (char *)" The current render target. Set to ``None`` for the default target.\n\n        :rtype: Texture, None\n        ", 0},
18972   {0, 0, 0, 0, 0}
18973 };
18974 
18975 static PyTypeObject __pyx_type_6pygame_5_sdl2_5video_Renderer = {
18976   PyVarObject_HEAD_INIT(0, 0)
18977   "pygame._sdl2.video.Renderer", /*tp_name*/
18978   sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer), /*tp_basicsize*/
18979   0, /*tp_itemsize*/
18980   __pyx_tp_dealloc_6pygame_5_sdl2_5video_Renderer, /*tp_dealloc*/
18981   #if PY_VERSION_HEX < 0x030800b4
18982   0, /*tp_print*/
18983   #endif
18984   #if PY_VERSION_HEX >= 0x030800b4
18985   0, /*tp_vectorcall_offset*/
18986   #endif
18987   0, /*tp_getattr*/
18988   0, /*tp_setattr*/
18989   #if PY_MAJOR_VERSION < 3
18990   0, /*tp_compare*/
18991   #endif
18992   #if PY_MAJOR_VERSION >= 3
18993   0, /*tp_as_async*/
18994   #endif
18995   0, /*tp_repr*/
18996   0, /*tp_as_number*/
18997   0, /*tp_as_sequence*/
18998   0, /*tp_as_mapping*/
18999   0, /*tp_hash*/
19000   0, /*tp_call*/
19001   0, /*tp_str*/
19002   0, /*tp_getattro*/
19003   0, /*tp_setattro*/
19004   0, /*tp_as_buffer*/
19005   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19006   0, /*tp_doc*/
19007   __pyx_tp_traverse_6pygame_5_sdl2_5video_Renderer, /*tp_traverse*/
19008   __pyx_tp_clear_6pygame_5_sdl2_5video_Renderer, /*tp_clear*/
19009   0, /*tp_richcompare*/
19010   0, /*tp_weaklistoffset*/
19011   0, /*tp_iter*/
19012   0, /*tp_iternext*/
19013   __pyx_methods_6pygame_5_sdl2_5video_Renderer, /*tp_methods*/
19014   0, /*tp_members*/
19015   __pyx_getsets_6pygame_5_sdl2_5video_Renderer, /*tp_getset*/
19016   0, /*tp_base*/
19017   0, /*tp_dict*/
19018   0, /*tp_descr_get*/
19019   0, /*tp_descr_set*/
19020   0, /*tp_dictoffset*/
19021   __pyx_pw_6pygame_5_sdl2_5video_8Renderer_3__init__, /*tp_init*/
19022   0, /*tp_alloc*/
19023   __pyx_tp_new_6pygame_5_sdl2_5video_Renderer, /*tp_new*/
19024   0, /*tp_free*/
19025   0, /*tp_is_gc*/
19026   0, /*tp_bases*/
19027   0, /*tp_mro*/
19028   0, /*tp_cache*/
19029   0, /*tp_subclasses*/
19030   0, /*tp_weaklist*/
19031   0, /*tp_del*/
19032   0, /*tp_version_tag*/
19033   #if PY_VERSION_HEX >= 0x030400a1
19034   0, /*tp_finalize*/
19035   #endif
19036   #if PY_VERSION_HEX >= 0x030800b1
19037   0, /*tp_vectorcall*/
19038   #endif
19039   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19040   0, /*tp_print*/
19041   #endif
19042 };
19043 static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Texture __pyx_vtable_6pygame_5_sdl2_5video_Texture;
19044 
__pyx_tp_new_6pygame_5_sdl2_5video_Texture(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)19045 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Texture(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
19046   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *p;
19047   PyObject *o;
19048   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19049     o = (*t->tp_alloc)(t, 0);
19050   } else {
19051     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19052   }
19053   if (unlikely(!o)) return 0;
19054   p = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)o);
19055   p->__pyx_vtab = __pyx_vtabptr_6pygame_5_sdl2_5video_Texture;
19056   p->_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
19057   p->renderer = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)Py_None); Py_INCREF(Py_None);
19058   if (unlikely(__pyx_pw_6pygame_5_sdl2_5video_7Texture_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
19059   return o;
19060   bad:
19061   Py_DECREF(o); o = 0;
19062   return NULL;
19063 }
19064 
__pyx_tp_dealloc_6pygame_5_sdl2_5video_Texture(PyObject * o)19065 static void __pyx_tp_dealloc_6pygame_5_sdl2_5video_Texture(PyObject *o) {
19066   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)o;
19067   #if CYTHON_USE_TP_FINALIZE
19068   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19069     if (PyObject_CallFinalizerFromDealloc(o)) return;
19070   }
19071   #endif
19072   PyObject_GC_UnTrack(o);
19073   {
19074     PyObject *etype, *eval, *etb;
19075     PyErr_Fetch(&etype, &eval, &etb);
19076     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
19077     __pyx_pw_6pygame_5_sdl2_5video_7Texture_7__dealloc__(o);
19078     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
19079     PyErr_Restore(etype, eval, etb);
19080   }
19081   Py_CLEAR(p->_color);
19082   Py_CLEAR(p->renderer);
19083   (*Py_TYPE(o)->tp_free)(o);
19084 }
19085 
__pyx_tp_traverse_6pygame_5_sdl2_5video_Texture(PyObject * o,visitproc v,void * a)19086 static int __pyx_tp_traverse_6pygame_5_sdl2_5video_Texture(PyObject *o, visitproc v, void *a) {
19087   int e;
19088   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)o;
19089   if (p->_color) {
19090     e = (*v)(((PyObject *)p->_color), a); if (e) return e;
19091   }
19092   if (p->renderer) {
19093     e = (*v)(((PyObject *)p->renderer), a); if (e) return e;
19094   }
19095   return 0;
19096 }
19097 
__pyx_tp_clear_6pygame_5_sdl2_5video_Texture(PyObject * o)19098 static int __pyx_tp_clear_6pygame_5_sdl2_5video_Texture(PyObject *o) {
19099   PyObject* tmp;
19100   struct __pyx_obj_6pygame_5_sdl2_5video_Texture *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)o;
19101   tmp = ((PyObject*)p->_color);
19102   p->_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
19103   Py_XDECREF(tmp);
19104   tmp = ((PyObject*)p->renderer);
19105   p->renderer = ((struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *)Py_None); Py_INCREF(Py_None);
19106   Py_XDECREF(tmp);
19107   return 0;
19108 }
19109 
__pyx_getprop_6pygame_5_sdl2_5video_7Texture_alpha(PyObject * o,CYTHON_UNUSED void * x)19110 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7Texture_alpha(PyObject *o, CYTHON_UNUSED void *x) {
19111   return __pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_1__get__(o);
19112 }
19113 
__pyx_setprop_6pygame_5_sdl2_5video_7Texture_alpha(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19114 static int __pyx_setprop_6pygame_5_sdl2_5video_7Texture_alpha(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19115   if (v) {
19116     return __pyx_pw_6pygame_5_sdl2_5video_7Texture_5alpha_3__set__(o, v);
19117   }
19118   else {
19119     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19120     return -1;
19121   }
19122 }
19123 
__pyx_getprop_6pygame_5_sdl2_5video_7Texture_blend_mode(PyObject * o,CYTHON_UNUSED void * x)19124 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7Texture_blend_mode(PyObject *o, CYTHON_UNUSED void *x) {
19125   return __pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_1__get__(o);
19126 }
19127 
__pyx_setprop_6pygame_5_sdl2_5video_7Texture_blend_mode(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19128 static int __pyx_setprop_6pygame_5_sdl2_5video_7Texture_blend_mode(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19129   if (v) {
19130     return __pyx_pw_6pygame_5_sdl2_5video_7Texture_10blend_mode_3__set__(o, v);
19131   }
19132   else {
19133     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19134     return -1;
19135   }
19136 }
19137 
__pyx_getprop_6pygame_5_sdl2_5video_7Texture_color(PyObject * o,CYTHON_UNUSED void * x)19138 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7Texture_color(PyObject *o, CYTHON_UNUSED void *x) {
19139   return __pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_1__get__(o);
19140 }
19141 
__pyx_setprop_6pygame_5_sdl2_5video_7Texture_color(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19142 static int __pyx_setprop_6pygame_5_sdl2_5video_7Texture_color(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19143   if (v) {
19144     return __pyx_pw_6pygame_5_sdl2_5video_7Texture_5color_3__set__(o, v);
19145   }
19146   else {
19147     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19148     return -1;
19149   }
19150 }
19151 
__pyx_getprop_6pygame_5_sdl2_5video_7Texture_renderer(PyObject * o,CYTHON_UNUSED void * x)19152 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7Texture_renderer(PyObject *o, CYTHON_UNUSED void *x) {
19153   return __pyx_pw_6pygame_5_sdl2_5video_7Texture_8renderer_1__get__(o);
19154 }
19155 
__pyx_getprop_6pygame_5_sdl2_5video_7Texture_width(PyObject * o,CYTHON_UNUSED void * x)19156 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7Texture_width(PyObject *o, CYTHON_UNUSED void *x) {
19157   return __pyx_pw_6pygame_5_sdl2_5video_7Texture_5width_1__get__(o);
19158 }
19159 
__pyx_getprop_6pygame_5_sdl2_5video_7Texture_height(PyObject * o,CYTHON_UNUSED void * x)19160 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_7Texture_height(PyObject *o, CYTHON_UNUSED void *x) {
19161   return __pyx_pw_6pygame_5_sdl2_5video_7Texture_6height_1__get__(o);
19162 }
19163 
19164 static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Texture[] = {
19165   {"from_surface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7Texture_5from_surface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7Texture_4from_surface},
19166   {"get_rect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7Texture_9get_rect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7Texture_8get_rect},
19167   {"draw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7Texture_11draw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7Texture_10draw},
19168   {"update", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_7Texture_13update, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_7Texture_12update},
19169   {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7Texture_15__reduce_cython__, METH_NOARGS, 0},
19170   {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_7Texture_17__setstate_cython__, METH_O, 0},
19171   {0, 0, 0, 0}
19172 };
19173 
19174 static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Texture[] = {
19175   {(char *)"alpha", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_alpha, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_alpha, (char *)0, 0},
19176   {(char *)"blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_blend_mode, (char *)0, 0},
19177   {(char *)"color", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_color, __pyx_setprop_6pygame_5_sdl2_5video_7Texture_color, (char *)0, 0},
19178   {(char *)"renderer", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_renderer, 0, (char *)0, 0},
19179   {(char *)"width", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_width, 0, (char *)0, 0},
19180   {(char *)"height", __pyx_getprop_6pygame_5_sdl2_5video_7Texture_height, 0, (char *)0, 0},
19181   {0, 0, 0, 0, 0}
19182 };
19183 
19184 static PyTypeObject __pyx_type_6pygame_5_sdl2_5video_Texture = {
19185   PyVarObject_HEAD_INIT(0, 0)
19186   "pygame._sdl2.video.Texture", /*tp_name*/
19187   sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Texture), /*tp_basicsize*/
19188   0, /*tp_itemsize*/
19189   __pyx_tp_dealloc_6pygame_5_sdl2_5video_Texture, /*tp_dealloc*/
19190   #if PY_VERSION_HEX < 0x030800b4
19191   0, /*tp_print*/
19192   #endif
19193   #if PY_VERSION_HEX >= 0x030800b4
19194   0, /*tp_vectorcall_offset*/
19195   #endif
19196   0, /*tp_getattr*/
19197   0, /*tp_setattr*/
19198   #if PY_MAJOR_VERSION < 3
19199   0, /*tp_compare*/
19200   #endif
19201   #if PY_MAJOR_VERSION >= 3
19202   0, /*tp_as_async*/
19203   #endif
19204   0, /*tp_repr*/
19205   0, /*tp_as_number*/
19206   0, /*tp_as_sequence*/
19207   0, /*tp_as_mapping*/
19208   0, /*tp_hash*/
19209   0, /*tp_call*/
19210   0, /*tp_str*/
19211   0, /*tp_getattro*/
19212   0, /*tp_setattro*/
19213   0, /*tp_as_buffer*/
19214   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19215   0, /*tp_doc*/
19216   __pyx_tp_traverse_6pygame_5_sdl2_5video_Texture, /*tp_traverse*/
19217   __pyx_tp_clear_6pygame_5_sdl2_5video_Texture, /*tp_clear*/
19218   0, /*tp_richcompare*/
19219   0, /*tp_weaklistoffset*/
19220   0, /*tp_iter*/
19221   0, /*tp_iternext*/
19222   __pyx_methods_6pygame_5_sdl2_5video_Texture, /*tp_methods*/
19223   0, /*tp_members*/
19224   __pyx_getsets_6pygame_5_sdl2_5video_Texture, /*tp_getset*/
19225   0, /*tp_base*/
19226   0, /*tp_dict*/
19227   0, /*tp_descr_get*/
19228   0, /*tp_descr_set*/
19229   0, /*tp_dictoffset*/
19230   __pyx_pw_6pygame_5_sdl2_5video_7Texture_3__init__, /*tp_init*/
19231   0, /*tp_alloc*/
19232   __pyx_tp_new_6pygame_5_sdl2_5video_Texture, /*tp_new*/
19233   0, /*tp_free*/
19234   0, /*tp_is_gc*/
19235   0, /*tp_bases*/
19236   0, /*tp_mro*/
19237   0, /*tp_cache*/
19238   0, /*tp_subclasses*/
19239   0, /*tp_weaklist*/
19240   0, /*tp_del*/
19241   0, /*tp_version_tag*/
19242   #if PY_VERSION_HEX >= 0x030400a1
19243   0, /*tp_finalize*/
19244   #endif
19245   #if PY_VERSION_HEX >= 0x030800b1
19246   0, /*tp_vectorcall*/
19247   #endif
19248   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19249   0, /*tp_print*/
19250   #endif
19251 };
19252 static struct __pyx_vtabstruct_6pygame_5_sdl2_5video_Image __pyx_vtable_6pygame_5_sdl2_5video_Image;
19253 
__pyx_tp_new_6pygame_5_sdl2_5video_Image(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)19254 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video_Image(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
19255   struct __pyx_obj_6pygame_5_sdl2_5video_Image *p;
19256   PyObject *o;
19257   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19258     o = (*t->tp_alloc)(t, 0);
19259   } else {
19260     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19261   }
19262   if (unlikely(!o)) return 0;
19263   p = ((struct __pyx_obj_6pygame_5_sdl2_5video_Image *)o);
19264   p->__pyx_vtab = __pyx_vtabptr_6pygame_5_sdl2_5video_Image;
19265   p->_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
19266   p->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None); Py_INCREF(Py_None);
19267   p->srcrect = ((pgRectObject *)Py_None); Py_INCREF(Py_None);
19268   if (unlikely(__pyx_pw_6pygame_5_sdl2_5video_5Image_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
19269   return o;
19270   bad:
19271   Py_DECREF(o); o = 0;
19272   return NULL;
19273 }
19274 
__pyx_tp_dealloc_6pygame_5_sdl2_5video_Image(PyObject * o)19275 static void __pyx_tp_dealloc_6pygame_5_sdl2_5video_Image(PyObject *o) {
19276   struct __pyx_obj_6pygame_5_sdl2_5video_Image *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Image *)o;
19277   #if CYTHON_USE_TP_FINALIZE
19278   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19279     if (PyObject_CallFinalizerFromDealloc(o)) return;
19280   }
19281   #endif
19282   PyObject_GC_UnTrack(o);
19283   Py_CLEAR(p->_color);
19284   Py_CLEAR(p->texture);
19285   Py_CLEAR(p->srcrect);
19286   (*Py_TYPE(o)->tp_free)(o);
19287 }
19288 
__pyx_tp_traverse_6pygame_5_sdl2_5video_Image(PyObject * o,visitproc v,void * a)19289 static int __pyx_tp_traverse_6pygame_5_sdl2_5video_Image(PyObject *o, visitproc v, void *a) {
19290   int e;
19291   struct __pyx_obj_6pygame_5_sdl2_5video_Image *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Image *)o;
19292   if (p->_color) {
19293     e = (*v)(((PyObject *)p->_color), a); if (e) return e;
19294   }
19295   if (p->texture) {
19296     e = (*v)(((PyObject *)p->texture), a); if (e) return e;
19297   }
19298   if (p->srcrect) {
19299     e = (*v)(((PyObject *)p->srcrect), a); if (e) return e;
19300   }
19301   return 0;
19302 }
19303 
__pyx_tp_clear_6pygame_5_sdl2_5video_Image(PyObject * o)19304 static int __pyx_tp_clear_6pygame_5_sdl2_5video_Image(PyObject *o) {
19305   PyObject* tmp;
19306   struct __pyx_obj_6pygame_5_sdl2_5video_Image *p = (struct __pyx_obj_6pygame_5_sdl2_5video_Image *)o;
19307   tmp = ((PyObject*)p->_color);
19308   p->_color = ((pgColorObject *)Py_None); Py_INCREF(Py_None);
19309   Py_XDECREF(tmp);
19310   tmp = ((PyObject*)p->texture);
19311   p->texture = ((struct __pyx_obj_6pygame_5_sdl2_5video_Texture *)Py_None); Py_INCREF(Py_None);
19312   Py_XDECREF(tmp);
19313   tmp = ((PyObject*)p->srcrect);
19314   p->srcrect = ((pgRectObject *)Py_None); Py_INCREF(Py_None);
19315   Py_XDECREF(tmp);
19316   return 0;
19317 }
19318 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_color(PyObject * o,CYTHON_UNUSED void * x)19319 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_color(PyObject *o, CYTHON_UNUSED void *x) {
19320   return __pyx_pw_6pygame_5_sdl2_5video_5Image_5color_1__get__(o);
19321 }
19322 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_color(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19323 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_color(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19324   if (v) {
19325     return __pyx_pw_6pygame_5_sdl2_5video_5Image_5color_3__set__(o, v);
19326   }
19327   else {
19328     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19329     return -1;
19330   }
19331 }
19332 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_origin(PyObject * o,CYTHON_UNUSED void * x)19333 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_origin(PyObject *o, CYTHON_UNUSED void *x) {
19334   return __pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_1__get__(o);
19335 }
19336 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_origin(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19337 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_origin(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19338   if (v) {
19339     return __pyx_pw_6pygame_5_sdl2_5video_5Image_6origin_3__set__(o, v);
19340   }
19341   else {
19342     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19343     return -1;
19344   }
19345 }
19346 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_angle(PyObject * o,CYTHON_UNUSED void * x)19347 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_angle(PyObject *o, CYTHON_UNUSED void *x) {
19348   return __pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_1__get__(o);
19349 }
19350 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_angle(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19351 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_angle(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19352   if (v) {
19353     return __pyx_pw_6pygame_5_sdl2_5video_5Image_5angle_3__set__(o, v);
19354   }
19355   else {
19356     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19357     return -1;
19358   }
19359 }
19360 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_flipX(PyObject * o,CYTHON_UNUSED void * x)19361 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_flipX(PyObject *o, CYTHON_UNUSED void *x) {
19362   return __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_1__get__(o);
19363 }
19364 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_flipX(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19365 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_flipX(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19366   if (v) {
19367     return __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipX_3__set__(o, v);
19368   }
19369   else {
19370     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19371     return -1;
19372   }
19373 }
19374 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_flipY(PyObject * o,CYTHON_UNUSED void * x)19375 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_flipY(PyObject *o, CYTHON_UNUSED void *x) {
19376   return __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_1__get__(o);
19377 }
19378 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_flipY(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19379 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_flipY(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19380   if (v) {
19381     return __pyx_pw_6pygame_5_sdl2_5video_5Image_5flipY_3__set__(o, v);
19382   }
19383   else {
19384     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19385     return -1;
19386   }
19387 }
19388 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_alpha(PyObject * o,CYTHON_UNUSED void * x)19389 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_alpha(PyObject *o, CYTHON_UNUSED void *x) {
19390   return __pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_1__get__(o);
19391 }
19392 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_alpha(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19393 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_alpha(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19394   if (v) {
19395     return __pyx_pw_6pygame_5_sdl2_5video_5Image_5alpha_3__set__(o, v);
19396   }
19397   else {
19398     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19399     return -1;
19400   }
19401 }
19402 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_blend_mode(PyObject * o,CYTHON_UNUSED void * x)19403 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_blend_mode(PyObject *o, CYTHON_UNUSED void *x) {
19404   return __pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_1__get__(o);
19405 }
19406 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_blend_mode(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19407 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_blend_mode(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19408   if (v) {
19409     return __pyx_pw_6pygame_5_sdl2_5video_5Image_10blend_mode_3__set__(o, v);
19410   }
19411   else {
19412     PyErr_SetString(PyExc_NotImplementedError, "__del__");
19413     return -1;
19414   }
19415 }
19416 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_texture(PyObject * o,CYTHON_UNUSED void * x)19417 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_texture(PyObject *o, CYTHON_UNUSED void *x) {
19418   return __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_1__get__(o);
19419 }
19420 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_texture(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19421 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_texture(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19422   if (v) {
19423     return __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_3__set__(o, v);
19424   }
19425   else {
19426     return __pyx_pw_6pygame_5_sdl2_5video_5Image_7texture_5__del__(o);
19427   }
19428 }
19429 
__pyx_getprop_6pygame_5_sdl2_5video_5Image_srcrect(PyObject * o,CYTHON_UNUSED void * x)19430 static PyObject *__pyx_getprop_6pygame_5_sdl2_5video_5Image_srcrect(PyObject *o, CYTHON_UNUSED void *x) {
19431   return __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_1__get__(o);
19432 }
19433 
__pyx_setprop_6pygame_5_sdl2_5video_5Image_srcrect(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)19434 static int __pyx_setprop_6pygame_5_sdl2_5video_5Image_srcrect(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
19435   if (v) {
19436     return __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_3__set__(o, v);
19437   }
19438   else {
19439     return __pyx_pw_6pygame_5_sdl2_5video_5Image_7srcrect_5__del__(o);
19440   }
19441 }
19442 
19443 static PyMethodDef __pyx_methods_6pygame_5_sdl2_5video_Image[] = {
19444   {"get_rect", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_5get_rect, METH_NOARGS, 0},
19445   {"draw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_5_sdl2_5video_5Image_7draw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_5_sdl2_5video_5Image_6draw},
19446   {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_9__reduce_cython__, METH_NOARGS, 0},
19447   {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_5_sdl2_5video_5Image_11__setstate_cython__, METH_O, 0},
19448   {0, 0, 0, 0}
19449 };
19450 
19451 static struct PyGetSetDef __pyx_getsets_6pygame_5_sdl2_5video_Image[] = {
19452   {(char *)"color", __pyx_getprop_6pygame_5_sdl2_5video_5Image_color, __pyx_setprop_6pygame_5_sdl2_5video_5Image_color, (char *)0, 0},
19453   {(char *)"origin", __pyx_getprop_6pygame_5_sdl2_5video_5Image_origin, __pyx_setprop_6pygame_5_sdl2_5video_5Image_origin, (char *)0, 0},
19454   {(char *)"angle", __pyx_getprop_6pygame_5_sdl2_5video_5Image_angle, __pyx_setprop_6pygame_5_sdl2_5video_5Image_angle, (char *)0, 0},
19455   {(char *)"flipX", __pyx_getprop_6pygame_5_sdl2_5video_5Image_flipX, __pyx_setprop_6pygame_5_sdl2_5video_5Image_flipX, (char *)0, 0},
19456   {(char *)"flipY", __pyx_getprop_6pygame_5_sdl2_5video_5Image_flipY, __pyx_setprop_6pygame_5_sdl2_5video_5Image_flipY, (char *)0, 0},
19457   {(char *)"alpha", __pyx_getprop_6pygame_5_sdl2_5video_5Image_alpha, __pyx_setprop_6pygame_5_sdl2_5video_5Image_alpha, (char *)0, 0},
19458   {(char *)"blend_mode", __pyx_getprop_6pygame_5_sdl2_5video_5Image_blend_mode, __pyx_setprop_6pygame_5_sdl2_5video_5Image_blend_mode, (char *)0, 0},
19459   {(char *)"texture", __pyx_getprop_6pygame_5_sdl2_5video_5Image_texture, __pyx_setprop_6pygame_5_sdl2_5video_5Image_texture, (char *)0, 0},
19460   {(char *)"srcrect", __pyx_getprop_6pygame_5_sdl2_5video_5Image_srcrect, __pyx_setprop_6pygame_5_sdl2_5video_5Image_srcrect, (char *)0, 0},
19461   {0, 0, 0, 0, 0}
19462 };
19463 
19464 static PyTypeObject __pyx_type_6pygame_5_sdl2_5video_Image = {
19465   PyVarObject_HEAD_INIT(0, 0)
19466   "pygame._sdl2.video.Image", /*tp_name*/
19467   sizeof(struct __pyx_obj_6pygame_5_sdl2_5video_Image), /*tp_basicsize*/
19468   0, /*tp_itemsize*/
19469   __pyx_tp_dealloc_6pygame_5_sdl2_5video_Image, /*tp_dealloc*/
19470   #if PY_VERSION_HEX < 0x030800b4
19471   0, /*tp_print*/
19472   #endif
19473   #if PY_VERSION_HEX >= 0x030800b4
19474   0, /*tp_vectorcall_offset*/
19475   #endif
19476   0, /*tp_getattr*/
19477   0, /*tp_setattr*/
19478   #if PY_MAJOR_VERSION < 3
19479   0, /*tp_compare*/
19480   #endif
19481   #if PY_MAJOR_VERSION >= 3
19482   0, /*tp_as_async*/
19483   #endif
19484   0, /*tp_repr*/
19485   0, /*tp_as_number*/
19486   0, /*tp_as_sequence*/
19487   0, /*tp_as_mapping*/
19488   0, /*tp_hash*/
19489   0, /*tp_call*/
19490   0, /*tp_str*/
19491   0, /*tp_getattro*/
19492   0, /*tp_setattro*/
19493   0, /*tp_as_buffer*/
19494   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19495   0, /*tp_doc*/
19496   __pyx_tp_traverse_6pygame_5_sdl2_5video_Image, /*tp_traverse*/
19497   __pyx_tp_clear_6pygame_5_sdl2_5video_Image, /*tp_clear*/
19498   0, /*tp_richcompare*/
19499   0, /*tp_weaklistoffset*/
19500   0, /*tp_iter*/
19501   0, /*tp_iternext*/
19502   __pyx_methods_6pygame_5_sdl2_5video_Image, /*tp_methods*/
19503   0, /*tp_members*/
19504   __pyx_getsets_6pygame_5_sdl2_5video_Image, /*tp_getset*/
19505   0, /*tp_base*/
19506   0, /*tp_dict*/
19507   0, /*tp_descr_get*/
19508   0, /*tp_descr_set*/
19509   0, /*tp_dictoffset*/
19510   __pyx_pw_6pygame_5_sdl2_5video_5Image_3__init__, /*tp_init*/
19511   0, /*tp_alloc*/
19512   __pyx_tp_new_6pygame_5_sdl2_5video_Image, /*tp_new*/
19513   0, /*tp_free*/
19514   0, /*tp_is_gc*/
19515   0, /*tp_bases*/
19516   0, /*tp_mro*/
19517   0, /*tp_cache*/
19518   0, /*tp_subclasses*/
19519   0, /*tp_weaklist*/
19520   0, /*tp_del*/
19521   0, /*tp_version_tag*/
19522   #if PY_VERSION_HEX >= 0x030400a1
19523   0, /*tp_finalize*/
19524   #endif
19525   #if PY_VERSION_HEX >= 0x030800b1
19526   0, /*tp_vectorcall*/
19527   #endif
19528   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19529   0, /*tp_print*/
19530   #endif
19531 };
19532 
19533 static struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *__pyx_freelist_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers[8];
19534 static int __pyx_freecount_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers = 0;
19535 
__pyx_tp_new_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)19536 static PyObject *__pyx_tp_new_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
19537   PyObject *o;
19538   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers)))) {
19539     o = (PyObject*)__pyx_freelist_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers[--__pyx_freecount_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers];
19540     memset(o, 0, sizeof(struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers));
19541     (void) PyObject_INIT(o, t);
19542     PyObject_GC_Track(o);
19543   } else {
19544     o = (*t->tp_alloc)(t, 0);
19545     if (unlikely(!o)) return 0;
19546   }
19547   return o;
19548 }
19549 
__pyx_tp_dealloc_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyObject * o)19550 static void __pyx_tp_dealloc_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyObject *o) {
19551   struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *p = (struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)o;
19552   PyObject_GC_UnTrack(o);
19553   Py_CLEAR(p->__pyx_v_ret);
19554   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers)))) {
19555     __pyx_freelist_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers[__pyx_freecount_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers++] = ((struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)o);
19556   } else {
19557     (*Py_TYPE(o)->tp_free)(o);
19558   }
19559 }
19560 
__pyx_tp_traverse_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyObject * o,visitproc v,void * a)19561 static int __pyx_tp_traverse_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers(PyObject *o, visitproc v, void *a) {
19562   int e;
19563   struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *p = (struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers *)o;
19564   if (p->__pyx_v_ret) {
19565     e = (*v)(p->__pyx_v_ret, a); if (e) return e;
19566   }
19567   return 0;
19568 }
19569 
19570 static PyTypeObject __pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers = {
19571   PyVarObject_HEAD_INIT(0, 0)
19572   "pygame._sdl2.video.__pyx_scope_struct__get_drivers", /*tp_name*/
19573   sizeof(struct __pyx_obj_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers), /*tp_basicsize*/
19574   0, /*tp_itemsize*/
19575   __pyx_tp_dealloc_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers, /*tp_dealloc*/
19576   #if PY_VERSION_HEX < 0x030800b4
19577   0, /*tp_print*/
19578   #endif
19579   #if PY_VERSION_HEX >= 0x030800b4
19580   0, /*tp_vectorcall_offset*/
19581   #endif
19582   0, /*tp_getattr*/
19583   0, /*tp_setattr*/
19584   #if PY_MAJOR_VERSION < 3
19585   0, /*tp_compare*/
19586   #endif
19587   #if PY_MAJOR_VERSION >= 3
19588   0, /*tp_as_async*/
19589   #endif
19590   0, /*tp_repr*/
19591   0, /*tp_as_number*/
19592   0, /*tp_as_sequence*/
19593   0, /*tp_as_mapping*/
19594   0, /*tp_hash*/
19595   0, /*tp_call*/
19596   0, /*tp_str*/
19597   0, /*tp_getattro*/
19598   0, /*tp_setattro*/
19599   0, /*tp_as_buffer*/
19600   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
19601   0, /*tp_doc*/
19602   __pyx_tp_traverse_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers, /*tp_traverse*/
19603   0, /*tp_clear*/
19604   0, /*tp_richcompare*/
19605   0, /*tp_weaklistoffset*/
19606   0, /*tp_iter*/
19607   0, /*tp_iternext*/
19608   0, /*tp_methods*/
19609   0, /*tp_members*/
19610   0, /*tp_getset*/
19611   0, /*tp_base*/
19612   0, /*tp_dict*/
19613   0, /*tp_descr_get*/
19614   0, /*tp_descr_set*/
19615   0, /*tp_dictoffset*/
19616   0, /*tp_init*/
19617   0, /*tp_alloc*/
19618   __pyx_tp_new_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers, /*tp_new*/
19619   0, /*tp_free*/
19620   0, /*tp_is_gc*/
19621   0, /*tp_bases*/
19622   0, /*tp_mro*/
19623   0, /*tp_cache*/
19624   0, /*tp_subclasses*/
19625   0, /*tp_weaklist*/
19626   0, /*tp_del*/
19627   0, /*tp_version_tag*/
19628   #if PY_VERSION_HEX >= 0x030400a1
19629   0, /*tp_finalize*/
19630   #endif
19631   #if PY_VERSION_HEX >= 0x030800b1
19632   0, /*tp_vectorcall*/
19633   #endif
19634   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19635   0, /*tp_print*/
19636   #endif
19637 };
19638 
19639 static PyMethodDef __pyx_methods[] = {
19640   {0, 0, 0, 0}
19641 };
19642 
19643 #if PY_MAJOR_VERSION >= 3
19644 #if CYTHON_PEP489_MULTI_PHASE_INIT
19645 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
19646 static int __pyx_pymod_exec_video(PyObject* module); /*proto*/
19647 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
19648   {Py_mod_create, (void*)__pyx_pymod_create},
19649   {Py_mod_exec, (void*)__pyx_pymod_exec_video},
19650   {0, NULL}
19651 };
19652 #endif
19653 
19654 static struct PyModuleDef __pyx_moduledef = {
19655     PyModuleDef_HEAD_INIT,
19656     "video",
19657     0, /* m_doc */
19658   #if CYTHON_PEP489_MULTI_PHASE_INIT
19659     0, /* m_size */
19660   #else
19661     -1, /* m_size */
19662   #endif
19663     __pyx_methods /* m_methods */,
19664   #if CYTHON_PEP489_MULTI_PHASE_INIT
19665     __pyx_moduledef_slots, /* m_slots */
19666   #else
19667     NULL, /* m_reload */
19668   #endif
19669     NULL, /* m_traverse */
19670     NULL, /* m_clear */
19671     NULL /* m_free */
19672 };
19673 #endif
19674 #ifndef CYTHON_SMALL_CODE
19675 #if defined(__clang__)
19676     #define CYTHON_SMALL_CODE
19677 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
19678     #define CYTHON_SMALL_CODE __attribute__((cold))
19679 #else
19680     #define CYTHON_SMALL_CODE
19681 #endif
19682 #endif
19683 
19684 static __Pyx_StringTabEntry __pyx_string_tab[] = {
19685   {&__pyx_kp_s_2nd_argument_must_be_a_surface, __pyx_k_2nd_argument_must_be_a_surface, sizeof(__pyx_k_2nd_argument_must_be_a_surface), 0, 0, 1, 0},
19686   {&__pyx_n_s_DEFAULT_SIZE, __pyx_k_DEFAULT_SIZE, sizeof(__pyx_k_DEFAULT_SIZE), 0, 0, 1, 1},
19687   {&__pyx_n_s_Image, __pyx_k_Image, sizeof(__pyx_k_Image), 0, 0, 1, 1},
19688   {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
19689   {&__pyx_n_s_MESSAGEBOX_ERROR, __pyx_k_MESSAGEBOX_ERROR, sizeof(__pyx_k_MESSAGEBOX_ERROR), 0, 0, 1, 1},
19690   {&__pyx_n_s_MESSAGEBOX_INFORMATION, __pyx_k_MESSAGEBOX_INFORMATION, sizeof(__pyx_k_MESSAGEBOX_INFORMATION), 0, 0, 1, 1},
19691   {&__pyx_n_s_MESSAGEBOX_WARNING, __pyx_k_MESSAGEBOX_WARNING, sizeof(__pyx_k_MESSAGEBOX_WARNING), 0, 0, 1, 1},
19692   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
19693   {&__pyx_n_s_OK, __pyx_k_OK, sizeof(__pyx_k_OK), 0, 0, 1, 1},
19694   {&__pyx_n_s_Renderer, __pyx_k_Renderer, sizeof(__pyx_k_Renderer), 0, 0, 1, 1},
19695   {&__pyx_n_s_RendererDriverInfo, __pyx_k_RendererDriverInfo, sizeof(__pyx_k_RendererDriverInfo), 0, 0, 1, 1},
19696   {&__pyx_n_s_RendererDriverInfo___repr, __pyx_k_RendererDriverInfo___repr, sizeof(__pyx_k_RendererDriverInfo___repr), 0, 0, 1, 1},
19697   {&__pyx_n_s_Texture, __pyx_k_Texture, sizeof(__pyx_k_Texture), 0, 0, 1, 1},
19698   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
19699   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
19700   {&__pyx_n_s_WINDOWPOS_CENTERED, __pyx_k_WINDOWPOS_CENTERED, sizeof(__pyx_k_WINDOWPOS_CENTERED), 0, 0, 1, 1},
19701   {&__pyx_n_s_WINDOWPOS_UNDEFINED, __pyx_k_WINDOWPOS_UNDEFINED, sizeof(__pyx_k_WINDOWPOS_UNDEFINED), 0, 0, 1, 1},
19702   {&__pyx_n_s_Window, __pyx_k_Window, sizeof(__pyx_k_Window), 0, 0, 1, 1},
19703   {&__pyx_n_s__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 0, 1, 1},
19704   {&__pyx_n_s_accelerated, __pyx_k_accelerated, sizeof(__pyx_k_accelerated), 0, 0, 1, 1},
19705   {&__pyx_n_s_allow_highdpi, __pyx_k_allow_highdpi, sizeof(__pyx_k_allow_highdpi), 0, 0, 1, 1},
19706   {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
19707   {&__pyx_n_s_always_on_top, __pyx_k_always_on_top, sizeof(__pyx_k_always_on_top), 0, 0, 1, 1},
19708   {&__pyx_n_s_angle, __pyx_k_angle, sizeof(__pyx_k_angle), 0, 0, 1, 1},
19709   {&__pyx_n_s_area, __pyx_k_area, sizeof(__pyx_k_area), 0, 0, 1, 1},
19710   {&__pyx_kp_s_area_must_be_None_or_a_rect, __pyx_k_area_must_be_None_or_a_rect, sizeof(__pyx_k_area_must_be_None_or_a_rect), 0, 0, 1, 0},
19711   {&__pyx_kp_s_area_must_be_a_rectangle_or_None, __pyx_k_area_must_be_a_rectangle_or_None, sizeof(__pyx_k_area_must_be_a_rectangle_or_None), 0, 0, 1, 0},
19712   {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
19713   {&__pyx_n_s_blend_mode, __pyx_k_blend_mode, sizeof(__pyx_k_blend_mode), 0, 0, 1, 1},
19714   {&__pyx_n_s_blit, __pyx_k_blit, sizeof(__pyx_k_blit), 0, 0, 1, 1},
19715   {&__pyx_n_s_borderless, __pyx_k_borderless, sizeof(__pyx_k_borderless), 0, 0, 1, 1},
19716   {&__pyx_n_s_but, __pyx_k_but, sizeof(__pyx_k_but), 0, 0, 1, 1},
19717   {&__pyx_n_s_button, __pyx_k_button, sizeof(__pyx_k_button), 0, 0, 1, 1},
19718   {&__pyx_n_s_buttonid, __pyx_k_buttonid, sizeof(__pyx_k_buttonid), 0, 0, 1, 1},
19719   {&__pyx_n_s_buttons, __pyx_k_buttons, sizeof(__pyx_k_buttons), 0, 0, 1, 1},
19720   {&__pyx_n_s_buttons_utf8, __pyx_k_buttons_utf8, sizeof(__pyx_k_buttons_utf8), 0, 0, 1, 1},
19721   {&__pyx_n_s_c_buttons, __pyx_k_c_buttons, sizeof(__pyx_k_c_buttons), 0, 0, 1, 1},
19722   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
19723   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
19724   {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
19725   {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
19726   {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
19727   {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1},
19728   {&__pyx_n_s_desktop, __pyx_k_desktop, sizeof(__pyx_k_desktop), 0, 0, 1, 1},
19729   {&__pyx_n_s_dest, __pyx_k_dest, sizeof(__pyx_k_dest), 0, 0, 1, 1},
19730   {&__pyx_n_s_destroy, __pyx_k_destroy, sizeof(__pyx_k_destroy), 0, 0, 1, 1},
19731   {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
19732   {&__pyx_n_s_draw, __pyx_k_draw, sizeof(__pyx_k_draw), 0, 0, 1, 1},
19733   {&__pyx_n_s_dstrect, __pyx_k_dstrect, sizeof(__pyx_k_dstrect), 0, 0, 1, 1},
19734   {&__pyx_kp_s_dstrect_must_be_a_position_rect, __pyx_k_dstrect_must_be_a_position_rect, sizeof(__pyx_k_dstrect_must_be_a_position_rect), 0, 0, 1, 0},
19735   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
19736   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
19737   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
19738   {&__pyx_n_s_errorfnc, __pyx_k_errorfnc, sizeof(__pyx_k_errorfnc), 0, 0, 1, 1},
19739   {&__pyx_n_s_escape_button, __pyx_k_escape_button, sizeof(__pyx_k_escape_button), 0, 0, 1, 1},
19740   {&__pyx_kp_s_expected_a_rectangle, __pyx_k_expected_a_rectangle, sizeof(__pyx_k_expected_a_rectangle), 0, 0, 1, 0},
19741   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
19742   {&__pyx_n_s_flipX, __pyx_k_flipX, sizeof(__pyx_k_flipX), 0, 0, 1, 1},
19743   {&__pyx_n_s_flipY, __pyx_k_flipY, sizeof(__pyx_k_flipY), 0, 0, 1, 1},
19744   {&__pyx_n_s_foreign, __pyx_k_foreign, sizeof(__pyx_k_foreign), 0, 0, 1, 1},
19745   {&__pyx_n_s_from_display_module, __pyx_k_from_display_module, sizeof(__pyx_k_from_display_module), 0, 0, 1, 1},
19746   {&__pyx_n_s_from_surface, __pyx_k_from_surface, sizeof(__pyx_k_from_surface), 0, 0, 1, 1},
19747   {&__pyx_n_s_from_window, __pyx_k_from_window, sizeof(__pyx_k_from_window), 0, 0, 1, 1},
19748   {&__pyx_n_s_fullscreen, __pyx_k_fullscreen, sizeof(__pyx_k_fullscreen), 0, 0, 1, 1},
19749   {&__pyx_kp_s_fullscreen_and_fullscreen_deskto, __pyx_k_fullscreen_and_fullscreen_deskto, sizeof(__pyx_k_fullscreen_and_fullscreen_deskto), 0, 0, 1, 0},
19750   {&__pyx_n_s_fullscreen_desktop, __pyx_k_fullscreen_desktop, sizeof(__pyx_k_fullscreen_desktop), 0, 0, 1, 1},
19751   {&__pyx_n_s_getResource, __pyx_k_getResource, sizeof(__pyx_k_getResource), 0, 0, 1, 1},
19752   {&__pyx_n_s_get_drivers, __pyx_k_get_drivers, sizeof(__pyx_k_get_drivers), 0, 0, 1, 1},
19753   {&__pyx_n_s_get_grabbed_window, __pyx_k_get_grabbed_window, sizeof(__pyx_k_get_grabbed_window), 0, 0, 1, 1},
19754   {&__pyx_n_s_get_height, __pyx_k_get_height, sizeof(__pyx_k_get_height), 0, 0, 1, 1},
19755   {&__pyx_n_s_get_rect, __pyx_k_get_rect, sizeof(__pyx_k_get_rect), 0, 0, 1, 1},
19756   {&__pyx_n_s_get_viewport, __pyx_k_get_viewport, sizeof(__pyx_k_get_viewport), 0, 0, 1, 1},
19757   {&__pyx_n_s_get_width, __pyx_k_get_width, sizeof(__pyx_k_get_width), 0, 0, 1, 1},
19758   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
19759   {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
19760   {&__pyx_n_s_hidden, __pyx_k_hidden, sizeof(__pyx_k_hidden), 0, 0, 1, 1},
19761   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
19762   {&__pyx_n_s_image, __pyx_k_image, sizeof(__pyx_k_image), 0, 0, 1, 1},
19763   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
19764   {&__pyx_n_s_ind, __pyx_k_ind, sizeof(__pyx_k_ind), 0, 0, 1, 1},
19765   {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
19766   {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
19767   {&__pyx_n_s_input_focus, __pyx_k_input_focus, sizeof(__pyx_k_input_focus), 0, 0, 1, 1},
19768   {&__pyx_n_s_input_grabbed, __pyx_k_input_grabbed, sizeof(__pyx_k_input_grabbed), 0, 0, 1, 1},
19769   {&__pyx_n_s_input_only, __pyx_k_input_only, sizeof(__pyx_k_input_only), 0, 0, 1, 1},
19770   {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
19771   {&__pyx_n_s_kwarg_to_flag, __pyx_k_kwarg_to_flag, sizeof(__pyx_k_kwarg_to_flag), 0, 0, 1, 1},
19772   {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1},
19773   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
19774   {&__pyx_n_s_max_texture_height, __pyx_k_max_texture_height, sizeof(__pyx_k_max_texture_height), 0, 0, 1, 1},
19775   {&__pyx_n_s_max_texture_width, __pyx_k_max_texture_width, sizeof(__pyx_k_max_texture_width), 0, 0, 1, 1},
19776   {&__pyx_n_s_maximized, __pyx_k_maximized, sizeof(__pyx_k_maximized), 0, 0, 1, 1},
19777   {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
19778   {&__pyx_n_s_messagebox, __pyx_k_messagebox, sizeof(__pyx_k_messagebox), 0, 0, 1, 1},
19779   {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
19780   {&__pyx_n_s_minimized, __pyx_k_minimized, sizeof(__pyx_k_minimized), 0, 0, 1, 1},
19781   {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
19782   {&__pyx_n_s_mouse_capture, __pyx_k_mouse_capture, sizeof(__pyx_k_mouse_capture), 0, 0, 1, 1},
19783   {&__pyx_n_s_mouse_focus, __pyx_k_mouse_focus, sizeof(__pyx_k_mouse_focus), 0, 0, 1, 1},
19784   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
19785   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
19786   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
19787   {&__pyx_kp_s_no_standard_masks_exist_for_give, __pyx_k_no_standard_masks_exist_for_give, sizeof(__pyx_k_no_standard_masks_exist_for_give), 0, 0, 1, 0},
19788   {&__pyx_kp_s_not_enough_memory_for_the_surfac, __pyx_k_not_enough_memory_for_the_surfac, sizeof(__pyx_k_not_enough_memory_for_the_surfac), 0, 0, 1, 0},
19789   {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1},
19790   {&__pyx_n_s_num_texture_formats, __pyx_k_num_texture_formats, sizeof(__pyx_k_num_texture_formats), 0, 0, 1, 1},
19791   {&__pyx_kp_s_only_one_of_static_streaming_or, __pyx_k_only_one_of_static_streaming_or, sizeof(__pyx_k_only_one_of_static_streaming_or), 0, 0, 1, 0},
19792   {&__pyx_n_s_opengl, __pyx_k_opengl, sizeof(__pyx_k_opengl), 0, 0, 1, 1},
19793   {&__pyx_n_s_origin, __pyx_k_origin, sizeof(__pyx_k_origin), 0, 0, 1, 1},
19794   {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1},
19795   {&__pyx_n_s_p2, __pyx_k_p2, sizeof(__pyx_k_p2), 0, 0, 1, 1},
19796   {&__pyx_n_s_pkgdata, __pyx_k_pkgdata, sizeof(__pyx_k_pkgdata), 0, 0, 1, 1},
19797   {&__pyx_n_s_popup_menu, __pyx_k_popup_menu, sizeof(__pyx_k_popup_menu), 0, 0, 1, 1},
19798   {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
19799   {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
19800   {&__pyx_n_s_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 0, 1, 1},
19801   {&__pyx_n_s_pygame, __pyx_k_pygame, sizeof(__pyx_k_pygame), 0, 0, 1, 1},
19802   {&__pyx_n_s_pygame__sdl2_video, __pyx_k_pygame__sdl2_video, sizeof(__pyx_k_pygame__sdl2_video), 0, 0, 1, 1},
19803   {&__pyx_kp_s_pygame_icon_bmp, __pyx_k_pygame_icon_bmp, sizeof(__pyx_k_pygame_icon_bmp), 0, 0, 1, 0},
19804   {&__pyx_n_s_pygame_pkgdata, __pyx_k_pygame_pkgdata, sizeof(__pyx_k_pygame_pkgdata), 0, 0, 1, 1},
19805   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
19806   {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
19807   {&__pyx_kp_s_rect_values_are_out_of_range, __pyx_k_rect_values_are_out_of_range, sizeof(__pyx_k_rect_values_are_out_of_range), 0, 0, 1, 0},
19808   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
19809   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
19810   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
19811   {&__pyx_n_s_renderer, __pyx_k_renderer, sizeof(__pyx_k_renderer), 0, 0, 1, 1},
19812   {&__pyx_n_s_renderer_2, __pyx_k_renderer_2, sizeof(__pyx_k_renderer_2), 0, 0, 1, 1},
19813   {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
19814   {&__pyx_n_s_resizable, __pyx_k_resizable, sizeof(__pyx_k_resizable), 0, 0, 1, 1},
19815   {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
19816   {&__pyx_n_s_return_button, __pyx_k_return_button, sizeof(__pyx_k_return_button), 0, 0, 1, 1},
19817   {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
19818   {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
19819   {&__pyx_kp_s_s_name_s_flags_0x_02x_num_textu, __pyx_k_s_name_s_flags_0x_02x_num_textu, sizeof(__pyx_k_s_name_s_flags_0x_02x_num_textu), 0, 0, 1, 0},
19820   {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
19821   {&__pyx_kp_s_self__renderer_cannot_be_convert, __pyx_k_self__renderer_cannot_be_convert, sizeof(__pyx_k_self__renderer_cannot_be_convert), 0, 0, 1, 0},
19822   {&__pyx_kp_s_self__win_cannot_be_converted_to, __pyx_k_self__win_cannot_be_converted_to, sizeof(__pyx_k_self__win_cannot_be_converted_to), 0, 0, 1, 0},
19823   {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
19824   {&__pyx_n_s_set_colorkey, __pyx_k_set_colorkey, sizeof(__pyx_k_set_colorkey), 0, 0, 1, 1},
19825   {&__pyx_n_s_set_icon, __pyx_k_set_icon, sizeof(__pyx_k_set_icon), 0, 0, 1, 1},
19826   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
19827   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
19828   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
19829   {&__pyx_kp_s_size_must_contain_two_positive_v, __pyx_k_size_must_contain_two_positive_v, sizeof(__pyx_k_size_must_contain_two_positive_v), 0, 0, 1, 0},
19830   {&__pyx_kp_s_size_must_have_two_elements, __pyx_k_size_must_have_two_elements, sizeof(__pyx_k_size_must_have_two_elements), 0, 0, 1, 0},
19831   {&__pyx_n_s_skip_taskbar, __pyx_k_skip_taskbar, sizeof(__pyx_k_skip_taskbar), 0, 0, 1, 1},
19832   {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1},
19833   {&__pyx_kp_s_source_must_be_drawable, __pyx_k_source_must_be_drawable, sizeof(__pyx_k_source_must_be_drawable), 0, 0, 1, 0},
19834   {&__pyx_n_s_special_flags, __pyx_k_special_flags, sizeof(__pyx_k_special_flags), 0, 0, 1, 1},
19835   {&__pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_k_src_c_cython_pygame__sdl2_video, sizeof(__pyx_k_src_c_cython_pygame__sdl2_video), 0, 0, 1, 0},
19836   {&__pyx_n_s_srcrect, __pyx_k_srcrect, sizeof(__pyx_k_srcrect), 0, 0, 1, 1},
19837   {&__pyx_kp_s_srcrect_must_be_None_or_a_rectan, __pyx_k_srcrect_must_be_None_or_a_rectan, sizeof(__pyx_k_srcrect_must_be_None_or_a_rectan), 0, 0, 1, 0},
19838   {&__pyx_kp_s_srcrect_must_be_a_rect_or_None, __pyx_k_srcrect_must_be_a_rect_or_None, sizeof(__pyx_k_srcrect_must_be_a_rect_or_None), 0, 0, 1, 0},
19839   {&__pyx_n_s_static, __pyx_k_static, sizeof(__pyx_k_static), 0, 0, 1, 1},
19840   {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
19841   {&__pyx_n_s_streaming, __pyx_k_streaming, sizeof(__pyx_k_streaming), 0, 0, 1, 1},
19842   {&__pyx_n_s_surf_ptr, __pyx_k_surf_ptr, sizeof(__pyx_k_surf_ptr), 0, 0, 1, 1},
19843   {&__pyx_n_s_surface, __pyx_k_surface, sizeof(__pyx_k_surface), 0, 0, 1, 1},
19844   {&__pyx_kp_s_surface_must_be_a_Surface_object, __pyx_k_surface_must_be_a_Surface_object, sizeof(__pyx_k_surface_must_be_a_Surface_object), 0, 0, 1, 0},
19845   {&__pyx_kp_s_surface_must_be_a_surface_or_No, __pyx_k_surface_must_be_a_surface_or_No, sizeof(__pyx_k_surface_must_be_a_surface_or_No), 0, 0, 1, 0},
19846   {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
19847   {&__pyx_kp_s_target_must_be_a_Texture_or_None, __pyx_k_target_must_be_a_Texture_or_None, sizeof(__pyx_k_target_must_be_a_Texture_or_None), 0, 0, 1, 0},
19848   {&__pyx_n_s_target_texture, __pyx_k_target_texture, sizeof(__pyx_k_target_texture), 0, 0, 1, 1},
19849   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
19850   {&__pyx_n_s_texture, __pyx_k_texture, sizeof(__pyx_k_texture), 0, 0, 1, 1},
19851   {&__pyx_n_s_textureOrImage, __pyx_k_textureOrImage, sizeof(__pyx_k_textureOrImage), 0, 0, 1, 1},
19852   {&__pyx_kp_s_the_argument_is_not_a_rectangle, __pyx_k_the_argument_is_not_a_rectangle, sizeof(__pyx_k_the_argument_is_not_a_rectangle), 0, 0, 1, 0},
19853   {&__pyx_kp_s_the_surface_is_too_small, __pyx_k_the_surface_is_too_small, sizeof(__pyx_k_the_surface_is_too_small), 0, 0, 1, 0},
19854   {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
19855   {&__pyx_n_s_title, __pyx_k_title, sizeof(__pyx_k_title), 0, 0, 1, 1},
19856   {&__pyx_n_s_tooltip, __pyx_k_tooltip, sizeof(__pyx_k_tooltip), 0, 0, 1, 1},
19857   {&__pyx_kp_s_unknown_parameter_s, __pyx_k_unknown_parameter_s, sizeof(__pyx_k_unknown_parameter_s), 0, 0, 1, 0},
19858   {&__pyx_kp_s_update_source_should_be_a_Surfac, __pyx_k_update_source_should_be_a_Surfac, sizeof(__pyx_k_update_source_should_be_a_Surfac), 0, 0, 1, 0},
19859   {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
19860   {&__pyx_n_s_utility, __pyx_k_utility, sizeof(__pyx_k_utility), 0, 0, 1, 1},
19861   {&__pyx_n_s_vsync, __pyx_k_vsync, sizeof(__pyx_k_vsync), 0, 0, 1, 1},
19862   {&__pyx_n_s_vulkan, __pyx_k_vulkan, sizeof(__pyx_k_vulkan), 0, 0, 1, 1},
19863   {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
19864   {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
19865   {&__pyx_n_s_win, __pyx_k_win, sizeof(__pyx_k_win), 0, 0, 1, 1},
19866   {&__pyx_n_s_window, __pyx_k_window, sizeof(__pyx_k_window), 0, 0, 1, 1},
19867   {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
19868   {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
19869   {0, 0, 0, 0, 0, 0, 0}
19870 };
__Pyx_InitCachedBuiltins(void)19871 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
19872   __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 618, __pyx_L1_error)
19873   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 162, __pyx_L1_error)
19874   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 163, __pyx_L1_error)
19875   __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 163, __pyx_L1_error)
19876   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 259, __pyx_L1_error)
19877   __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 271, __pyx_L1_error)
19878   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 272, __pyx_L1_error)
19879   return 0;
19880   __pyx_L1_error:;
19881   return -1;
19882 }
19883 
__Pyx_InitCachedConstants(void)19884 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19885   __Pyx_RefNannyDeclarations
19886   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
19887 
19888   /* "pygame/_sdl2/video.pyx":108
19889  *                bint warn=False,
19890  *                bint error=False,
19891  *                buttons=('OK', ),             # <<<<<<<<<<<<<<
19892  *                return_button=0,
19893  *                escape_button=0):
19894  */
19895   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_OK); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 108, __pyx_L1_error)
19896   __Pyx_GOTREF(__pyx_tuple__2);
19897   __Pyx_GIVEREF(__pyx_tuple__2);
19898 
19899   /* "pygame/_sdl2/video.pyx":259
19900  *         flags = 0
19901  *         if fullscreen and fullscreen_desktop:
19902  *             raise ValueError("fullscreen and fullscreen_desktop cannot be used at the same time.")             # <<<<<<<<<<<<<<
19903  *         if fullscreen:
19904  *             flags |= _SDL_WINDOW_FULLSCREEN
19905  */
19906   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_fullscreen_and_fullscreen_deskto); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 259, __pyx_L1_error)
19907   __Pyx_GOTREF(__pyx_tuple__5);
19908   __Pyx_GIVEREF(__pyx_tuple__5);
19909 
19910   /* "pygame/_sdl2/video.pyx":448
19911  *         """
19912  *         if not pgSurface_Check(surface):
19913  *             raise TypeError('surface must be a Surface object')             # <<<<<<<<<<<<<<
19914  *         SDL_SetWindowIcon(self._win, pgSurface_AsSurface(surface))
19915  *
19916  */
19917   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_surface_must_be_a_Surface_object); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 448, __pyx_L1_error)
19918   __Pyx_GOTREF(__pyx_tuple__6);
19919   __Pyx_GIVEREF(__pyx_tuple__6);
19920 
19921   /* "(tree fragment)":2
19922  * def __reduce_cython__(self):
19923  *     raise TypeError("self._win cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
19924  * def __setstate_cython__(self, __pyx_state):
19925  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
19926  */
19927   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_self__win_cannot_be_converted_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 2, __pyx_L1_error)
19928   __Pyx_GOTREF(__pyx_tuple__7);
19929   __Pyx_GIVEREF(__pyx_tuple__7);
19930 
19931   /* "(tree fragment)":4
19932  *     raise TypeError("self._win cannot be converted to a Python object for pickling")
19933  * def __setstate_cython__(self, __pyx_state):
19934  *     raise TypeError("self._win cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
19935  */
19936   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_self__win_cannot_be_converted_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error)
19937   __Pyx_GOTREF(__pyx_tuple__8);
19938   __Pyx_GIVEREF(__pyx_tuple__8);
19939 
19940   /* "pygame/_sdl2/video.pyx":548
19941  *         Amask = 0xFF << 24
19942  *     else:
19943  *         raise ValueError("no standard masks exist for given bitdepth with alpha")             # <<<<<<<<<<<<<<
19944  *     return SDL_MasksToPixelFormatEnum(depth,
19945  *                                       Rmask, Gmask, Bmask, Amask)
19946  */
19947   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_standard_masks_exist_for_give); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 548, __pyx_L1_error)
19948   __Pyx_GOTREF(__pyx_tuple__9);
19949   __Pyx_GIVEREF(__pyx_tuple__9);
19950 
19951   /* "pygame/_sdl2/video.pyx":586
19952  *         cdef int width, height
19953  *         if len(size) != 2:
19954  *             raise ValueError('size must have two elements')             # <<<<<<<<<<<<<<
19955  *         width, height = size[0], size[1]
19956  *         if width <= 0 or height <= 0:
19957  */
19958   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_size_must_have_two_elements); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 586, __pyx_L1_error)
19959   __Pyx_GOTREF(__pyx_tuple__10);
19960   __Pyx_GIVEREF(__pyx_tuple__10);
19961 
19962   /* "pygame/_sdl2/video.pyx":589
19963  *         width, height = size[0], size[1]
19964  *         if width <= 0 or height <= 0:
19965  *             raise ValueError('size must contain two positive values')             # <<<<<<<<<<<<<<
19966  *
19967  *         cdef int access
19968  */
19969   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_size_must_contain_two_positive_v); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 589, __pyx_L1_error)
19970   __Pyx_GOTREF(__pyx_tuple__11);
19971   __Pyx_GIVEREF(__pyx_tuple__11);
19972 
19973   /* "pygame/_sdl2/video.pyx":594
19974  *         if static:
19975  *             if streaming or target:
19976  *                 raise ValueError('only one of static, streaming, or target can be true')             # <<<<<<<<<<<<<<
19977  *             access = _SDL_TEXTUREACCESS_STATIC
19978  *         elif streaming:
19979  */
19980   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_only_one_of_static_streaming_or); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 594, __pyx_L1_error)
19981   __Pyx_GOTREF(__pyx_tuple__12);
19982   __Pyx_GIVEREF(__pyx_tuple__12);
19983 
19984   /* "pygame/_sdl2/video.pyx":627
19985  *         # https://wiki.libsdl.org/SDL_CreateTextureFromSurface
19986  *         if not pgSurface_Check(surface):
19987  *             raise TypeError('2nd argument must be a surface')             # <<<<<<<<<<<<<<
19988  *         cdef Texture self = Texture.__new__(Texture)
19989  *         self.renderer = renderer
19990  */
19991   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_2nd_argument_must_be_a_surface); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 627, __pyx_L1_error)
19992   __Pyx_GOTREF(__pyx_tuple__13);
19993   __Pyx_GIVEREF(__pyx_tuple__13);
19994 
19995   /* "pygame/_sdl2/video.pyx":746
19996  *             csrcrect = pgRect_FromObject(srcrect, &src)
19997  *             if not csrcrect:
19998  *                 raise TypeError("the argument is not a rectangle or None")             # <<<<<<<<<<<<<<
19999  *
20000  *         if dstrect is not None:
20001  */
20002   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_the_argument_is_not_a_rectangle); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 746, __pyx_L1_error)
20003   __Pyx_GOTREF(__pyx_tuple__14);
20004   __Pyx_GIVEREF(__pyx_tuple__14);
20005 
20006   /* "pygame/_sdl2/video.pyx":758
20007  *                     cdstrect = &dst
20008  *                 else:
20009  *                     raise TypeError('dstrect must be a position, rect, or None')             # <<<<<<<<<<<<<<
20010  *
20011  *         if origin:
20012  */
20013   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_dstrect_must_be_a_position_rect); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 758, __pyx_L1_error)
20014   __Pyx_GOTREF(__pyx_tuple__15);
20015   __Pyx_GIVEREF(__pyx_tuple__15);
20016 
20017   /* "pygame/_sdl2/video.pyx":786
20018  *
20019  *         if not pgSurface_Check(surface):
20020  *             raise TypeError("update source should be a Surface.")             # <<<<<<<<<<<<<<
20021  *
20022  *         cdef SDL_Rect rect
20023  */
20024   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_update_source_should_be_a_Surfac); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 786, __pyx_L1_error)
20025   __Pyx_GOTREF(__pyx_tuple__16);
20026   __Pyx_GIVEREF(__pyx_tuple__16);
20027 
20028   /* "pygame/_sdl2/video.pyx":793
20029  *
20030  *         if rectptr == NULL and area is not None:
20031  *             raise TypeError('area must be a rectangle or None')             # <<<<<<<<<<<<<<
20032  *
20033  *         res = SDL_UpdateTexture(self._tex, rectptr, surf.pixels, surf.pitch)
20034  */
20035   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_area_must_be_a_rectangle_or_None); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 793, __pyx_L1_error)
20036   __Pyx_GOTREF(__pyx_tuple__17);
20037   __Pyx_GIVEREF(__pyx_tuple__17);
20038 
20039   /* "(tree fragment)":2
20040  * def __reduce_cython__(self):
20041  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20042  * def __setstate_cython__(self, __pyx_state):
20043  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20044  */
20045   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2, __pyx_L1_error)
20046   __Pyx_GOTREF(__pyx_tuple__18);
20047   __Pyx_GIVEREF(__pyx_tuple__18);
20048 
20049   /* "(tree fragment)":4
20050  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20051  * def __setstate_cython__(self, __pyx_state):
20052  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20053  */
20054   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 4, __pyx_L1_error)
20055   __Pyx_GOTREF(__pyx_tuple__19);
20056   __Pyx_GIVEREF(__pyx_tuple__19);
20057 
20058   /* "pygame/_sdl2/video.pyx":828
20059  *             rectptr = pgRect_FromObject(srcrect, &temp)
20060  *             if rectptr == NULL:
20061  *                 raise TypeError('srcrect must be None or a rectangle')             # <<<<<<<<<<<<<<
20062  *             temp.x = rectptr.x
20063  *             temp.y = rectptr.y
20064  */
20065   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_srcrect_must_be_None_or_a_rectan); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 828, __pyx_L1_error)
20066   __Pyx_GOTREF(__pyx_tuple__20);
20067   __Pyx_GIVEREF(__pyx_tuple__20);
20068 
20069   /* "pygame/_sdl2/video.pyx":838
20070  *                 temp.x + temp.w > self.srcrect.w or \
20071  *                 temp.y + temp.h > self.srcrect.h:
20072  *                 raise ValueError('rect values are out of range')             # <<<<<<<<<<<<<<
20073  *             temp.x += self.srcrect.x
20074  *             temp.y += self.srcrect.y
20075  */
20076   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_rect_values_are_out_of_range); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 838, __pyx_L1_error)
20077   __Pyx_GOTREF(__pyx_tuple__21);
20078   __Pyx_GIVEREF(__pyx_tuple__21);
20079 
20080   /* "pygame/_sdl2/video.pyx":849
20081  *     @color.setter
20082  *     def color(self, new_color):
20083  *         self._color[:3] = new_color[:3]             # <<<<<<<<<<<<<<
20084  *
20085  *     @property
20086  */
20087   __pyx_slice__22 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(0, 849, __pyx_L1_error)
20088   __Pyx_GOTREF(__pyx_slice__22);
20089   __Pyx_GIVEREF(__pyx_slice__22);
20090 
20091   /* "pygame/_sdl2/video.pyx":892
20092  *                 rectptr = pgRect_FromObject(srcrect, &src)
20093  *                 if rectptr == NULL:
20094  *                     raise TypeError('srcrect must be a rect or None')             # <<<<<<<<<<<<<<
20095  *                 src.x = rectptr.x
20096  *                 src.y = rectptr.y
20097  */
20098   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_srcrect_must_be_a_rect_or_None); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 892, __pyx_L1_error)
20099   __Pyx_GOTREF(__pyx_tuple__23);
20100   __Pyx_GIVEREF(__pyx_tuple__23);
20101 
20102   /* "(tree fragment)":2
20103  * def __reduce_cython__(self):
20104  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20105  * def __setstate_cython__(self, __pyx_state):
20106  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20107  */
20108   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 2, __pyx_L1_error)
20109   __Pyx_GOTREF(__pyx_tuple__24);
20110   __Pyx_GIVEREF(__pyx_tuple__24);
20111 
20112   /* "(tree fragment)":4
20113  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20114  * def __setstate_cython__(self, __pyx_state):
20115  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20116  */
20117   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 4, __pyx_L1_error)
20118   __Pyx_GOTREF(__pyx_tuple__25);
20119   __Pyx_GIVEREF(__pyx_tuple__25);
20120 
20121   /* "pygame/_sdl2/video.pyx":1012
20122  *         """
20123  *         # https://wiki.libsdl.org/SDL_SetRenderDrawColor
20124  *         self._draw_color[:] = new_value             # <<<<<<<<<<<<<<
20125  *         res = SDL_SetRenderDrawColor(self._renderer,
20126  *                                      new_value[0],
20127  */
20128   __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(0, 1012, __pyx_L1_error)
20129   __Pyx_GOTREF(__pyx_slice__26);
20130   __Pyx_GIVEREF(__pyx_slice__26);
20131 
20132   /* "pygame/_sdl2/video.pyx":1095
20133  *         cdef SDL_Rect *rectptr = pgRect_FromObject(area, &tmprect)
20134  *         if rectptr == NULL:
20135  *             raise TypeError('expected a rectangle')             # <<<<<<<<<<<<<<
20136  *
20137  *         if SDL_RenderSetViewport(self._renderer, rectptr) < 0:
20138  */
20139   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_expected_a_rectangle); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1095, __pyx_L1_error)
20140   __Pyx_GOTREF(__pyx_tuple__27);
20141   __Pyx_GIVEREF(__pyx_tuple__27);
20142 
20143   /* "pygame/_sdl2/video.pyx":1123
20144  *                 raise error()
20145  *         else:
20146  *             raise TypeError('target must be a Texture or None')             # <<<<<<<<<<<<<<
20147  *
20148  *     cpdef object blit(self, object source, Rect dest=None, Rect area=None, int special_flags=0):
20149  */
20150   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_target_must_be_a_Texture_or_None); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 1123, __pyx_L1_error)
20151   __Pyx_GOTREF(__pyx_tuple__28);
20152   __Pyx_GIVEREF(__pyx_tuple__28);
20153 
20154   /* "pygame/_sdl2/video.pyx":1138
20155  *             (<Image>source).draw(area, dest)
20156  *         elif not hasattr(source, 'draw'):
20157  *             raise TypeError('source must be drawable')             # <<<<<<<<<<<<<<
20158  *         else:
20159  *             source.draw(area, dest)
20160  */
20161   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_source_must_be_drawable); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1138, __pyx_L1_error)
20162   __Pyx_GOTREF(__pyx_tuple__29);
20163   __Pyx_GIVEREF(__pyx_tuple__29);
20164 
20165   /* "pygame/_sdl2/video.pyx":1208
20166  *             rectptr = pgRect_FromObject(area, &rarea)
20167  *             if rectptr == NULL:
20168  *                 raise TypeError('area must be None or a rect')             # <<<<<<<<<<<<<<
20169  *
20170  *             # clip area
20171  */
20172   __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_area_must_be_None_or_a_rect); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 1208, __pyx_L1_error)
20173   __Pyx_GOTREF(__pyx_tuple__30);
20174   __Pyx_GIVEREF(__pyx_tuple__30);
20175 
20176   /* "pygame/_sdl2/video.pyx":1236
20177  *                 format)
20178  *             if surf == NULL:
20179  *                 raise MemoryError("not enough memory for the surface")             # <<<<<<<<<<<<<<
20180  *
20181  *             surface = <object>pgSurface_New2(surf, 1)
20182  */
20183   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_not_enough_memory_for_the_surfac); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1236, __pyx_L1_error)
20184   __Pyx_GOTREF(__pyx_tuple__31);
20185   __Pyx_GIVEREF(__pyx_tuple__31);
20186 
20187   /* "pygame/_sdl2/video.pyx":1242
20188  *             surf = pgSurface_AsSurface(surface)
20189  *             if surf.w < rarea.w or surf.h < rarea.h:
20190  *                 raise ValueError("the surface is too small")             # <<<<<<<<<<<<<<
20191  *             format = surf.format.format
20192  *         else:
20193  */
20194   __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_the_surface_is_too_small); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1242, __pyx_L1_error)
20195   __Pyx_GOTREF(__pyx_tuple__32);
20196   __Pyx_GIVEREF(__pyx_tuple__32);
20197 
20198   /* "pygame/_sdl2/video.pyx":1245
20199  *             format = surf.format.format
20200  *         else:
20201  *             raise TypeError("'surface' must be a surface or None")             # <<<<<<<<<<<<<<
20202  *
20203  *         if SDL_RenderReadPixels(self._renderer,
20204  */
20205   __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_surface_must_be_a_surface_or_No); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1245, __pyx_L1_error)
20206   __Pyx_GOTREF(__pyx_tuple__33);
20207   __Pyx_GIVEREF(__pyx_tuple__33);
20208 
20209   /* "(tree fragment)":2
20210  * def __reduce_cython__(self):
20211  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
20212  * def __setstate_cython__(self, __pyx_state):
20213  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
20214  */
20215   __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_self__renderer_cannot_be_convert); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 2, __pyx_L1_error)
20216   __Pyx_GOTREF(__pyx_tuple__34);
20217   __Pyx_GIVEREF(__pyx_tuple__34);
20218 
20219   /* "(tree fragment)":4
20220  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")
20221  * def __setstate_cython__(self, __pyx_state):
20222  *     raise TypeError("self._renderer cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
20223  */
20224   __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_self__renderer_cannot_be_convert); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 4, __pyx_L1_error)
20225   __Pyx_GOTREF(__pyx_tuple__35);
20226   __Pyx_GIVEREF(__pyx_tuple__35);
20227 
20228   /* "pygame/_sdl2/video.pyx":65
20229  *
20230  * class RendererDriverInfo:
20231  *     def __repr__(self):             # <<<<<<<<<<<<<<
20232  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
20233  *             self.__class__.__name__,
20234  */
20235   __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 65, __pyx_L1_error)
20236   __Pyx_GOTREF(__pyx_tuple__37);
20237   __Pyx_GIVEREF(__pyx_tuple__37);
20238   __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_repr, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 65, __pyx_L1_error)
20239 
20240   /* "pygame/_sdl2/video.pyx":75
20241  *         )
20242  *
20243  * def get_drivers():             # <<<<<<<<<<<<<<
20244  *     cdef int num = SDL_GetNumRenderDrivers()
20245  *     cdef SDL_RendererInfo info
20246  */
20247   __pyx_tuple__39 = PyTuple_Pack(4, __pyx_n_s_num, __pyx_n_s_info, __pyx_n_s_ind, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 75, __pyx_L1_error)
20248   __Pyx_GOTREF(__pyx_tuple__39);
20249   __Pyx_GIVEREF(__pyx_tuple__39);
20250   __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_get_drivers, 75, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 75, __pyx_L1_error)
20251 
20252   /* "pygame/_sdl2/video.pyx":90
20253  *
20254  *
20255  * def get_grabbed_window():             # <<<<<<<<<<<<<<
20256  *     """return the Window with input grab enabled,
20257  *        or None if input isn't grabbed."""
20258  */
20259   __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_s_win, __pyx_n_s_ptr); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 90, __pyx_L1_error)
20260   __Pyx_GOTREF(__pyx_tuple__40);
20261   __Pyx_GIVEREF(__pyx_tuple__40);
20262   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_get_grabbed_window, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 90, __pyx_L1_error)
20263 
20264   /* "pygame/_sdl2/video.pyx":103
20265  *
20266  *
20267  * def messagebox(title, message,             # <<<<<<<<<<<<<<
20268  *                Window window=None,
20269  *                bint info=False,
20270  */
20271   __pyx_tuple__42 = PyTuple_Pack(17, __pyx_n_s_title, __pyx_n_s_message, __pyx_n_s_window, __pyx_n_s_info, __pyx_n_s_warn, __pyx_n_s_error, __pyx_n_s_buttons, __pyx_n_s_return_button, __pyx_n_s_escape_button, __pyx_n_s_c_buttons, __pyx_n_s_data, __pyx_n_s_button, __pyx_n_s_buttons_utf8, __pyx_n_s_i, __pyx_n_s_but, __pyx_n_s_buttonid, __pyx_n_s_s); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 103, __pyx_L1_error)
20272   __Pyx_GOTREF(__pyx_tuple__42);
20273   __Pyx_GIVEREF(__pyx_tuple__42);
20274   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(9, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_messagebox, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 103, __pyx_L1_error)
20275 
20276   /* "pygame/_sdl2/video.pyx":183
20277  *
20278  * cdef class Window:
20279  *     DEFAULT_SIZE = 640, 480             # <<<<<<<<<<<<<<
20280  *
20281  *     _kwarg_to_flag = {
20282  */
20283   __pyx_tuple__44 = PyTuple_Pack(2, __pyx_int_640, __pyx_int_480); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 183, __pyx_L1_error)
20284   __Pyx_GOTREF(__pyx_tuple__44);
20285   __Pyx_GIVEREF(__pyx_tuple__44);
20286 
20287   /* "pygame/_sdl2/video.pyx":619
20288  *
20289  *     @staticmethod
20290  *     def from_surface(Renderer renderer, surface):             # <<<<<<<<<<<<<<
20291  *         """ Create a texture from an existing surface.
20292  *
20293  */
20294   __pyx_tuple__45 = PyTuple_Pack(5, __pyx_n_s_renderer, __pyx_n_s_surface, __pyx_n_s_self, __pyx_n_s_renderer_2, __pyx_n_s_surf_ptr); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 619, __pyx_L1_error)
20295   __Pyx_GOTREF(__pyx_tuple__45);
20296   __Pyx_GIVEREF(__pyx_tuple__45);
20297   __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame__sdl2_video, __pyx_n_s_from_surface, 619, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 619, __pyx_L1_error)
20298   __Pyx_RefNannyFinishContext();
20299   return 0;
20300   __pyx_L1_error:;
20301   __Pyx_RefNannyFinishContext();
20302   return -1;
20303 }
20304 
__Pyx_InitGlobals(void)20305 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
20306   __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
20307   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
20308   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
20309   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
20310   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
20311   __pyx_int_480 = PyInt_FromLong(480); if (unlikely(!__pyx_int_480)) __PYX_ERR(0, 1, __pyx_L1_error)
20312   __pyx_int_640 = PyInt_FromLong(640); if (unlikely(!__pyx_int_640)) __PYX_ERR(0, 1, __pyx_L1_error)
20313   return 0;
20314   __pyx_L1_error:;
20315   return -1;
20316 }
20317 
20318 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
20319 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
20320 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
20321 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
20322 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
20323 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
20324 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
20325 
__Pyx_modinit_global_init_code(void)20326 static int __Pyx_modinit_global_init_code(void) {
20327   __Pyx_RefNannyDeclarations
20328   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
20329   /*--- Global init code ---*/
20330   __Pyx_RefNannyFinishContext();
20331   return 0;
20332 }
20333 
__Pyx_modinit_variable_export_code(void)20334 static int __Pyx_modinit_variable_export_code(void) {
20335   __Pyx_RefNannyDeclarations
20336   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
20337   /*--- Variable export code ---*/
20338   __Pyx_RefNannyFinishContext();
20339   return 0;
20340 }
20341 
__Pyx_modinit_function_export_code(void)20342 static int __Pyx_modinit_function_export_code(void) {
20343   __Pyx_RefNannyDeclarations
20344   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
20345   /*--- Function export code ---*/
20346   __Pyx_RefNannyFinishContext();
20347   return 0;
20348 }
20349 
__Pyx_modinit_type_init_code(void)20350 static int __Pyx_modinit_type_init_code(void) {
20351   __Pyx_RefNannyDeclarations
20352   PyObject *__pyx_t_1 = NULL;
20353   int __pyx_lineno = 0;
20354   const char *__pyx_filename = NULL;
20355   int __pyx_clineno = 0;
20356   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
20357   /*--- Type init code ---*/
20358   __pyx_t_1 = PyImport_ImportModule("pygame"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 371, __pyx_L1_error)
20359   __Pyx_GOTREF(__pyx_t_1);
20360   __pyx_ptype_6pygame_5_sdl2_5video_Color = __Pyx_ImportType(__pyx_t_1, "pygame", "Color", sizeof(pgColorObject), __Pyx_ImportType_CheckSize_Warn);
20361    if (!__pyx_ptype_6pygame_5_sdl2_5video_Color) __PYX_ERR(2, 371, __pyx_L1_error)
20362   __pyx_ptype_6pygame_5_sdl2_5video_Rect = __Pyx_ImportType(__pyx_t_1, "pygame", "Rect", sizeof(pgRectObject), __Pyx_ImportType_CheckSize_Warn);
20363    if (!__pyx_ptype_6pygame_5_sdl2_5video_Rect) __PYX_ERR(2, 375, __pyx_L1_error)
20364   if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Window) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
20365   #if PY_VERSION_HEX < 0x030800B1
20366   __pyx_type_6pygame_5_sdl2_5video_Window.tp_print = 0;
20367   #endif
20368   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video_Window.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video_Window.tp_getattro == PyObject_GenericGetAttr)) {
20369     __pyx_type_6pygame_5_sdl2_5video_Window.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20370   }
20371   #if CYTHON_COMPILING_IN_CPYTHON
20372   {
20373     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Window, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 182, __pyx_L1_error)
20374     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
20375       __pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
20376       __pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_6Window_2__init__;
20377       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_5_sdl2_5video_6Window_2__init__;
20378     }
20379   }
20380   #endif
20381   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Window, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Window) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
20382   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Window) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
20383   __pyx_ptype_6pygame_5_sdl2_5video_Window = &__pyx_type_6pygame_5_sdl2_5video_Window;
20384   __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer = &__pyx_vtable_6pygame_5_sdl2_5video_Renderer;
20385   __pyx_vtable_6pygame_5_sdl2_5video_Renderer.get_viewport = (PyObject *(*)(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *, int __pyx_skip_dispatch))__pyx_f_6pygame_5_sdl2_5video_8Renderer_get_viewport;
20386   __pyx_vtable_6pygame_5_sdl2_5video_Renderer.blit = (PyObject *(*)(struct __pyx_obj_6pygame_5_sdl2_5video_Renderer *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_8Renderer_blit *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_8Renderer_blit;
20387   if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
20388   #if PY_VERSION_HEX < 0x030800B1
20389   __pyx_type_6pygame_5_sdl2_5video_Renderer.tp_print = 0;
20390   #endif
20391   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video_Renderer.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video_Renderer.tp_getattro == PyObject_GenericGetAttr)) {
20392     __pyx_type_6pygame_5_sdl2_5video_Renderer.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20393   }
20394   #if CYTHON_COMPILING_IN_CPYTHON
20395   {
20396     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Renderer, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 922, __pyx_L1_error)
20397     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
20398       __pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
20399       __pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_8Renderer_2__init__;
20400       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_5_sdl2_5video_8Renderer_2__init__;
20401     }
20402   }
20403   #endif
20404   if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Renderer.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
20405   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Renderer, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
20406   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Renderer) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
20407   __pyx_ptype_6pygame_5_sdl2_5video_Renderer = &__pyx_type_6pygame_5_sdl2_5video_Renderer;
20408   __pyx_vtabptr_6pygame_5_sdl2_5video_Texture = &__pyx_vtable_6pygame_5_sdl2_5video_Texture;
20409   __pyx_vtable_6pygame_5_sdl2_5video_Texture.draw_internal = (PyObject *(*)(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *, SDL_Rect *, SDL_Rect *, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw_internal *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_7Texture_draw_internal;
20410   __pyx_vtable_6pygame_5_sdl2_5video_Texture.draw = (void (*)(struct __pyx_obj_6pygame_5_sdl2_5video_Texture *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_7Texture_draw *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_7Texture_draw;
20411   if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 553, __pyx_L1_error)
20412   #if PY_VERSION_HEX < 0x030800B1
20413   __pyx_type_6pygame_5_sdl2_5video_Texture.tp_print = 0;
20414   #endif
20415   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video_Texture.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video_Texture.tp_getattro == PyObject_GenericGetAttr)) {
20416     __pyx_type_6pygame_5_sdl2_5video_Texture.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20417   }
20418   #if CYTHON_COMPILING_IN_CPYTHON
20419   {
20420     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Texture, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 553, __pyx_L1_error)
20421     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
20422       __pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
20423       __pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__.doc = __pyx_doc_6pygame_5_sdl2_5video_7Texture_2__init__;
20424       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_5_sdl2_5video_7Texture_2__init__;
20425     }
20426   }
20427   #endif
20428   if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Texture.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 553, __pyx_L1_error)
20429   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Texture, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 553, __pyx_L1_error)
20430   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Texture) < 0) __PYX_ERR(0, 553, __pyx_L1_error)
20431   __pyx_ptype_6pygame_5_sdl2_5video_Texture = &__pyx_type_6pygame_5_sdl2_5video_Texture;
20432   __pyx_vtabptr_6pygame_5_sdl2_5video_Image = &__pyx_vtable_6pygame_5_sdl2_5video_Image;
20433   __pyx_vtable_6pygame_5_sdl2_5video_Image.draw = (void (*)(struct __pyx_obj_6pygame_5_sdl2_5video_Image *, int __pyx_skip_dispatch, struct __pyx_opt_args_6pygame_5_sdl2_5video_5Image_draw *__pyx_optional_args))__pyx_f_6pygame_5_sdl2_5video_5Image_draw;
20434   if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
20435   #if PY_VERSION_HEX < 0x030800B1
20436   __pyx_type_6pygame_5_sdl2_5video_Image.tp_print = 0;
20437   #endif
20438   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video_Image.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video_Image.tp_getattro == PyObject_GenericGetAttr)) {
20439     __pyx_type_6pygame_5_sdl2_5video_Image.tp_getattro = __Pyx_PyObject_GenericGetAttr;
20440   }
20441   if (__Pyx_SetVtable(__pyx_type_6pygame_5_sdl2_5video_Image.tp_dict, __pyx_vtabptr_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
20442   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Image, (PyObject *)&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
20443   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_5_sdl2_5video_Image) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
20444   __pyx_ptype_6pygame_5_sdl2_5video_Image = &__pyx_type_6pygame_5_sdl2_5video_Image;
20445   if (PyType_Ready(&__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
20446   #if PY_VERSION_HEX < 0x030800B1
20447   __pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers.tp_print = 0;
20448   #endif
20449   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers.tp_dictoffset && __pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers.tp_getattro == PyObject_GenericGetAttr)) {
20450     __pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
20451   }
20452   __pyx_ptype_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers = &__pyx_type_6pygame_5_sdl2_5video___pyx_scope_struct__get_drivers;
20453   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20454   __Pyx_RefNannyFinishContext();
20455   return 0;
20456   __pyx_L1_error:;
20457   __Pyx_XDECREF(__pyx_t_1);
20458   __Pyx_RefNannyFinishContext();
20459   return -1;
20460 }
20461 
__Pyx_modinit_type_import_code(void)20462 static int __Pyx_modinit_type_import_code(void) {
20463   __Pyx_RefNannyDeclarations
20464   PyObject *__pyx_t_1 = NULL;
20465   int __pyx_lineno = 0;
20466   const char *__pyx_filename = NULL;
20467   int __pyx_clineno = 0;
20468   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
20469   /*--- Type import code ---*/
20470   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
20471   __Pyx_GOTREF(__pyx_t_1);
20472   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
20473   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
20474   sizeof(PyTypeObject),
20475   #else
20476   sizeof(PyHeapTypeObject),
20477   #endif
20478   __Pyx_ImportType_CheckSize_Warn);
20479    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
20480   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20481   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
20482   __Pyx_GOTREF(__pyx_t_1);
20483   __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
20484    if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error)
20485   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20486   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error)
20487   __Pyx_GOTREF(__pyx_t_1);
20488   __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
20489    if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error)
20490   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20491   __Pyx_RefNannyFinishContext();
20492   return 0;
20493   __pyx_L1_error:;
20494   __Pyx_XDECREF(__pyx_t_1);
20495   __Pyx_RefNannyFinishContext();
20496   return -1;
20497 }
20498 
__Pyx_modinit_variable_import_code(void)20499 static int __Pyx_modinit_variable_import_code(void) {
20500   __Pyx_RefNannyDeclarations
20501   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
20502   /*--- Variable import code ---*/
20503   __Pyx_RefNannyFinishContext();
20504   return 0;
20505 }
20506 
__Pyx_modinit_function_import_code(void)20507 static int __Pyx_modinit_function_import_code(void) {
20508   __Pyx_RefNannyDeclarations
20509   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
20510   /*--- Function import code ---*/
20511   __Pyx_RefNannyFinishContext();
20512   return 0;
20513 }
20514 
20515 
20516 #ifndef CYTHON_NO_PYINIT_EXPORT
20517 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
20518 #elif PY_MAJOR_VERSION < 3
20519 #ifdef __cplusplus
20520 #define __Pyx_PyMODINIT_FUNC extern "C" void
20521 #else
20522 #define __Pyx_PyMODINIT_FUNC void
20523 #endif
20524 #else
20525 #ifdef __cplusplus
20526 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
20527 #else
20528 #define __Pyx_PyMODINIT_FUNC PyObject *
20529 #endif
20530 #endif
20531 
20532 
20533 #if PY_MAJOR_VERSION < 3
20534 __Pyx_PyMODINIT_FUNC initvideo(void) CYTHON_SMALL_CODE; /*proto*/
initvideo(void)20535 __Pyx_PyMODINIT_FUNC initvideo(void)
20536 #else
20537 __Pyx_PyMODINIT_FUNC PyInit_video(void) CYTHON_SMALL_CODE; /*proto*/
20538 __Pyx_PyMODINIT_FUNC PyInit_video(void)
20539 #if CYTHON_PEP489_MULTI_PHASE_INIT
20540 {
20541   return PyModuleDef_Init(&__pyx_moduledef);
20542 }
20543 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
20544     #if PY_VERSION_HEX >= 0x030700A1
20545     static PY_INT64_T main_interpreter_id = -1;
20546     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
20547     if (main_interpreter_id == -1) {
20548         main_interpreter_id = current_id;
20549         return (unlikely(current_id == -1)) ? -1 : 0;
20550     } else if (unlikely(main_interpreter_id != current_id))
20551     #else
20552     static PyInterpreterState *main_interpreter = NULL;
20553     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
20554     if (!main_interpreter) {
20555         main_interpreter = current_interpreter;
20556     } else if (unlikely(main_interpreter != current_interpreter))
20557     #endif
20558     {
20559         PyErr_SetString(
20560             PyExc_ImportError,
20561             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
20562         return -1;
20563     }
20564     return 0;
20565 }
20566 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
20567     PyObject *value = PyObject_GetAttrString(spec, from_name);
20568     int result = 0;
20569     if (likely(value)) {
20570         if (allow_none || value != Py_None) {
20571             result = PyDict_SetItemString(moddict, to_name, value);
20572         }
20573         Py_DECREF(value);
20574     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
20575         PyErr_Clear();
20576     } else {
20577         result = -1;
20578     }
20579     return result;
20580 }
20581 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
20582     PyObject *module = NULL, *moddict, *modname;
20583     if (__Pyx_check_single_interpreter())
20584         return NULL;
20585     if (__pyx_m)
20586         return __Pyx_NewRef(__pyx_m);
20587     modname = PyObject_GetAttrString(spec, "name");
20588     if (unlikely(!modname)) goto bad;
20589     module = PyModule_NewObject(modname);
20590     Py_DECREF(modname);
20591     if (unlikely(!module)) goto bad;
20592     moddict = PyModule_GetDict(module);
20593     if (unlikely(!moddict)) goto bad;
20594     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
20595     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
20596     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
20597     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
20598     return module;
20599 bad:
20600     Py_XDECREF(module);
20601     return NULL;
20602 }
20603 
20604 
20605 static CYTHON_SMALL_CODE int __pyx_pymod_exec_video(PyObject *__pyx_pyinit_module)
20606 #endif
20607 #endif
20608 {
20609   PyObject *__pyx_t_1 = NULL;
20610   PyObject *__pyx_t_2 = NULL;
20611   int __pyx_lineno = 0;
20612   const char *__pyx_filename = NULL;
20613   int __pyx_clineno = 0;
20614   __Pyx_RefNannyDeclarations
20615   #if CYTHON_PEP489_MULTI_PHASE_INIT
20616   if (__pyx_m) {
20617     if (__pyx_m == __pyx_pyinit_module) return 0;
20618     PyErr_SetString(PyExc_RuntimeError, "Module 'video' has already been imported. Re-initialisation is not supported.");
20619     return -1;
20620   }
20621   #elif PY_MAJOR_VERSION >= 3
20622   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
20623   #endif
20624   #if CYTHON_REFNANNY
20625 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
20626 if (!__Pyx_RefNanny) {
20627   PyErr_Clear();
20628   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
20629   if (!__Pyx_RefNanny)
20630       Py_FatalError("failed to import 'refnanny' module");
20631 }
20632 #endif
20633   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_video(void)", 0);
20634   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20635   #ifdef __Pxy_PyFrame_Initialize_Offsets
20636   __Pxy_PyFrame_Initialize_Offsets();
20637   #endif
20638   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
20639   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
20640   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
20641   #ifdef __Pyx_CyFunction_USED
20642   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20643   #endif
20644   #ifdef __Pyx_FusedFunction_USED
20645   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20646   #endif
20647   #ifdef __Pyx_Coroutine_USED
20648   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20649   #endif
20650   #ifdef __Pyx_Generator_USED
20651   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20652   #endif
20653   #ifdef __Pyx_AsyncGen_USED
20654   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20655   #endif
20656   #ifdef __Pyx_StopAsyncIteration_USED
20657   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20658   #endif
20659   /*--- Library function declarations ---*/
20660   /*--- Threads initialization code ---*/
20661   #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
20662   PyEval_InitThreads();
20663   #endif
20664   /*--- Module creation code ---*/
20665   #if CYTHON_PEP489_MULTI_PHASE_INIT
20666   __pyx_m = __pyx_pyinit_module;
20667   Py_INCREF(__pyx_m);
20668   #else
20669   #if PY_MAJOR_VERSION < 3
20670   __pyx_m = Py_InitModule4("video", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
20671   #else
20672   __pyx_m = PyModule_Create(&__pyx_moduledef);
20673   #endif
20674   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
20675   #endif
20676   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
20677   Py_INCREF(__pyx_d);
20678   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
20679   Py_INCREF(__pyx_b);
20680   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
20681   Py_INCREF(__pyx_cython_runtime);
20682   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
20683   /*--- Initialize various global constants etc. ---*/
20684   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20685   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
20686   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20687   #endif
20688   if (__pyx_module_is_main_pygame___sdl2__video) {
20689     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20690   }
20691   #if PY_MAJOR_VERSION >= 3
20692   {
20693     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
20694     if (!PyDict_GetItemString(modules, "pygame._sdl2.video")) {
20695       if (unlikely(PyDict_SetItemString(modules, "pygame._sdl2.video", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
20696     }
20697   }
20698   #endif
20699   /*--- Builtin init code ---*/
20700   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20701   /*--- Constants init code ---*/
20702   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20703   /*--- Global type/function init code ---*/
20704   (void)__Pyx_modinit_global_init_code();
20705   (void)__Pyx_modinit_variable_export_code();
20706   (void)__Pyx_modinit_function_export_code();
20707   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
20708   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
20709   (void)__Pyx_modinit_variable_import_code();
20710   (void)__Pyx_modinit_function_import_code();
20711   /*--- Execution code ---*/
20712   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
20713   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
20714   #endif
20715 
20716   /* "pygame/_sdl2/video.pyx":2
20717  * from cpython cimport PyObject
20718  * from . import error             # <<<<<<<<<<<<<<
20719  * from . import error as errorfnc
20720  * from libc.stdlib cimport free, malloc
20721  */
20722   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
20723   __Pyx_GOTREF(__pyx_t_1);
20724   __Pyx_INCREF(__pyx_n_s_error);
20725   __Pyx_GIVEREF(__pyx_n_s_error);
20726   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_error);
20727   __pyx_t_2 = __Pyx_Import(__pyx_n_s__36, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
20728   __Pyx_GOTREF(__pyx_t_2);
20729   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20730   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
20731   __Pyx_GOTREF(__pyx_t_1);
20732   if (PyDict_SetItem(__pyx_d, __pyx_n_s_error, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
20733   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20734   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20735 
20736   /* "pygame/_sdl2/video.pyx":3
20737  * from cpython cimport PyObject
20738  * from . import error
20739  * from . import error as errorfnc             # <<<<<<<<<<<<<<
20740  * from libc.stdlib cimport free, malloc
20741  *
20742  */
20743   __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
20744   __Pyx_GOTREF(__pyx_t_2);
20745   __Pyx_INCREF(__pyx_n_s_error);
20746   __Pyx_GIVEREF(__pyx_n_s_error);
20747   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_error);
20748   __pyx_t_1 = __Pyx_Import(__pyx_n_s__36, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
20749   __Pyx_GOTREF(__pyx_t_1);
20750   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20751   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
20752   __Pyx_GOTREF(__pyx_t_2);
20753   if (PyDict_SetItem(__pyx_d, __pyx_n_s_errorfnc, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
20754   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20755   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20756 
20757   /* "pygame/_sdl2/video.pyx":7
20758  *
20759  *
20760  * WINDOWPOS_UNDEFINED = _SDL_WINDOWPOS_UNDEFINED             # <<<<<<<<<<<<<<
20761  * WINDOWPOS_CENTERED = _SDL_WINDOWPOS_CENTERED
20762  *
20763  */
20764   __pyx_t_1 = __Pyx_PyInt_From_int(SDL_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
20765   __Pyx_GOTREF(__pyx_t_1);
20766   if (PyDict_SetItem(__pyx_d, __pyx_n_s_WINDOWPOS_UNDEFINED, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
20767   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20768 
20769   /* "pygame/_sdl2/video.pyx":8
20770  *
20771  * WINDOWPOS_UNDEFINED = _SDL_WINDOWPOS_UNDEFINED
20772  * WINDOWPOS_CENTERED = _SDL_WINDOWPOS_CENTERED             # <<<<<<<<<<<<<<
20773  *
20774  * MESSAGEBOX_ERROR = _SDL_MESSAGEBOX_ERROR
20775  */
20776   __pyx_t_1 = __Pyx_PyInt_From_int(SDL_WINDOWPOS_CENTERED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
20777   __Pyx_GOTREF(__pyx_t_1);
20778   if (PyDict_SetItem(__pyx_d, __pyx_n_s_WINDOWPOS_CENTERED, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
20779   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20780 
20781   /* "pygame/_sdl2/video.pyx":10
20782  * WINDOWPOS_CENTERED = _SDL_WINDOWPOS_CENTERED
20783  *
20784  * MESSAGEBOX_ERROR = _SDL_MESSAGEBOX_ERROR             # <<<<<<<<<<<<<<
20785  * MESSAGEBOX_WARNING = _SDL_MESSAGEBOX_WARNING
20786  * MESSAGEBOX_INFORMATION = _SDL_MESSAGEBOX_INFORMATION
20787  */
20788   __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_MESSAGEBOX_ERROR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
20789   __Pyx_GOTREF(__pyx_t_1);
20790   if (PyDict_SetItem(__pyx_d, __pyx_n_s_MESSAGEBOX_ERROR, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
20791   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20792 
20793   /* "pygame/_sdl2/video.pyx":11
20794  *
20795  * MESSAGEBOX_ERROR = _SDL_MESSAGEBOX_ERROR
20796  * MESSAGEBOX_WARNING = _SDL_MESSAGEBOX_WARNING             # <<<<<<<<<<<<<<
20797  * MESSAGEBOX_INFORMATION = _SDL_MESSAGEBOX_INFORMATION
20798  *
20799  */
20800   __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_MESSAGEBOX_WARNING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
20801   __Pyx_GOTREF(__pyx_t_1);
20802   if (PyDict_SetItem(__pyx_d, __pyx_n_s_MESSAGEBOX_WARNING, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
20803   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20804 
20805   /* "pygame/_sdl2/video.pyx":12
20806  * MESSAGEBOX_ERROR = _SDL_MESSAGEBOX_ERROR
20807  * MESSAGEBOX_WARNING = _SDL_MESSAGEBOX_WARNING
20808  * MESSAGEBOX_INFORMATION = _SDL_MESSAGEBOX_INFORMATION             # <<<<<<<<<<<<<<
20809  *
20810  *
20811  */
20812   __pyx_t_1 = __Pyx_PyInt_From_Uint32(SDL_MESSAGEBOX_INFORMATION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
20813   __Pyx_GOTREF(__pyx_t_1);
20814   if (PyDict_SetItem(__pyx_d, __pyx_n_s_MESSAGEBOX_INFORMATION, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
20815   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20816 
20817   /* "pygame/_sdl2/video.pyx":59
20818  *     pass
20819  *
20820  * import_pygame_base()             # <<<<<<<<<<<<<<
20821  * import_pygame_color()
20822  * import_pygame_surface()
20823  */
20824   import_pygame_base();
20825 
20826   /* "pygame/_sdl2/video.pyx":60
20827  *
20828  * import_pygame_base()
20829  * import_pygame_color()             # <<<<<<<<<<<<<<
20830  * import_pygame_surface()
20831  * import_pygame_rect()
20832  */
20833   import_pygame_color();
20834 
20835   /* "pygame/_sdl2/video.pyx":61
20836  * import_pygame_base()
20837  * import_pygame_color()
20838  * import_pygame_surface()             # <<<<<<<<<<<<<<
20839  * import_pygame_rect()
20840  *
20841  */
20842   import_pygame_surface();
20843 
20844   /* "pygame/_sdl2/video.pyx":62
20845  * import_pygame_color()
20846  * import_pygame_surface()
20847  * import_pygame_rect()             # <<<<<<<<<<<<<<
20848  *
20849  * class RendererDriverInfo:
20850  */
20851   import_pygame_rect();
20852 
20853   /* "pygame/_sdl2/video.pyx":64
20854  * import_pygame_rect()
20855  *
20856  * class RendererDriverInfo:             # <<<<<<<<<<<<<<
20857  *     def __repr__(self):
20858  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
20859  */
20860   __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_RendererDriverInfo, __pyx_n_s_RendererDriverInfo, (PyObject *) NULL, __pyx_n_s_pygame__sdl2_video, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
20861   __Pyx_GOTREF(__pyx_t_1);
20862 
20863   /* "pygame/_sdl2/video.pyx":65
20864  *
20865  * class RendererDriverInfo:
20866  *     def __repr__(self):             # <<<<<<<<<<<<<<
20867  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
20868  *             self.__class__.__name__,
20869  */
20870   __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6pygame_5_sdl2_5video_18RendererDriverInfo_1__repr__, 0, __pyx_n_s_RendererDriverInfo___repr, NULL, __pyx_n_s_pygame__sdl2_video, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)
20871   __Pyx_GOTREF(__pyx_t_2);
20872   if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_2) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
20873   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20874 
20875   /* "pygame/_sdl2/video.pyx":64
20876  * import_pygame_rect()
20877  *
20878  * class RendererDriverInfo:             # <<<<<<<<<<<<<<
20879  *     def __repr__(self):
20880  *         return "<%s(name: %s, flags: 0x%02x, num_texture_formats: %d, max_texture_width: %d, max_texture_height: %d)>" % (
20881  */
20882   __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_RendererDriverInfo, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
20883   __Pyx_GOTREF(__pyx_t_2);
20884   if (PyDict_SetItem(__pyx_d, __pyx_n_s_RendererDriverInfo, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
20885   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20886   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20887 
20888   /* "pygame/_sdl2/video.pyx":75
20889  *         )
20890  *
20891  * def get_drivers():             # <<<<<<<<<<<<<<
20892  *     cdef int num = SDL_GetNumRenderDrivers()
20893  *     cdef SDL_RendererInfo info
20894  */
20895   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_1get_drivers, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
20896   __Pyx_GOTREF(__pyx_t_1);
20897   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_drivers, __pyx_t_1) < 0) __PYX_ERR(0, 75, __pyx_L1_error)
20898   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20899 
20900   /* "pygame/_sdl2/video.pyx":90
20901  *
20902  *
20903  * def get_grabbed_window():             # <<<<<<<<<<<<<<
20904  *     """return the Window with input grab enabled,
20905  *        or None if input isn't grabbed."""
20906  */
20907   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_4get_grabbed_window, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
20908   __Pyx_GOTREF(__pyx_t_1);
20909   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_grabbed_window, __pyx_t_1) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
20910   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20911 
20912   /* "pygame/_sdl2/video.pyx":103
20913  *
20914  *
20915  * def messagebox(title, message,             # <<<<<<<<<<<<<<
20916  *                Window window=None,
20917  *                bint info=False,
20918  */
20919   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_6messagebox, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
20920   __Pyx_GOTREF(__pyx_t_1);
20921   if (PyDict_SetItem(__pyx_d, __pyx_n_s_messagebox, __pyx_t_1) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
20922   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20923 
20924   /* "pygame/_sdl2/video.pyx":183
20925  *
20926  * cdef class Window:
20927  *     DEFAULT_SIZE = 640, 480             # <<<<<<<<<<<<<<
20928  *
20929  *     _kwarg_to_flag = {
20930  */
20931   if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window->tp_dict, __pyx_n_s_DEFAULT_SIZE, __pyx_tuple__44) < 0) __PYX_ERR(0, 183, __pyx_L1_error)
20932   PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Window);
20933 
20934   /* "pygame/_sdl2/video.pyx":186
20935  *
20936  *     _kwarg_to_flag = {
20937  *         'opengl': _SDL_WINDOW_OPENGL,             # <<<<<<<<<<<<<<
20938  *         'vulkan': _SDL_WINDOW_VULKAN,
20939  *         'hidden': _SDL_WINDOW_HIDDEN,
20940  */
20941   __pyx_t_1 = __Pyx_PyDict_NewPresized(18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
20942   __Pyx_GOTREF(__pyx_t_1);
20943   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_OPENGL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
20944   __Pyx_GOTREF(__pyx_t_2);
20945   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_opengl, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
20946   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20947 
20948   /* "pygame/_sdl2/video.pyx":187
20949  *     _kwarg_to_flag = {
20950  *         'opengl': _SDL_WINDOW_OPENGL,
20951  *         'vulkan': _SDL_WINDOW_VULKAN,             # <<<<<<<<<<<<<<
20952  *         'hidden': _SDL_WINDOW_HIDDEN,
20953  *         'borderless': _SDL_WINDOW_BORDERLESS,
20954  */
20955   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_VULKAN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
20956   __Pyx_GOTREF(__pyx_t_2);
20957   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_vulkan, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
20958   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20959 
20960   /* "pygame/_sdl2/video.pyx":188
20961  *         'opengl': _SDL_WINDOW_OPENGL,
20962  *         'vulkan': _SDL_WINDOW_VULKAN,
20963  *         'hidden': _SDL_WINDOW_HIDDEN,             # <<<<<<<<<<<<<<
20964  *         'borderless': _SDL_WINDOW_BORDERLESS,
20965  *         'resizable': _SDL_WINDOW_RESIZABLE,
20966  */
20967   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_HIDDEN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
20968   __Pyx_GOTREF(__pyx_t_2);
20969   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_hidden, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
20970   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20971 
20972   /* "pygame/_sdl2/video.pyx":189
20973  *         'vulkan': _SDL_WINDOW_VULKAN,
20974  *         'hidden': _SDL_WINDOW_HIDDEN,
20975  *         'borderless': _SDL_WINDOW_BORDERLESS,             # <<<<<<<<<<<<<<
20976  *         'resizable': _SDL_WINDOW_RESIZABLE,
20977  *         'minimized': _SDL_WINDOW_MINIMIZED,
20978  */
20979   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_BORDERLESS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
20980   __Pyx_GOTREF(__pyx_t_2);
20981   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_borderless, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
20982   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20983 
20984   /* "pygame/_sdl2/video.pyx":190
20985  *         'hidden': _SDL_WINDOW_HIDDEN,
20986  *         'borderless': _SDL_WINDOW_BORDERLESS,
20987  *         'resizable': _SDL_WINDOW_RESIZABLE,             # <<<<<<<<<<<<<<
20988  *         'minimized': _SDL_WINDOW_MINIMIZED,
20989  *         'maximized': _SDL_WINDOW_MAXIMIZED,
20990  */
20991   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_RESIZABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
20992   __Pyx_GOTREF(__pyx_t_2);
20993   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_resizable, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
20994   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20995 
20996   /* "pygame/_sdl2/video.pyx":191
20997  *         'borderless': _SDL_WINDOW_BORDERLESS,
20998  *         'resizable': _SDL_WINDOW_RESIZABLE,
20999  *         'minimized': _SDL_WINDOW_MINIMIZED,             # <<<<<<<<<<<<<<
21000  *         'maximized': _SDL_WINDOW_MAXIMIZED,
21001  *         'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
21002  */
21003   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MINIMIZED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
21004   __Pyx_GOTREF(__pyx_t_2);
21005   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minimized, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21006   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21007 
21008   /* "pygame/_sdl2/video.pyx":192
21009  *         'resizable': _SDL_WINDOW_RESIZABLE,
21010  *         'minimized': _SDL_WINDOW_MINIMIZED,
21011  *         'maximized': _SDL_WINDOW_MAXIMIZED,             # <<<<<<<<<<<<<<
21012  *         'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
21013  *         'input_focus': _SDL_WINDOW_INPUT_FOCUS,
21014  */
21015   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MAXIMIZED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
21016   __Pyx_GOTREF(__pyx_t_2);
21017   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_maximized, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21018   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21019 
21020   /* "pygame/_sdl2/video.pyx":193
21021  *         'minimized': _SDL_WINDOW_MINIMIZED,
21022  *         'maximized': _SDL_WINDOW_MAXIMIZED,
21023  *         'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,             # <<<<<<<<<<<<<<
21024  *         'input_focus': _SDL_WINDOW_INPUT_FOCUS,
21025  *         'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
21026  */
21027   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_INPUT_GRABBED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
21028   __Pyx_GOTREF(__pyx_t_2);
21029   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_input_grabbed, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21030   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21031 
21032   /* "pygame/_sdl2/video.pyx":194
21033  *         'maximized': _SDL_WINDOW_MAXIMIZED,
21034  *         'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
21035  *         'input_focus': _SDL_WINDOW_INPUT_FOCUS,             # <<<<<<<<<<<<<<
21036  *         'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
21037  *         'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
21038  */
21039   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_INPUT_FOCUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
21040   __Pyx_GOTREF(__pyx_t_2);
21041   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_input_focus, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21042   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21043 
21044   /* "pygame/_sdl2/video.pyx":195
21045  *         'input_grabbed': _SDL_WINDOW_INPUT_GRABBED,
21046  *         'input_focus': _SDL_WINDOW_INPUT_FOCUS,
21047  *         'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,             # <<<<<<<<<<<<<<
21048  *         'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
21049  *         'foreign': _SDL_WINDOW_FOREIGN,
21050  */
21051   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MOUSE_FOCUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
21052   __Pyx_GOTREF(__pyx_t_2);
21053   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mouse_focus, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21054   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21055 
21056   /* "pygame/_sdl2/video.pyx":196
21057  *         'input_focus': _SDL_WINDOW_INPUT_FOCUS,
21058  *         'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
21059  *         'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,             # <<<<<<<<<<<<<<
21060  *         'foreign': _SDL_WINDOW_FOREIGN,
21061  *         'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
21062  */
21063   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_ALLOW_HIGHDPI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
21064   __Pyx_GOTREF(__pyx_t_2);
21065   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allow_highdpi, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21066   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21067 
21068   /* "pygame/_sdl2/video.pyx":197
21069  *         'mouse_focus': _SDL_WINDOW_MOUSE_FOCUS,
21070  *         'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
21071  *         'foreign': _SDL_WINDOW_FOREIGN,             # <<<<<<<<<<<<<<
21072  *         'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
21073  *         'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
21074  */
21075   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_FOREIGN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error)
21076   __Pyx_GOTREF(__pyx_t_2);
21077   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_foreign, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21078   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21079 
21080   /* "pygame/_sdl2/video.pyx":198
21081  *         'allow_highdpi': _SDL_WINDOW_ALLOW_HIGHDPI,
21082  *         'foreign': _SDL_WINDOW_FOREIGN,
21083  *         'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,             # <<<<<<<<<<<<<<
21084  *         'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
21085  *         'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
21086  */
21087   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_MOUSE_CAPTURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
21088   __Pyx_GOTREF(__pyx_t_2);
21089   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mouse_capture, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21090   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21091 
21092   /* "pygame/_sdl2/video.pyx":199
21093  *         'foreign': _SDL_WINDOW_FOREIGN,
21094  *         'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
21095  *         'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,             # <<<<<<<<<<<<<<
21096  *         'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
21097  *         'utility': _SDL_WINDOW_UTILITY,
21098  */
21099   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_ALWAYS_ON_TOP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
21100   __Pyx_GOTREF(__pyx_t_2);
21101   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_always_on_top, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21102   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21103 
21104   /* "pygame/_sdl2/video.pyx":200
21105  *         'mouse_capture': _SDL_WINDOW_MOUSE_CAPTURE,
21106  *         'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
21107  *         'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,             # <<<<<<<<<<<<<<
21108  *         'utility': _SDL_WINDOW_UTILITY,
21109  *         'tooltip': _SDL_WINDOW_TOOLTIP,
21110  */
21111   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_SKIP_TASKBAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error)
21112   __Pyx_GOTREF(__pyx_t_2);
21113   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_skip_taskbar, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21114   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21115 
21116   /* "pygame/_sdl2/video.pyx":201
21117  *         'always_on_top': _SDL_WINDOW_ALWAYS_ON_TOP,
21118  *         'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
21119  *         'utility': _SDL_WINDOW_UTILITY,             # <<<<<<<<<<<<<<
21120  *         'tooltip': _SDL_WINDOW_TOOLTIP,
21121  *         'popup_menu': _SDL_WINDOW_POPUP_MENU,
21122  */
21123   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_UTILITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
21124   __Pyx_GOTREF(__pyx_t_2);
21125   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_utility, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21126   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21127 
21128   /* "pygame/_sdl2/video.pyx":202
21129  *         'skip_taskbar': _SDL_WINDOW_SKIP_TASKBAR,
21130  *         'utility': _SDL_WINDOW_UTILITY,
21131  *         'tooltip': _SDL_WINDOW_TOOLTIP,             # <<<<<<<<<<<<<<
21132  *         'popup_menu': _SDL_WINDOW_POPUP_MENU,
21133  *     }
21134  */
21135   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_TOOLTIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
21136   __Pyx_GOTREF(__pyx_t_2);
21137   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_tooltip, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21138   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21139 
21140   /* "pygame/_sdl2/video.pyx":203
21141  *         'utility': _SDL_WINDOW_UTILITY,
21142  *         'tooltip': _SDL_WINDOW_TOOLTIP,
21143  *         'popup_menu': _SDL_WINDOW_POPUP_MENU,             # <<<<<<<<<<<<<<
21144  *     }
21145  *
21146  */
21147   __pyx_t_2 = __Pyx_PyInt_From_Uint32(SDL_WINDOW_POPUP_MENU); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
21148   __Pyx_GOTREF(__pyx_t_2);
21149   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_popup_menu, __pyx_t_2) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
21150   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21151   if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window->tp_dict, __pyx_n_s_kwarg_to_flag, __pyx_t_1) < 0) __PYX_ERR(0, 185, __pyx_L1_error)
21152   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21153   PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Window);
21154 
21155   /* "pygame/_sdl2/video.pyx":207
21156  *
21157  *     @classmethod
21158  *     def from_display_module(cls):             # <<<<<<<<<<<<<<
21159  *         cdef Window self = cls.__new__(cls)
21160  *         cdef SDL_Window* window = pg_GetDefaultWindow()
21161  */
21162   __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window, __pyx_n_s_from_display_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
21163   __Pyx_GOTREF(__pyx_t_1);
21164 
21165   /* "pygame/_sdl2/video.pyx":206
21166  *     }
21167  *
21168  *     @classmethod             # <<<<<<<<<<<<<<
21169  *     def from_display_module(cls):
21170  *         cdef Window self = cls.__new__(cls)
21171  */
21172   __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error)
21173   __Pyx_GOTREF(__pyx_t_2);
21174   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21175   if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window->tp_dict, __pyx_n_s_from_display_module, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
21176   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21177   PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Window);
21178 
21179   /* "pygame/_sdl2/video.pyx":218
21180  *
21181  *     def __init__(self, title='pygame',
21182  *                  size=DEFAULT_SIZE,             # <<<<<<<<<<<<<<
21183  *                  position=WINDOWPOS_UNDEFINED,
21184  *                  bint fullscreen=False,
21185  */
21186   __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Window, __pyx_n_s_DEFAULT_SIZE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
21187   __Pyx_GOTREF(__pyx_t_2);
21188   __pyx_k__3 = __pyx_t_2;
21189   __Pyx_GIVEREF(__pyx_t_2);
21190   __pyx_t_2 = 0;
21191 
21192   /* "pygame/_sdl2/video.pyx":219
21193  *     def __init__(self, title='pygame',
21194  *                  size=DEFAULT_SIZE,
21195  *                  position=WINDOWPOS_UNDEFINED,             # <<<<<<<<<<<<<<
21196  *                  bint fullscreen=False,
21197  *                  bint fullscreen_desktop=False, **kwargs):
21198  */
21199   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_WINDOWPOS_UNDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error)
21200   __Pyx_GOTREF(__pyx_t_2);
21201   __pyx_k__4 = __pyx_t_2;
21202   __Pyx_GIVEREF(__pyx_t_2);
21203   __pyx_t_2 = 0;
21204 
21205   /* "pygame/_sdl2/video.pyx":619
21206  *
21207  *     @staticmethod
21208  *     def from_surface(Renderer renderer, surface):             # <<<<<<<<<<<<<<
21209  *         """ Create a texture from an existing surface.
21210  *
21211  */
21212   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6pygame_5_sdl2_5video_7Texture_5from_surface, NULL, __pyx_n_s_pygame__sdl2_video); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error)
21213   __Pyx_GOTREF(__pyx_t_2);
21214   if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict, __pyx_n_s_from_surface, __pyx_t_2) < 0) __PYX_ERR(0, 619, __pyx_L1_error)
21215   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21216   PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Texture);
21217 
21218   /* "pygame/_sdl2/video.pyx":618
21219  *         self.width, self.height = width, height
21220  *
21221  *     @staticmethod             # <<<<<<<<<<<<<<
21222  *     def from_surface(Renderer renderer, surface):
21223  *         """ Create a texture from an existing surface.
21224  */
21225   __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture, __pyx_n_s_from_surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error)
21226   __Pyx_GOTREF(__pyx_t_2);
21227   __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
21228   __Pyx_GOTREF(__pyx_t_1);
21229   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21230   if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Texture->tp_dict, __pyx_n_s_from_surface, __pyx_t_1) < 0) __PYX_ERR(0, 619, __pyx_L1_error)
21231   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21232   PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Texture);
21233 
21234   /* "pygame/_sdl2/video.pyx":925
21235  *
21236  *     @classmethod
21237  *     def from_window(cls, Window window):             # <<<<<<<<<<<<<<
21238  *         cdef Renderer self = cls.__new__(cls)
21239  *         self._win = window
21240  */
21241   __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer, __pyx_n_s_from_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
21242   __Pyx_GOTREF(__pyx_t_1);
21243 
21244   /* "pygame/_sdl2/video.pyx":924
21245  * cdef class Renderer:
21246  *
21247  *     @classmethod             # <<<<<<<<<<<<<<
21248  *     def from_window(cls, Window window):
21249  *         cdef Renderer self = cls.__new__(cls)
21250  */
21251   __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error)
21252   __Pyx_GOTREF(__pyx_t_2);
21253   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21254   if (PyDict_SetItem((PyObject *)__pyx_ptype_6pygame_5_sdl2_5video_Renderer->tp_dict, __pyx_n_s_from_window, __pyx_t_2) < 0) __PYX_ERR(0, 925, __pyx_L1_error)
21255   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21256   PyType_Modified(__pyx_ptype_6pygame_5_sdl2_5video_Renderer);
21257 
21258   /* "pygame/_sdl2/video.pyx":1
21259  * from cpython cimport PyObject             # <<<<<<<<<<<<<<
21260  * from . import error
21261  * from . import error as errorfnc
21262  */
21263   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
21264   __Pyx_GOTREF(__pyx_t_2);
21265   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21266   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21267 
21268   /*--- Wrapped vars code ---*/
21269 
21270   goto __pyx_L0;
21271   __pyx_L1_error:;
21272   __Pyx_XDECREF(__pyx_t_1);
21273   __Pyx_XDECREF(__pyx_t_2);
21274   if (__pyx_m) {
21275     if (__pyx_d) {
21276       __Pyx_AddTraceback("init pygame._sdl2.video", __pyx_clineno, __pyx_lineno, __pyx_filename);
21277     }
21278     Py_CLEAR(__pyx_m);
21279   } else if (!PyErr_Occurred()) {
21280     PyErr_SetString(PyExc_ImportError, "init pygame._sdl2.video");
21281   }
21282   __pyx_L0:;
21283   __Pyx_RefNannyFinishContext();
21284   #if CYTHON_PEP489_MULTI_PHASE_INIT
21285   return (__pyx_m != NULL) ? 0 : -1;
21286   #elif PY_MAJOR_VERSION >= 3
21287   return __pyx_m;
21288   #else
21289   return;
21290   #endif
21291 }
21292 
21293 /* --- Runtime support code --- */
21294 /* Refnanny */
21295 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)21296 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
21297     PyObject *m = NULL, *p = NULL;
21298     void *r = NULL;
21299     m = PyImport_ImportModule(modname);
21300     if (!m) goto end;
21301     p = PyObject_GetAttrString(m, "RefNannyAPI");
21302     if (!p) goto end;
21303     r = PyLong_AsVoidPtr(p);
21304 end:
21305     Py_XDECREF(p);
21306     Py_XDECREF(m);
21307     return (__Pyx_RefNannyAPIStruct *)r;
21308 }
21309 #endif
21310 
21311 /* PyObjectGetAttrStr */
21312 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)21313 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
21314     PyTypeObject* tp = Py_TYPE(obj);
21315     if (likely(tp->tp_getattro))
21316         return tp->tp_getattro(obj, attr_name);
21317 #if PY_MAJOR_VERSION < 3
21318     if (likely(tp->tp_getattr))
21319         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
21320 #endif
21321     return PyObject_GetAttr(obj, attr_name);
21322 }
21323 #endif
21324 
21325 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)21326 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
21327     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
21328     if (unlikely(!result)) {
21329         PyErr_Format(PyExc_NameError,
21330 #if PY_MAJOR_VERSION >= 3
21331             "name '%U' is not defined", name);
21332 #else
21333             "name '%.200s' is not defined", PyString_AS_STRING(name));
21334 #endif
21335     }
21336     return result;
21337 }
21338 
21339 /* PyDictVersioning */
21340 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)21341 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
21342     PyObject *dict = Py_TYPE(obj)->tp_dict;
21343     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
21344 }
__Pyx_get_object_dict_version(PyObject * obj)21345 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
21346     PyObject **dictptr = NULL;
21347     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
21348     if (offset) {
21349 #if CYTHON_COMPILING_IN_CPYTHON
21350         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
21351 #else
21352         dictptr = _PyObject_GetDictPtr(obj);
21353 #endif
21354     }
21355     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
21356 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)21357 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
21358     PyObject *dict = Py_TYPE(obj)->tp_dict;
21359     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
21360         return 0;
21361     return obj_dict_version == __Pyx_get_object_dict_version(obj);
21362 }
21363 #endif
21364 
21365 /* GetModuleGlobalName */
21366 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)21367 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
21368 #else
21369 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
21370 #endif
21371 {
21372     PyObject *result;
21373 #if !CYTHON_AVOID_BORROWED_REFS
21374 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
21375     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
21376     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21377     if (likely(result)) {
21378         return __Pyx_NewRef(result);
21379     } else if (unlikely(PyErr_Occurred())) {
21380         return NULL;
21381     }
21382 #else
21383     result = PyDict_GetItem(__pyx_d, name);
21384     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21385     if (likely(result)) {
21386         return __Pyx_NewRef(result);
21387     }
21388 #endif
21389 #else
21390     result = PyObject_GetItem(__pyx_d, name);
21391     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
21392     if (likely(result)) {
21393         return __Pyx_NewRef(result);
21394     }
21395     PyErr_Clear();
21396 #endif
21397     return __Pyx_GetBuiltinName(name);
21398 }
21399 
21400 /* PyFunctionFastCall */
21401 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)21402 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
21403                                                PyObject *globals) {
21404     PyFrameObject *f;
21405     PyThreadState *tstate = __Pyx_PyThreadState_Current;
21406     PyObject **fastlocals;
21407     Py_ssize_t i;
21408     PyObject *result;
21409     assert(globals != NULL);
21410     /* XXX Perhaps we should create a specialized
21411        PyFrame_New() that doesn't take locals, but does
21412        take builtins without sanity checking them.
21413        */
21414     assert(tstate != NULL);
21415     f = PyFrame_New(tstate, co, globals, NULL);
21416     if (f == NULL) {
21417         return NULL;
21418     }
21419     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
21420     for (i = 0; i < na; i++) {
21421         Py_INCREF(*args);
21422         fastlocals[i] = *args++;
21423     }
21424     result = PyEval_EvalFrameEx(f,0);
21425     ++tstate->recursion_depth;
21426     Py_DECREF(f);
21427     --tstate->recursion_depth;
21428     return result;
21429 }
21430 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)21431 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
21432     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
21433     PyObject *globals = PyFunction_GET_GLOBALS(func);
21434     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
21435     PyObject *closure;
21436 #if PY_MAJOR_VERSION >= 3
21437     PyObject *kwdefs;
21438 #endif
21439     PyObject *kwtuple, **k;
21440     PyObject **d;
21441     Py_ssize_t nd;
21442     Py_ssize_t nk;
21443     PyObject *result;
21444     assert(kwargs == NULL || PyDict_Check(kwargs));
21445     nk = kwargs ? PyDict_Size(kwargs) : 0;
21446     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
21447         return NULL;
21448     }
21449     if (
21450 #if PY_MAJOR_VERSION >= 3
21451             co->co_kwonlyargcount == 0 &&
21452 #endif
21453             likely(kwargs == NULL || nk == 0) &&
21454             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
21455         if (argdefs == NULL && co->co_argcount == nargs) {
21456             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
21457             goto done;
21458         }
21459         else if (nargs == 0 && argdefs != NULL
21460                  && co->co_argcount == Py_SIZE(argdefs)) {
21461             /* function called with no arguments, but all parameters have
21462                a default value: use default values as arguments .*/
21463             args = &PyTuple_GET_ITEM(argdefs, 0);
21464             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
21465             goto done;
21466         }
21467     }
21468     if (kwargs != NULL) {
21469         Py_ssize_t pos, i;
21470         kwtuple = PyTuple_New(2 * nk);
21471         if (kwtuple == NULL) {
21472             result = NULL;
21473             goto done;
21474         }
21475         k = &PyTuple_GET_ITEM(kwtuple, 0);
21476         pos = i = 0;
21477         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
21478             Py_INCREF(k[i]);
21479             Py_INCREF(k[i+1]);
21480             i += 2;
21481         }
21482         nk = i / 2;
21483     }
21484     else {
21485         kwtuple = NULL;
21486         k = NULL;
21487     }
21488     closure = PyFunction_GET_CLOSURE(func);
21489 #if PY_MAJOR_VERSION >= 3
21490     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
21491 #endif
21492     if (argdefs != NULL) {
21493         d = &PyTuple_GET_ITEM(argdefs, 0);
21494         nd = Py_SIZE(argdefs);
21495     }
21496     else {
21497         d = NULL;
21498         nd = 0;
21499     }
21500 #if PY_MAJOR_VERSION >= 3
21501     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
21502                                args, (int)nargs,
21503                                k, (int)nk,
21504                                d, (int)nd, kwdefs, closure);
21505 #else
21506     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
21507                                args, (int)nargs,
21508                                k, (int)nk,
21509                                d, (int)nd, closure);
21510 #endif
21511     Py_XDECREF(kwtuple);
21512 done:
21513     Py_LeaveRecursiveCall();
21514     return result;
21515 }
21516 #endif
21517 #endif
21518 
21519 /* PyObjectCall */
21520 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)21521 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
21522     PyObject *result;
21523     ternaryfunc call = Py_TYPE(func)->tp_call;
21524     if (unlikely(!call))
21525         return PyObject_Call(func, arg, kw);
21526     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21527         return NULL;
21528     result = (*call)(func, arg, kw);
21529     Py_LeaveRecursiveCall();
21530     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21531         PyErr_SetString(
21532             PyExc_SystemError,
21533             "NULL result without error in PyObject_Call");
21534     }
21535     return result;
21536 }
21537 #endif
21538 
21539 /* PyObjectCallMethO */
21540 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)21541 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
21542     PyObject *self, *result;
21543     PyCFunction cfunc;
21544     cfunc = PyCFunction_GET_FUNCTION(func);
21545     self = PyCFunction_GET_SELF(func);
21546     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21547         return NULL;
21548     result = cfunc(self, arg);
21549     Py_LeaveRecursiveCall();
21550     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21551         PyErr_SetString(
21552             PyExc_SystemError,
21553             "NULL result without error in PyObject_Call");
21554     }
21555     return result;
21556 }
21557 #endif
21558 
21559 /* PyObjectCallNoArg */
21560 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)21561 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
21562 #if CYTHON_FAST_PYCALL
21563     if (PyFunction_Check(func)) {
21564         return __Pyx_PyFunction_FastCall(func, NULL, 0);
21565     }
21566 #endif
21567 #ifdef __Pyx_CyFunction_USED
21568     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
21569 #else
21570     if (likely(PyCFunction_Check(func)))
21571 #endif
21572     {
21573         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
21574             return __Pyx_PyObject_CallMethO(func, NULL);
21575         }
21576     }
21577     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
21578 }
21579 #endif
21580 
21581 /* PyCFunctionFastCall */
21582 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)21583 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
21584     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
21585     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
21586     PyObject *self = PyCFunction_GET_SELF(func);
21587     int flags = PyCFunction_GET_FLAGS(func);
21588     assert(PyCFunction_Check(func));
21589     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
21590     assert(nargs >= 0);
21591     assert(nargs == 0 || args != NULL);
21592     /* _PyCFunction_FastCallDict() must not be called with an exception set,
21593        because it may clear it (directly or indirectly) and so the
21594        caller loses its exception */
21595     assert(!PyErr_Occurred());
21596     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
21597         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
21598     } else {
21599         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
21600     }
21601 }
21602 #endif
21603 
21604 /* PyObjectCallOneArg */
21605 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)21606 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
21607     PyObject *result;
21608     PyObject *args = PyTuple_New(1);
21609     if (unlikely(!args)) return NULL;
21610     Py_INCREF(arg);
21611     PyTuple_SET_ITEM(args, 0, arg);
21612     result = __Pyx_PyObject_Call(func, args, NULL);
21613     Py_DECREF(args);
21614     return result;
21615 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)21616 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
21617 #if CYTHON_FAST_PYCALL
21618     if (PyFunction_Check(func)) {
21619         return __Pyx_PyFunction_FastCall(func, &arg, 1);
21620     }
21621 #endif
21622     if (likely(PyCFunction_Check(func))) {
21623         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
21624             return __Pyx_PyObject_CallMethO(func, arg);
21625 #if CYTHON_FAST_PYCCALL
21626         } else if (__Pyx_PyFastCFunction_Check(func)) {
21627             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
21628 #endif
21629         }
21630     }
21631     return __Pyx__PyObject_CallOneArg(func, arg);
21632 }
21633 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)21634 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
21635     PyObject *result;
21636     PyObject *args = PyTuple_Pack(1, arg);
21637     if (unlikely(!args)) return NULL;
21638     result = __Pyx_PyObject_Call(func, args, NULL);
21639     Py_DECREF(args);
21640     return result;
21641 }
21642 #endif
21643 
21644 /* PyObjectSetAttrStr */
21645 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_SetAttrStr(PyObject * obj,PyObject * attr_name,PyObject * value)21646 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
21647     PyTypeObject* tp = Py_TYPE(obj);
21648     if (likely(tp->tp_setattro))
21649         return tp->tp_setattro(obj, attr_name, value);
21650 #if PY_MAJOR_VERSION < 3
21651     if (likely(tp->tp_setattr))
21652         return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
21653 #endif
21654     return PyObject_SetAttr(obj, attr_name, value);
21655 }
21656 #endif
21657 
21658 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)21659 static void __Pyx_RaiseArgtupleInvalid(
21660     const char* func_name,
21661     int exact,
21662     Py_ssize_t num_min,
21663     Py_ssize_t num_max,
21664     Py_ssize_t num_found)
21665 {
21666     Py_ssize_t num_expected;
21667     const char *more_or_less;
21668     if (num_found < num_min) {
21669         num_expected = num_min;
21670         more_or_less = "at least";
21671     } else {
21672         num_expected = num_max;
21673         more_or_less = "at most";
21674     }
21675     if (exact) {
21676         more_or_less = "exactly";
21677     }
21678     PyErr_Format(PyExc_TypeError,
21679                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
21680                  func_name, more_or_less, num_expected,
21681                  (num_expected == 1) ? "" : "s", num_found);
21682 }
21683 
21684 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)21685 static void __Pyx_RaiseDoubleKeywordsError(
21686     const char* func_name,
21687     PyObject* kw_name)
21688 {
21689     PyErr_Format(PyExc_TypeError,
21690         #if PY_MAJOR_VERSION >= 3
21691         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
21692         #else
21693         "%s() got multiple values for keyword argument '%s'", func_name,
21694         PyString_AsString(kw_name));
21695         #endif
21696 }
21697 
21698 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)21699 static int __Pyx_ParseOptionalKeywords(
21700     PyObject *kwds,
21701     PyObject **argnames[],
21702     PyObject *kwds2,
21703     PyObject *values[],
21704     Py_ssize_t num_pos_args,
21705     const char* function_name)
21706 {
21707     PyObject *key = 0, *value = 0;
21708     Py_ssize_t pos = 0;
21709     PyObject*** name;
21710     PyObject*** first_kw_arg = argnames + num_pos_args;
21711     while (PyDict_Next(kwds, &pos, &key, &value)) {
21712         name = first_kw_arg;
21713         while (*name && (**name != key)) name++;
21714         if (*name) {
21715             values[name-argnames] = value;
21716             continue;
21717         }
21718         name = first_kw_arg;
21719         #if PY_MAJOR_VERSION < 3
21720         if (likely(PyString_Check(key))) {
21721             while (*name) {
21722                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
21723                         && _PyString_Eq(**name, key)) {
21724                     values[name-argnames] = value;
21725                     break;
21726                 }
21727                 name++;
21728             }
21729             if (*name) continue;
21730             else {
21731                 PyObject*** argname = argnames;
21732                 while (argname != first_kw_arg) {
21733                     if ((**argname == key) || (
21734                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
21735                              && _PyString_Eq(**argname, key))) {
21736                         goto arg_passed_twice;
21737                     }
21738                     argname++;
21739                 }
21740             }
21741         } else
21742         #endif
21743         if (likely(PyUnicode_Check(key))) {
21744             while (*name) {
21745                 int cmp = (**name == key) ? 0 :
21746                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21747                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
21748                 #endif
21749                     PyUnicode_Compare(**name, key);
21750                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21751                 if (cmp == 0) {
21752                     values[name-argnames] = value;
21753                     break;
21754                 }
21755                 name++;
21756             }
21757             if (*name) continue;
21758             else {
21759                 PyObject*** argname = argnames;
21760                 while (argname != first_kw_arg) {
21761                     int cmp = (**argname == key) ? 0 :
21762                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21763                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
21764                     #endif
21765                         PyUnicode_Compare(**argname, key);
21766                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21767                     if (cmp == 0) goto arg_passed_twice;
21768                     argname++;
21769                 }
21770             }
21771         } else
21772             goto invalid_keyword_type;
21773         if (kwds2) {
21774             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
21775         } else {
21776             goto invalid_keyword;
21777         }
21778     }
21779     return 0;
21780 arg_passed_twice:
21781     __Pyx_RaiseDoubleKeywordsError(function_name, key);
21782     goto bad;
21783 invalid_keyword_type:
21784     PyErr_Format(PyExc_TypeError,
21785         "%.200s() keywords must be strings", function_name);
21786     goto bad;
21787 invalid_keyword:
21788     PyErr_Format(PyExc_TypeError,
21789     #if PY_MAJOR_VERSION < 3
21790         "%.200s() got an unexpected keyword argument '%.200s'",
21791         function_name, PyString_AsString(key));
21792     #else
21793         "%s() got an unexpected keyword argument '%U'",
21794         function_name, key);
21795     #endif
21796 bad:
21797     return -1;
21798 }
21799 
21800 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)21801 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
21802 {
21803     if (unlikely(!type)) {
21804         PyErr_SetString(PyExc_SystemError, "Missing type object");
21805         return 0;
21806     }
21807     else if (exact) {
21808         #if PY_MAJOR_VERSION == 2
21809         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
21810         #endif
21811     }
21812     else {
21813         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
21814     }
21815     PyErr_Format(PyExc_TypeError,
21816         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
21817         name, type->tp_name, Py_TYPE(obj)->tp_name);
21818     return 0;
21819 }
21820 
21821 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)21822 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
21823     PyObject *args, *result = NULL;
21824     #if CYTHON_FAST_PYCALL
21825     if (PyFunction_Check(function)) {
21826         PyObject *args[2] = {arg1, arg2};
21827         return __Pyx_PyFunction_FastCall(function, args, 2);
21828     }
21829     #endif
21830     #if CYTHON_FAST_PYCCALL
21831     if (__Pyx_PyFastCFunction_Check(function)) {
21832         PyObject *args[2] = {arg1, arg2};
21833         return __Pyx_PyCFunction_FastCall(function, args, 2);
21834     }
21835     #endif
21836     args = PyTuple_New(2);
21837     if (unlikely(!args)) goto done;
21838     Py_INCREF(arg1);
21839     PyTuple_SET_ITEM(args, 0, arg1);
21840     Py_INCREF(arg2);
21841     PyTuple_SET_ITEM(args, 1, arg2);
21842     Py_INCREF(function);
21843     result = __Pyx_PyObject_Call(function, args, NULL);
21844     Py_DECREF(args);
21845     Py_DECREF(function);
21846 done:
21847     return result;
21848 }
21849 
21850 /* PyIntBinop */
21851 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)21852 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
21853     (void)inplace;
21854     (void)zerodivision_check;
21855     #if PY_MAJOR_VERSION < 3
21856     if (likely(PyInt_CheckExact(op1))) {
21857         const long b = intval;
21858         long x;
21859         long a = PyInt_AS_LONG(op1);
21860             x = (long)((unsigned long)a + b);
21861             if (likely((x^a) >= 0 || (x^b) >= 0))
21862                 return PyInt_FromLong(x);
21863             return PyLong_Type.tp_as_number->nb_add(op1, op2);
21864     }
21865     #endif
21866     #if CYTHON_USE_PYLONG_INTERNALS
21867     if (likely(PyLong_CheckExact(op1))) {
21868         const long b = intval;
21869         long a, x;
21870 #ifdef HAVE_LONG_LONG
21871         const PY_LONG_LONG llb = intval;
21872         PY_LONG_LONG lla, llx;
21873 #endif
21874         const digit* digits = ((PyLongObject*)op1)->ob_digit;
21875         const Py_ssize_t size = Py_SIZE(op1);
21876         if (likely(__Pyx_sst_abs(size) <= 1)) {
21877             a = likely(size) ? digits[0] : 0;
21878             if (size == -1) a = -a;
21879         } else {
21880             switch (size) {
21881                 case -2:
21882                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21883                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21884                         break;
21885 #ifdef HAVE_LONG_LONG
21886                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21887                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21888                         goto long_long;
21889 #endif
21890                     }
21891                     CYTHON_FALLTHROUGH;
21892                 case 2:
21893                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
21894                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21895                         break;
21896 #ifdef HAVE_LONG_LONG
21897                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
21898                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21899                         goto long_long;
21900 #endif
21901                     }
21902                     CYTHON_FALLTHROUGH;
21903                 case -3:
21904                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21905                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21906                         break;
21907 #ifdef HAVE_LONG_LONG
21908                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21909                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21910                         goto long_long;
21911 #endif
21912                     }
21913                     CYTHON_FALLTHROUGH;
21914                 case 3:
21915                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
21916                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21917                         break;
21918 #ifdef HAVE_LONG_LONG
21919                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
21920                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21921                         goto long_long;
21922 #endif
21923                     }
21924                     CYTHON_FALLTHROUGH;
21925                 case -4:
21926                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
21927                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21928                         break;
21929 #ifdef HAVE_LONG_LONG
21930                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21931                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21932                         goto long_long;
21933 #endif
21934                     }
21935                     CYTHON_FALLTHROUGH;
21936                 case 4:
21937                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
21938                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
21939                         break;
21940 #ifdef HAVE_LONG_LONG
21941                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
21942                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
21943                         goto long_long;
21944 #endif
21945                     }
21946                     CYTHON_FALLTHROUGH;
21947                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
21948             }
21949         }
21950                 x = a + b;
21951             return PyLong_FromLong(x);
21952 #ifdef HAVE_LONG_LONG
21953         long_long:
21954                 llx = lla + llb;
21955             return PyLong_FromLongLong(llx);
21956 #endif
21957 
21958 
21959     }
21960     #endif
21961     if (PyFloat_CheckExact(op1)) {
21962         const long b = intval;
21963         double a = PyFloat_AS_DOUBLE(op1);
21964             double result;
21965             PyFPE_START_PROTECT("add", return NULL)
21966             result = ((double)a) + (double)b;
21967             PyFPE_END_PROTECT(result)
21968             return PyFloat_FromDouble(result);
21969     }
21970     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
21971 }
21972 #endif
21973 
21974 /* PyIntBinop */
21975 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_SubtractObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)21976 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
21977     (void)inplace;
21978     (void)zerodivision_check;
21979     #if PY_MAJOR_VERSION < 3
21980     if (likely(PyInt_CheckExact(op1))) {
21981         const long b = intval;
21982         long x;
21983         long a = PyInt_AS_LONG(op1);
21984             x = (long)((unsigned long)a - b);
21985             if (likely((x^a) >= 0 || (x^~b) >= 0))
21986                 return PyInt_FromLong(x);
21987             return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
21988     }
21989     #endif
21990     #if CYTHON_USE_PYLONG_INTERNALS
21991     if (likely(PyLong_CheckExact(op1))) {
21992         const long b = intval;
21993         long a, x;
21994 #ifdef HAVE_LONG_LONG
21995         const PY_LONG_LONG llb = intval;
21996         PY_LONG_LONG lla, llx;
21997 #endif
21998         const digit* digits = ((PyLongObject*)op1)->ob_digit;
21999         const Py_ssize_t size = Py_SIZE(op1);
22000         if (likely(__Pyx_sst_abs(size) <= 1)) {
22001             a = likely(size) ? digits[0] : 0;
22002             if (size == -1) a = -a;
22003         } else {
22004             switch (size) {
22005                 case -2:
22006                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22007                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22008                         break;
22009 #ifdef HAVE_LONG_LONG
22010                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
22011                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22012                         goto long_long;
22013 #endif
22014                     }
22015                     CYTHON_FALLTHROUGH;
22016                 case 2:
22017                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22018                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22019                         break;
22020 #ifdef HAVE_LONG_LONG
22021                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
22022                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22023                         goto long_long;
22024 #endif
22025                     }
22026                     CYTHON_FALLTHROUGH;
22027                 case -3:
22028                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22029                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22030                         break;
22031 #ifdef HAVE_LONG_LONG
22032                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
22033                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22034                         goto long_long;
22035 #endif
22036                     }
22037                     CYTHON_FALLTHROUGH;
22038                 case 3:
22039                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22040                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22041                         break;
22042 #ifdef HAVE_LONG_LONG
22043                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
22044                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22045                         goto long_long;
22046 #endif
22047                     }
22048                     CYTHON_FALLTHROUGH;
22049                 case -4:
22050                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22051                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22052                         break;
22053 #ifdef HAVE_LONG_LONG
22054                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
22055                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22056                         goto long_long;
22057 #endif
22058                     }
22059                     CYTHON_FALLTHROUGH;
22060                 case 4:
22061                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22062                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22063                         break;
22064 #ifdef HAVE_LONG_LONG
22065                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
22066                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22067                         goto long_long;
22068 #endif
22069                     }
22070                     CYTHON_FALLTHROUGH;
22071                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
22072             }
22073         }
22074                 x = a - b;
22075             return PyLong_FromLong(x);
22076 #ifdef HAVE_LONG_LONG
22077         long_long:
22078                 llx = lla - llb;
22079             return PyLong_FromLongLong(llx);
22080 #endif
22081 
22082 
22083     }
22084     #endif
22085     if (PyFloat_CheckExact(op1)) {
22086         const long b = intval;
22087         double a = PyFloat_AS_DOUBLE(op1);
22088             double result;
22089             PyFPE_START_PROTECT("subtract", return NULL)
22090             result = ((double)a) - (double)b;
22091             PyFPE_END_PROTECT(result)
22092             return PyFloat_FromDouble(result);
22093     }
22094     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
22095 }
22096 #endif
22097 
22098 /* PyErrFetchRestore */
22099 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)22100 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22101     PyObject *tmp_type, *tmp_value, *tmp_tb;
22102     tmp_type = tstate->curexc_type;
22103     tmp_value = tstate->curexc_value;
22104     tmp_tb = tstate->curexc_traceback;
22105     tstate->curexc_type = type;
22106     tstate->curexc_value = value;
22107     tstate->curexc_traceback = tb;
22108     Py_XDECREF(tmp_type);
22109     Py_XDECREF(tmp_value);
22110     Py_XDECREF(tmp_tb);
22111 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22112 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22113     *type = tstate->curexc_type;
22114     *value = tstate->curexc_value;
22115     *tb = tstate->curexc_traceback;
22116     tstate->curexc_type = 0;
22117     tstate->curexc_value = 0;
22118     tstate->curexc_traceback = 0;
22119 }
22120 #endif
22121 
22122 /* RaiseException */
22123 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)22124 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
22125                         CYTHON_UNUSED PyObject *cause) {
22126     __Pyx_PyThreadState_declare
22127     Py_XINCREF(type);
22128     if (!value || value == Py_None)
22129         value = NULL;
22130     else
22131         Py_INCREF(value);
22132     if (!tb || tb == Py_None)
22133         tb = NULL;
22134     else {
22135         Py_INCREF(tb);
22136         if (!PyTraceBack_Check(tb)) {
22137             PyErr_SetString(PyExc_TypeError,
22138                 "raise: arg 3 must be a traceback or None");
22139             goto raise_error;
22140         }
22141     }
22142     if (PyType_Check(type)) {
22143 #if CYTHON_COMPILING_IN_PYPY
22144         if (!value) {
22145             Py_INCREF(Py_None);
22146             value = Py_None;
22147         }
22148 #endif
22149         PyErr_NormalizeException(&type, &value, &tb);
22150     } else {
22151         if (value) {
22152             PyErr_SetString(PyExc_TypeError,
22153                 "instance exception may not have a separate value");
22154             goto raise_error;
22155         }
22156         value = type;
22157         type = (PyObject*) Py_TYPE(type);
22158         Py_INCREF(type);
22159         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
22160             PyErr_SetString(PyExc_TypeError,
22161                 "raise: exception class must be a subclass of BaseException");
22162             goto raise_error;
22163         }
22164     }
22165     __Pyx_PyThreadState_assign
22166     __Pyx_ErrRestore(type, value, tb);
22167     return;
22168 raise_error:
22169     Py_XDECREF(value);
22170     Py_XDECREF(type);
22171     Py_XDECREF(tb);
22172     return;
22173 }
22174 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)22175 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
22176     PyObject* owned_instance = NULL;
22177     if (tb == Py_None) {
22178         tb = 0;
22179     } else if (tb && !PyTraceBack_Check(tb)) {
22180         PyErr_SetString(PyExc_TypeError,
22181             "raise: arg 3 must be a traceback or None");
22182         goto bad;
22183     }
22184     if (value == Py_None)
22185         value = 0;
22186     if (PyExceptionInstance_Check(type)) {
22187         if (value) {
22188             PyErr_SetString(PyExc_TypeError,
22189                 "instance exception may not have a separate value");
22190             goto bad;
22191         }
22192         value = type;
22193         type = (PyObject*) Py_TYPE(value);
22194     } else if (PyExceptionClass_Check(type)) {
22195         PyObject *instance_class = NULL;
22196         if (value && PyExceptionInstance_Check(value)) {
22197             instance_class = (PyObject*) Py_TYPE(value);
22198             if (instance_class != type) {
22199                 int is_subclass = PyObject_IsSubclass(instance_class, type);
22200                 if (!is_subclass) {
22201                     instance_class = NULL;
22202                 } else if (unlikely(is_subclass == -1)) {
22203                     goto bad;
22204                 } else {
22205                     type = instance_class;
22206                 }
22207             }
22208         }
22209         if (!instance_class) {
22210             PyObject *args;
22211             if (!value)
22212                 args = PyTuple_New(0);
22213             else if (PyTuple_Check(value)) {
22214                 Py_INCREF(value);
22215                 args = value;
22216             } else
22217                 args = PyTuple_Pack(1, value);
22218             if (!args)
22219                 goto bad;
22220             owned_instance = PyObject_Call(type, args, NULL);
22221             Py_DECREF(args);
22222             if (!owned_instance)
22223                 goto bad;
22224             value = owned_instance;
22225             if (!PyExceptionInstance_Check(value)) {
22226                 PyErr_Format(PyExc_TypeError,
22227                              "calling %R should have returned an instance of "
22228                              "BaseException, not %R",
22229                              type, Py_TYPE(value));
22230                 goto bad;
22231             }
22232         }
22233     } else {
22234         PyErr_SetString(PyExc_TypeError,
22235             "raise: exception class must be a subclass of BaseException");
22236         goto bad;
22237     }
22238     if (cause) {
22239         PyObject *fixed_cause;
22240         if (cause == Py_None) {
22241             fixed_cause = NULL;
22242         } else if (PyExceptionClass_Check(cause)) {
22243             fixed_cause = PyObject_CallObject(cause, NULL);
22244             if (fixed_cause == NULL)
22245                 goto bad;
22246         } else if (PyExceptionInstance_Check(cause)) {
22247             fixed_cause = cause;
22248             Py_INCREF(fixed_cause);
22249         } else {
22250             PyErr_SetString(PyExc_TypeError,
22251                             "exception causes must derive from "
22252                             "BaseException");
22253             goto bad;
22254         }
22255         PyException_SetCause(value, fixed_cause);
22256     }
22257     PyErr_SetObject(type, value);
22258     if (tb) {
22259 #if CYTHON_COMPILING_IN_PYPY
22260         PyObject *tmp_type, *tmp_value, *tmp_tb;
22261         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
22262         Py_INCREF(tb);
22263         PyErr_Restore(tmp_type, tmp_value, tb);
22264         Py_XDECREF(tmp_tb);
22265 #else
22266         PyThreadState *tstate = __Pyx_PyThreadState_Current;
22267         PyObject* tmp_tb = tstate->curexc_traceback;
22268         if (tb != tmp_tb) {
22269             Py_INCREF(tb);
22270             tstate->curexc_traceback = tb;
22271             Py_XDECREF(tmp_tb);
22272         }
22273 #endif
22274     }
22275 bad:
22276     Py_XDECREF(owned_instance);
22277     return;
22278 }
22279 #endif
22280 
22281 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)22282 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
22283     if (unlikely(!type)) {
22284         PyErr_SetString(PyExc_SystemError, "Missing type object");
22285         return 0;
22286     }
22287     if (likely(__Pyx_TypeCheck(obj, type)))
22288         return 1;
22289     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
22290                  Py_TYPE(obj)->tp_name, type->tp_name);
22291     return 0;
22292 }
22293 
22294 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)22295 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
22296     PyErr_Format(PyExc_ValueError,
22297                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
22298 }
22299 
22300 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)22301 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
22302     PyErr_Format(PyExc_ValueError,
22303                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
22304                  index, (index == 1) ? "" : "s");
22305 }
22306 
22307 /* IterFinish */
__Pyx_IterFinish(void)22308 static CYTHON_INLINE int __Pyx_IterFinish(void) {
22309 #if CYTHON_FAST_THREAD_STATE
22310     PyThreadState *tstate = __Pyx_PyThreadState_Current;
22311     PyObject* exc_type = tstate->curexc_type;
22312     if (unlikely(exc_type)) {
22313         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
22314             PyObject *exc_value, *exc_tb;
22315             exc_value = tstate->curexc_value;
22316             exc_tb = tstate->curexc_traceback;
22317             tstate->curexc_type = 0;
22318             tstate->curexc_value = 0;
22319             tstate->curexc_traceback = 0;
22320             Py_DECREF(exc_type);
22321             Py_XDECREF(exc_value);
22322             Py_XDECREF(exc_tb);
22323             return 0;
22324         } else {
22325             return -1;
22326         }
22327     }
22328     return 0;
22329 #else
22330     if (unlikely(PyErr_Occurred())) {
22331         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
22332             PyErr_Clear();
22333             return 0;
22334         } else {
22335             return -1;
22336         }
22337     }
22338     return 0;
22339 #endif
22340 }
22341 
22342 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)22343 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
22344     if (unlikely(retval)) {
22345         Py_DECREF(retval);
22346         __Pyx_RaiseTooManyValuesError(expected);
22347         return -1;
22348     } else {
22349         return __Pyx_IterFinish();
22350     }
22351     return 0;
22352 }
22353 
22354 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)22355 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
22356     PyObject *method;
22357     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
22358     if (unlikely(!method))
22359         return -1;
22360     target->method = method;
22361 #if CYTHON_COMPILING_IN_CPYTHON
22362     #if PY_MAJOR_VERSION >= 3
22363     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
22364     #endif
22365     {
22366         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
22367         target->func = descr->d_method->ml_meth;
22368         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
22369     }
22370 #endif
22371     return 0;
22372 }
22373 
22374 /* CallUnboundCMethod0 */
__Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction * cfunc,PyObject * self)22375 static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
22376     PyObject *args, *result = NULL;
22377     if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
22378 #if CYTHON_ASSUME_SAFE_MACROS
22379     args = PyTuple_New(1);
22380     if (unlikely(!args)) goto bad;
22381     Py_INCREF(self);
22382     PyTuple_SET_ITEM(args, 0, self);
22383 #else
22384     args = PyTuple_Pack(1, self);
22385     if (unlikely(!args)) goto bad;
22386 #endif
22387     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
22388     Py_DECREF(args);
22389 bad:
22390     return result;
22391 }
22392 
22393 /* py_dict_items */
__Pyx_PyDict_Items(PyObject * d)22394 static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
22395     if (PY_MAJOR_VERSION >= 3)
22396         return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d);
22397     else
22398         return PyDict_Items(d);
22399 }
22400 
22401 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)22402 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
22403     PyObject *r;
22404     if (!j) return NULL;
22405     r = PyObject_GetItem(o, j);
22406     Py_DECREF(j);
22407     return r;
22408 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22409 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
22410                                                               CYTHON_NCP_UNUSED int wraparound,
22411                                                               CYTHON_NCP_UNUSED int boundscheck) {
22412 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22413     Py_ssize_t wrapped_i = i;
22414     if (wraparound & unlikely(i < 0)) {
22415         wrapped_i += PyList_GET_SIZE(o);
22416     }
22417     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
22418         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
22419         Py_INCREF(r);
22420         return r;
22421     }
22422     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22423 #else
22424     return PySequence_GetItem(o, i);
22425 #endif
22426 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22427 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
22428                                                               CYTHON_NCP_UNUSED int wraparound,
22429                                                               CYTHON_NCP_UNUSED int boundscheck) {
22430 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22431     Py_ssize_t wrapped_i = i;
22432     if (wraparound & unlikely(i < 0)) {
22433         wrapped_i += PyTuple_GET_SIZE(o);
22434     }
22435     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
22436         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
22437         Py_INCREF(r);
22438         return r;
22439     }
22440     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22441 #else
22442     return PySequence_GetItem(o, i);
22443 #endif
22444 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22445 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
22446                                                      CYTHON_NCP_UNUSED int wraparound,
22447                                                      CYTHON_NCP_UNUSED int boundscheck) {
22448 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22449     if (is_list || PyList_CheckExact(o)) {
22450         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
22451         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
22452             PyObject *r = PyList_GET_ITEM(o, n);
22453             Py_INCREF(r);
22454             return r;
22455         }
22456     }
22457     else if (PyTuple_CheckExact(o)) {
22458         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
22459         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
22460             PyObject *r = PyTuple_GET_ITEM(o, n);
22461             Py_INCREF(r);
22462             return r;
22463         }
22464     } else {
22465         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22466         if (likely(m && m->sq_item)) {
22467             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22468                 Py_ssize_t l = m->sq_length(o);
22469                 if (likely(l >= 0)) {
22470                     i += l;
22471                 } else {
22472                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22473                         return NULL;
22474                     PyErr_Clear();
22475                 }
22476             }
22477             return m->sq_item(o, i);
22478         }
22479     }
22480 #else
22481     if (is_list || PySequence_Check(o)) {
22482         return PySequence_GetItem(o, i);
22483     }
22484 #endif
22485     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22486 }
22487 
22488 /* ObjectGetItem */
22489 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)22490 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
22491     PyObject *runerr;
22492     Py_ssize_t key_value;
22493     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
22494     if (unlikely(!(m && m->sq_item))) {
22495         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
22496         return NULL;
22497     }
22498     key_value = __Pyx_PyIndex_AsSsize_t(index);
22499     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
22500         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
22501     }
22502     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
22503         PyErr_Clear();
22504         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
22505     }
22506     return NULL;
22507 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)22508 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
22509     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
22510     if (likely(m && m->mp_subscript)) {
22511         return m->mp_subscript(obj, key);
22512     }
22513     return __Pyx_PyObject_GetIndex(obj, key);
22514 }
22515 #endif
22516 
22517 /* GetTopmostException */
22518 #if CYTHON_USE_EXC_INFO_STACK
22519 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)22520 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
22521 {
22522     _PyErr_StackItem *exc_info = tstate->exc_info;
22523     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
22524            exc_info->previous_item != NULL)
22525     {
22526         exc_info = exc_info->previous_item;
22527     }
22528     return exc_info;
22529 }
22530 #endif
22531 
22532 /* SaveResetException */
22533 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22534 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22535     #if CYTHON_USE_EXC_INFO_STACK
22536     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
22537     *type = exc_info->exc_type;
22538     *value = exc_info->exc_value;
22539     *tb = exc_info->exc_traceback;
22540     #else
22541     *type = tstate->exc_type;
22542     *value = tstate->exc_value;
22543     *tb = tstate->exc_traceback;
22544     #endif
22545     Py_XINCREF(*type);
22546     Py_XINCREF(*value);
22547     Py_XINCREF(*tb);
22548 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)22549 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22550     PyObject *tmp_type, *tmp_value, *tmp_tb;
22551     #if CYTHON_USE_EXC_INFO_STACK
22552     _PyErr_StackItem *exc_info = tstate->exc_info;
22553     tmp_type = exc_info->exc_type;
22554     tmp_value = exc_info->exc_value;
22555     tmp_tb = exc_info->exc_traceback;
22556     exc_info->exc_type = type;
22557     exc_info->exc_value = value;
22558     exc_info->exc_traceback = tb;
22559     #else
22560     tmp_type = tstate->exc_type;
22561     tmp_value = tstate->exc_value;
22562     tmp_tb = tstate->exc_traceback;
22563     tstate->exc_type = type;
22564     tstate->exc_value = value;
22565     tstate->exc_traceback = tb;
22566     #endif
22567     Py_XDECREF(tmp_type);
22568     Py_XDECREF(tmp_value);
22569     Py_XDECREF(tmp_tb);
22570 }
22571 #endif
22572 
22573 /* PyErrExceptionMatches */
22574 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)22575 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22576     Py_ssize_t i, n;
22577     n = PyTuple_GET_SIZE(tuple);
22578 #if PY_MAJOR_VERSION >= 3
22579     for (i=0; i<n; i++) {
22580         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22581     }
22582 #endif
22583     for (i=0; i<n; i++) {
22584         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
22585     }
22586     return 0;
22587 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)22588 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
22589     PyObject *exc_type = tstate->curexc_type;
22590     if (exc_type == err) return 1;
22591     if (unlikely(!exc_type)) return 0;
22592     if (unlikely(PyTuple_Check(err)))
22593         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
22594     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
22595 }
22596 #endif
22597 
22598 /* GetException */
22599 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22600 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
22601 #else
22602 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
22603 #endif
22604 {
22605     PyObject *local_type, *local_value, *local_tb;
22606 #if CYTHON_FAST_THREAD_STATE
22607     PyObject *tmp_type, *tmp_value, *tmp_tb;
22608     local_type = tstate->curexc_type;
22609     local_value = tstate->curexc_value;
22610     local_tb = tstate->curexc_traceback;
22611     tstate->curexc_type = 0;
22612     tstate->curexc_value = 0;
22613     tstate->curexc_traceback = 0;
22614 #else
22615     PyErr_Fetch(&local_type, &local_value, &local_tb);
22616 #endif
22617     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
22618 #if CYTHON_FAST_THREAD_STATE
22619     if (unlikely(tstate->curexc_type))
22620 #else
22621     if (unlikely(PyErr_Occurred()))
22622 #endif
22623         goto bad;
22624     #if PY_MAJOR_VERSION >= 3
22625     if (local_tb) {
22626         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
22627             goto bad;
22628     }
22629     #endif
22630     Py_XINCREF(local_tb);
22631     Py_XINCREF(local_type);
22632     Py_XINCREF(local_value);
22633     *type = local_type;
22634     *value = local_value;
22635     *tb = local_tb;
22636 #if CYTHON_FAST_THREAD_STATE
22637     #if CYTHON_USE_EXC_INFO_STACK
22638     {
22639         _PyErr_StackItem *exc_info = tstate->exc_info;
22640         tmp_type = exc_info->exc_type;
22641         tmp_value = exc_info->exc_value;
22642         tmp_tb = exc_info->exc_traceback;
22643         exc_info->exc_type = local_type;
22644         exc_info->exc_value = local_value;
22645         exc_info->exc_traceback = local_tb;
22646     }
22647     #else
22648     tmp_type = tstate->exc_type;
22649     tmp_value = tstate->exc_value;
22650     tmp_tb = tstate->exc_traceback;
22651     tstate->exc_type = local_type;
22652     tstate->exc_value = local_value;
22653     tstate->exc_traceback = local_tb;
22654     #endif
22655     Py_XDECREF(tmp_type);
22656     Py_XDECREF(tmp_value);
22657     Py_XDECREF(tmp_tb);
22658 #else
22659     PyErr_SetExcInfo(local_type, local_value, local_tb);
22660 #endif
22661     return 0;
22662 bad:
22663     *type = 0;
22664     *value = 0;
22665     *tb = 0;
22666     Py_XDECREF(local_type);
22667     Py_XDECREF(local_value);
22668     Py_XDECREF(local_tb);
22669     return -1;
22670 }
22671 
22672 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)22673 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
22674     PyObject *empty_list = 0;
22675     PyObject *module = 0;
22676     PyObject *global_dict = 0;
22677     PyObject *empty_dict = 0;
22678     PyObject *list;
22679     #if PY_MAJOR_VERSION < 3
22680     PyObject *py_import;
22681     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
22682     if (!py_import)
22683         goto bad;
22684     #endif
22685     if (from_list)
22686         list = from_list;
22687     else {
22688         empty_list = PyList_New(0);
22689         if (!empty_list)
22690             goto bad;
22691         list = empty_list;
22692     }
22693     global_dict = PyModule_GetDict(__pyx_m);
22694     if (!global_dict)
22695         goto bad;
22696     empty_dict = PyDict_New();
22697     if (!empty_dict)
22698         goto bad;
22699     {
22700         #if PY_MAJOR_VERSION >= 3
22701         if (level == -1) {
22702             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
22703                 module = PyImport_ImportModuleLevelObject(
22704                     name, global_dict, empty_dict, list, 1);
22705                 if (!module) {
22706                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
22707                         goto bad;
22708                     PyErr_Clear();
22709                 }
22710             }
22711             level = 0;
22712         }
22713         #endif
22714         if (!module) {
22715             #if PY_MAJOR_VERSION < 3
22716             PyObject *py_level = PyInt_FromLong(level);
22717             if (!py_level)
22718                 goto bad;
22719             module = PyObject_CallFunctionObjArgs(py_import,
22720                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
22721             Py_DECREF(py_level);
22722             #else
22723             module = PyImport_ImportModuleLevelObject(
22724                 name, global_dict, empty_dict, list, level);
22725             #endif
22726         }
22727     }
22728 bad:
22729     #if PY_MAJOR_VERSION < 3
22730     Py_XDECREF(py_import);
22731     #endif
22732     Py_XDECREF(empty_list);
22733     Py_XDECREF(empty_dict);
22734     return module;
22735 }
22736 
22737 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))22738 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
22739          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
22740          const char* encoding, const char* errors,
22741          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
22742     Py_ssize_t length;
22743     if (unlikely((start < 0) | (stop < 0))) {
22744         size_t slen = strlen(cstring);
22745         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
22746             PyErr_SetString(PyExc_OverflowError,
22747                             "c-string too long to convert to Python");
22748             return NULL;
22749         }
22750         length = (Py_ssize_t) slen;
22751         if (start < 0) {
22752             start += length;
22753             if (start < 0)
22754                 start = 0;
22755         }
22756         if (stop < 0)
22757             stop += length;
22758     }
22759     if (unlikely(stop <= start))
22760         return __Pyx_NewRef(__pyx_empty_unicode);
22761     length = stop - start;
22762     cstring += start;
22763     if (decode_func) {
22764         return decode_func(cstring, length, errors);
22765     } else {
22766         return PyUnicode_Decode(cstring, length, encoding, errors);
22767     }
22768 }
22769 
22770 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)22771 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
22772                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
22773                                   int full_traceback, CYTHON_UNUSED int nogil) {
22774     PyObject *old_exc, *old_val, *old_tb;
22775     PyObject *ctx;
22776     __Pyx_PyThreadState_declare
22777 #ifdef WITH_THREAD
22778     PyGILState_STATE state;
22779     if (nogil)
22780         state = PyGILState_Ensure();
22781 #ifdef _MSC_VER
22782     else state = (PyGILState_STATE)-1;
22783 #endif
22784 #endif
22785     __Pyx_PyThreadState_assign
22786     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
22787     if (full_traceback) {
22788         Py_XINCREF(old_exc);
22789         Py_XINCREF(old_val);
22790         Py_XINCREF(old_tb);
22791         __Pyx_ErrRestore(old_exc, old_val, old_tb);
22792         PyErr_PrintEx(1);
22793     }
22794     #if PY_MAJOR_VERSION < 3
22795     ctx = PyString_FromString(name);
22796     #else
22797     ctx = PyUnicode_FromString(name);
22798     #endif
22799     __Pyx_ErrRestore(old_exc, old_val, old_tb);
22800     if (!ctx) {
22801         PyErr_WriteUnraisable(Py_None);
22802     } else {
22803         PyErr_WriteUnraisable(ctx);
22804         Py_DECREF(ctx);
22805     }
22806 #ifdef WITH_THREAD
22807     if (nogil)
22808         PyGILState_Release(state);
22809 #endif
22810 }
22811 
22812 /* KeywordStringCheck */
__Pyx_CheckKeywordStrings(PyObject * kwdict,const char * function_name,int kw_allowed)22813 static int __Pyx_CheckKeywordStrings(
22814     PyObject *kwdict,
22815     const char* function_name,
22816     int kw_allowed)
22817 {
22818     PyObject* key = 0;
22819     Py_ssize_t pos = 0;
22820 #if CYTHON_COMPILING_IN_PYPY
22821     if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
22822         goto invalid_keyword;
22823     return 1;
22824 #else
22825     while (PyDict_Next(kwdict, &pos, &key, 0)) {
22826         #if PY_MAJOR_VERSION < 3
22827         if (unlikely(!PyString_Check(key)))
22828         #endif
22829             if (unlikely(!PyUnicode_Check(key)))
22830                 goto invalid_keyword_type;
22831     }
22832     if ((!kw_allowed) && unlikely(key))
22833         goto invalid_keyword;
22834     return 1;
22835 invalid_keyword_type:
22836     PyErr_Format(PyExc_TypeError,
22837         "%.200s() keywords must be strings", function_name);
22838     return 0;
22839 #endif
22840 invalid_keyword:
22841     PyErr_Format(PyExc_TypeError,
22842     #if PY_MAJOR_VERSION < 3
22843         "%.200s() got an unexpected keyword argument '%.200s'",
22844         function_name, PyString_AsString(key));
22845     #else
22846         "%s() got an unexpected keyword argument '%U'",
22847         function_name, key);
22848     #endif
22849     return 0;
22850 }
22851 
22852 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)22853 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
22854     PyObject *attr;
22855 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
22856     PyTypeObject *tp = Py_TYPE(obj);
22857     PyObject *descr;
22858     descrgetfunc f = NULL;
22859     PyObject **dictptr, *dict;
22860     int meth_found = 0;
22861     assert (*method == NULL);
22862     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
22863         attr = __Pyx_PyObject_GetAttrStr(obj, name);
22864         goto try_unpack;
22865     }
22866     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
22867         return 0;
22868     }
22869     descr = _PyType_Lookup(tp, name);
22870     if (likely(descr != NULL)) {
22871         Py_INCREF(descr);
22872 #if PY_MAJOR_VERSION >= 3
22873         #ifdef __Pyx_CyFunction_USED
22874         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
22875         #else
22876         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
22877         #endif
22878 #else
22879         #ifdef __Pyx_CyFunction_USED
22880         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
22881         #else
22882         if (likely(PyFunction_Check(descr)))
22883         #endif
22884 #endif
22885         {
22886             meth_found = 1;
22887         } else {
22888             f = Py_TYPE(descr)->tp_descr_get;
22889             if (f != NULL && PyDescr_IsData(descr)) {
22890                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
22891                 Py_DECREF(descr);
22892                 goto try_unpack;
22893             }
22894         }
22895     }
22896     dictptr = _PyObject_GetDictPtr(obj);
22897     if (dictptr != NULL && (dict = *dictptr) != NULL) {
22898         Py_INCREF(dict);
22899         attr = __Pyx_PyDict_GetItemStr(dict, name);
22900         if (attr != NULL) {
22901             Py_INCREF(attr);
22902             Py_DECREF(dict);
22903             Py_XDECREF(descr);
22904             goto try_unpack;
22905         }
22906         Py_DECREF(dict);
22907     }
22908     if (meth_found) {
22909         *method = descr;
22910         return 1;
22911     }
22912     if (f != NULL) {
22913         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
22914         Py_DECREF(descr);
22915         goto try_unpack;
22916     }
22917     if (descr != NULL) {
22918         *method = descr;
22919         return 0;
22920     }
22921     PyErr_Format(PyExc_AttributeError,
22922 #if PY_MAJOR_VERSION >= 3
22923                  "'%.50s' object has no attribute '%U'",
22924                  tp->tp_name, name);
22925 #else
22926                  "'%.50s' object has no attribute '%.400s'",
22927                  tp->tp_name, PyString_AS_STRING(name));
22928 #endif
22929     return 0;
22930 #else
22931     attr = __Pyx_PyObject_GetAttrStr(obj, name);
22932     goto try_unpack;
22933 #endif
22934 try_unpack:
22935 #if CYTHON_UNPACK_METHODS
22936     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
22937         PyObject *function = PyMethod_GET_FUNCTION(attr);
22938         Py_INCREF(function);
22939         Py_DECREF(attr);
22940         *method = function;
22941         return 1;
22942     }
22943 #endif
22944     *method = attr;
22945     return 0;
22946 }
22947 
22948 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)22949 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
22950     PyObject *method = NULL, *result = NULL;
22951     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
22952     if (likely(is_method)) {
22953         result = __Pyx_PyObject_CallOneArg(method, obj);
22954         Py_DECREF(method);
22955         return result;
22956     }
22957     if (unlikely(!method)) goto bad;
22958     result = __Pyx_PyObject_CallNoArg(method);
22959     Py_DECREF(method);
22960 bad:
22961     return result;
22962 }
22963 
22964 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)22965 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
22966     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22967 }
22968 
22969 /* UnpackTupleError */
__Pyx_UnpackTupleError(PyObject * t,Py_ssize_t index)22970 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
22971     if (t == Py_None) {
22972       __Pyx_RaiseNoneNotIterableError();
22973     } else if (PyTuple_GET_SIZE(t) < index) {
22974       __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
22975     } else {
22976       __Pyx_RaiseTooManyValuesError(index);
22977     }
22978 }
22979 
22980 /* UnpackTuple2 */
__Pyx_unpack_tuple2_exact(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int decref_tuple)22981 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
22982         PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
22983     PyObject *value1 = NULL, *value2 = NULL;
22984 #if CYTHON_COMPILING_IN_PYPY
22985     value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
22986     value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
22987 #else
22988     value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
22989     value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
22990 #endif
22991     if (decref_tuple) {
22992         Py_DECREF(tuple);
22993     }
22994     *pvalue1 = value1;
22995     *pvalue2 = value2;
22996     return 0;
22997 #if CYTHON_COMPILING_IN_PYPY
22998 bad:
22999     Py_XDECREF(value1);
23000     Py_XDECREF(value2);
23001     if (decref_tuple) { Py_XDECREF(tuple); }
23002     return -1;
23003 #endif
23004 }
__Pyx_unpack_tuple2_generic(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int has_known_size,int decref_tuple)23005 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
23006                                        int has_known_size, int decref_tuple) {
23007     Py_ssize_t index;
23008     PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
23009     iternextfunc iternext;
23010     iter = PyObject_GetIter(tuple);
23011     if (unlikely(!iter)) goto bad;
23012     if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
23013     iternext = Py_TYPE(iter)->tp_iternext;
23014     value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
23015     value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
23016     if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
23017     Py_DECREF(iter);
23018     *pvalue1 = value1;
23019     *pvalue2 = value2;
23020     return 0;
23021 unpacking_failed:
23022     if (!has_known_size && __Pyx_IterFinish() == 0)
23023         __Pyx_RaiseNeedMoreValuesError(index);
23024 bad:
23025     Py_XDECREF(iter);
23026     Py_XDECREF(value1);
23027     Py_XDECREF(value2);
23028     if (decref_tuple) { Py_XDECREF(tuple); }
23029     return -1;
23030 }
23031 
23032 /* dict_iter */
__Pyx_dict_iterator(PyObject * iterable,int is_dict,PyObject * method_name,Py_ssize_t * p_orig_length,int * p_source_is_dict)23033 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
23034                                                    Py_ssize_t* p_orig_length, int* p_source_is_dict) {
23035     is_dict = is_dict || likely(PyDict_CheckExact(iterable));
23036     *p_source_is_dict = is_dict;
23037     if (is_dict) {
23038 #if !CYTHON_COMPILING_IN_PYPY
23039         *p_orig_length = PyDict_Size(iterable);
23040         Py_INCREF(iterable);
23041         return iterable;
23042 #elif PY_MAJOR_VERSION >= 3
23043         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
23044         PyObject **pp = NULL;
23045         if (method_name) {
23046             const char *name = PyUnicode_AsUTF8(method_name);
23047             if (strcmp(name, "iteritems") == 0) pp = &py_items;
23048             else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
23049             else if (strcmp(name, "itervalues") == 0) pp = &py_values;
23050             if (pp) {
23051                 if (!*pp) {
23052                     *pp = PyUnicode_FromString(name + 4);
23053                     if (!*pp)
23054                         return NULL;
23055                 }
23056                 method_name = *pp;
23057             }
23058         }
23059 #endif
23060     }
23061     *p_orig_length = 0;
23062     if (method_name) {
23063         PyObject* iter;
23064         iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
23065         if (!iterable)
23066             return NULL;
23067 #if !CYTHON_COMPILING_IN_PYPY
23068         if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
23069             return iterable;
23070 #endif
23071         iter = PyObject_GetIter(iterable);
23072         Py_DECREF(iterable);
23073         return iter;
23074     }
23075     return PyObject_GetIter(iterable);
23076 }
__Pyx_dict_iter_next(PyObject * iter_obj,CYTHON_NCP_UNUSED Py_ssize_t orig_length,CYTHON_NCP_UNUSED Py_ssize_t * ppos,PyObject ** pkey,PyObject ** pvalue,PyObject ** pitem,int source_is_dict)23077 static CYTHON_INLINE int __Pyx_dict_iter_next(
23078         PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
23079         PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
23080     PyObject* next_item;
23081 #if !CYTHON_COMPILING_IN_PYPY
23082     if (source_is_dict) {
23083         PyObject *key, *value;
23084         if (unlikely(orig_length != PyDict_Size(iter_obj))) {
23085             PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
23086             return -1;
23087         }
23088         if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
23089             return 0;
23090         }
23091         if (pitem) {
23092             PyObject* tuple = PyTuple_New(2);
23093             if (unlikely(!tuple)) {
23094                 return -1;
23095             }
23096             Py_INCREF(key);
23097             Py_INCREF(value);
23098             PyTuple_SET_ITEM(tuple, 0, key);
23099             PyTuple_SET_ITEM(tuple, 1, value);
23100             *pitem = tuple;
23101         } else {
23102             if (pkey) {
23103                 Py_INCREF(key);
23104                 *pkey = key;
23105             }
23106             if (pvalue) {
23107                 Py_INCREF(value);
23108                 *pvalue = value;
23109             }
23110         }
23111         return 1;
23112     } else if (PyTuple_CheckExact(iter_obj)) {
23113         Py_ssize_t pos = *ppos;
23114         if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
23115         *ppos = pos + 1;
23116         next_item = PyTuple_GET_ITEM(iter_obj, pos);
23117         Py_INCREF(next_item);
23118     } else if (PyList_CheckExact(iter_obj)) {
23119         Py_ssize_t pos = *ppos;
23120         if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
23121         *ppos = pos + 1;
23122         next_item = PyList_GET_ITEM(iter_obj, pos);
23123         Py_INCREF(next_item);
23124     } else
23125 #endif
23126     {
23127         next_item = PyIter_Next(iter_obj);
23128         if (unlikely(!next_item)) {
23129             return __Pyx_IterFinish();
23130         }
23131     }
23132     if (pitem) {
23133         *pitem = next_item;
23134     } else if (pkey && pvalue) {
23135         if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
23136             return -1;
23137     } else if (pkey) {
23138         *pkey = next_item;
23139     } else {
23140         *pvalue = next_item;
23141     }
23142     return 1;
23143 }
23144 
23145 /* DictGetItem */
23146 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)23147 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
23148     PyObject *value;
23149     value = PyDict_GetItemWithError(d, key);
23150     if (unlikely(!value)) {
23151         if (!PyErr_Occurred()) {
23152             if (unlikely(PyTuple_Check(key))) {
23153                 PyObject* args = PyTuple_Pack(1, key);
23154                 if (likely(args)) {
23155                     PyErr_SetObject(PyExc_KeyError, args);
23156                     Py_DECREF(args);
23157                 }
23158             } else {
23159                 PyErr_SetObject(PyExc_KeyError, key);
23160             }
23161         }
23162         return NULL;
23163     }
23164     Py_INCREF(value);
23165     return value;
23166 }
23167 #endif
23168 
23169 /* SliceObject */
__Pyx_PyObject_GetSlice(PyObject * obj,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)23170 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
23171         Py_ssize_t cstart, Py_ssize_t cstop,
23172         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
23173         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
23174 #if CYTHON_USE_TYPE_SLOTS
23175     PyMappingMethods* mp;
23176 #if PY_MAJOR_VERSION < 3
23177     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
23178     if (likely(ms && ms->sq_slice)) {
23179         if (!has_cstart) {
23180             if (_py_start && (*_py_start != Py_None)) {
23181                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
23182                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
23183             } else
23184                 cstart = 0;
23185         }
23186         if (!has_cstop) {
23187             if (_py_stop && (*_py_stop != Py_None)) {
23188                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
23189                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
23190             } else
23191                 cstop = PY_SSIZE_T_MAX;
23192         }
23193         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
23194             Py_ssize_t l = ms->sq_length(obj);
23195             if (likely(l >= 0)) {
23196                 if (cstop < 0) {
23197                     cstop += l;
23198                     if (cstop < 0) cstop = 0;
23199                 }
23200                 if (cstart < 0) {
23201                     cstart += l;
23202                     if (cstart < 0) cstart = 0;
23203                 }
23204             } else {
23205                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23206                     goto bad;
23207                 PyErr_Clear();
23208             }
23209         }
23210         return ms->sq_slice(obj, cstart, cstop);
23211     }
23212 #endif
23213     mp = Py_TYPE(obj)->tp_as_mapping;
23214     if (likely(mp && mp->mp_subscript))
23215 #endif
23216     {
23217         PyObject* result;
23218         PyObject *py_slice, *py_start, *py_stop;
23219         if (_py_slice) {
23220             py_slice = *_py_slice;
23221         } else {
23222             PyObject* owned_start = NULL;
23223             PyObject* owned_stop = NULL;
23224             if (_py_start) {
23225                 py_start = *_py_start;
23226             } else {
23227                 if (has_cstart) {
23228                     owned_start = py_start = PyInt_FromSsize_t(cstart);
23229                     if (unlikely(!py_start)) goto bad;
23230                 } else
23231                     py_start = Py_None;
23232             }
23233             if (_py_stop) {
23234                 py_stop = *_py_stop;
23235             } else {
23236                 if (has_cstop) {
23237                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
23238                     if (unlikely(!py_stop)) {
23239                         Py_XDECREF(owned_start);
23240                         goto bad;
23241                     }
23242                 } else
23243                     py_stop = Py_None;
23244             }
23245             py_slice = PySlice_New(py_start, py_stop, Py_None);
23246             Py_XDECREF(owned_start);
23247             Py_XDECREF(owned_stop);
23248             if (unlikely(!py_slice)) goto bad;
23249         }
23250 #if CYTHON_USE_TYPE_SLOTS
23251         result = mp->mp_subscript(obj, py_slice);
23252 #else
23253         result = PyObject_GetItem(obj, py_slice);
23254 #endif
23255         if (!_py_slice) {
23256             Py_DECREF(py_slice);
23257         }
23258         return result;
23259     }
23260     PyErr_Format(PyExc_TypeError,
23261         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
23262 bad:
23263     return NULL;
23264 }
23265 
23266 /* SliceObject */
__Pyx_PyObject_SetSlice(PyObject * obj,PyObject * value,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)23267 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
23268         Py_ssize_t cstart, Py_ssize_t cstop,
23269         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
23270         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
23271 #if CYTHON_USE_TYPE_SLOTS
23272     PyMappingMethods* mp;
23273 #if PY_MAJOR_VERSION < 3
23274     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
23275     if (likely(ms && ms->sq_ass_slice)) {
23276         if (!has_cstart) {
23277             if (_py_start && (*_py_start != Py_None)) {
23278                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
23279                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
23280             } else
23281                 cstart = 0;
23282         }
23283         if (!has_cstop) {
23284             if (_py_stop && (*_py_stop != Py_None)) {
23285                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
23286                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
23287             } else
23288                 cstop = PY_SSIZE_T_MAX;
23289         }
23290         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
23291             Py_ssize_t l = ms->sq_length(obj);
23292             if (likely(l >= 0)) {
23293                 if (cstop < 0) {
23294                     cstop += l;
23295                     if (cstop < 0) cstop = 0;
23296                 }
23297                 if (cstart < 0) {
23298                     cstart += l;
23299                     if (cstart < 0) cstart = 0;
23300                 }
23301             } else {
23302                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23303                     goto bad;
23304                 PyErr_Clear();
23305             }
23306         }
23307         return ms->sq_ass_slice(obj, cstart, cstop, value);
23308     }
23309 #endif
23310     mp = Py_TYPE(obj)->tp_as_mapping;
23311     if (likely(mp && mp->mp_ass_subscript))
23312 #endif
23313     {
23314         int result;
23315         PyObject *py_slice, *py_start, *py_stop;
23316         if (_py_slice) {
23317             py_slice = *_py_slice;
23318         } else {
23319             PyObject* owned_start = NULL;
23320             PyObject* owned_stop = NULL;
23321             if (_py_start) {
23322                 py_start = *_py_start;
23323             } else {
23324                 if (has_cstart) {
23325                     owned_start = py_start = PyInt_FromSsize_t(cstart);
23326                     if (unlikely(!py_start)) goto bad;
23327                 } else
23328                     py_start = Py_None;
23329             }
23330             if (_py_stop) {
23331                 py_stop = *_py_stop;
23332             } else {
23333                 if (has_cstop) {
23334                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
23335                     if (unlikely(!py_stop)) {
23336                         Py_XDECREF(owned_start);
23337                         goto bad;
23338                     }
23339                 } else
23340                     py_stop = Py_None;
23341             }
23342             py_slice = PySlice_New(py_start, py_stop, Py_None);
23343             Py_XDECREF(owned_start);
23344             Py_XDECREF(owned_stop);
23345             if (unlikely(!py_slice)) goto bad;
23346         }
23347 #if CYTHON_USE_TYPE_SLOTS
23348         result = mp->mp_ass_subscript(obj, py_slice, value);
23349 #else
23350         result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
23351 #endif
23352         if (!_py_slice) {
23353             Py_DECREF(py_slice);
23354         }
23355         return result;
23356     }
23357     PyErr_Format(PyExc_TypeError,
23358         "'%.200s' object does not support slice %.10s",
23359         Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
23360 bad:
23361     return -1;
23362 }
23363 
23364 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)23365 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
23366 #if CYTHON_USE_TYPE_SLOTS
23367 #if PY_MAJOR_VERSION >= 3
23368     if (likely(PyUnicode_Check(n)))
23369 #else
23370     if (likely(PyString_Check(n)))
23371 #endif
23372         return __Pyx_PyObject_GetAttrStr(o, n);
23373 #endif
23374     return PyObject_GetAttr(o, n);
23375 }
23376 
23377 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)23378 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
23379     PyObject *r;
23380     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
23381         PyErr_SetString(PyExc_TypeError,
23382                         "hasattr(): attribute name must be string");
23383         return -1;
23384     }
23385     r = __Pyx_GetAttr(o, n);
23386     if (unlikely(!r)) {
23387         PyErr_Clear();
23388         return 0;
23389     } else {
23390         Py_DECREF(r);
23391         return 1;
23392     }
23393 }
23394 
23395 /* TypeImport */
23396 #ifndef __PYX_HAVE_RT_ImportType
23397 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)23398 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
23399     size_t size, enum __Pyx_ImportType_CheckSize check_size)
23400 {
23401     PyObject *result = 0;
23402     char warning[200];
23403     Py_ssize_t basicsize;
23404 #ifdef Py_LIMITED_API
23405     PyObject *py_basicsize;
23406 #endif
23407     result = PyObject_GetAttrString(module, class_name);
23408     if (!result)
23409         goto bad;
23410     if (!PyType_Check(result)) {
23411         PyErr_Format(PyExc_TypeError,
23412             "%.200s.%.200s is not a type object",
23413             module_name, class_name);
23414         goto bad;
23415     }
23416 #ifndef Py_LIMITED_API
23417     basicsize = ((PyTypeObject *)result)->tp_basicsize;
23418 #else
23419     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
23420     if (!py_basicsize)
23421         goto bad;
23422     basicsize = PyLong_AsSsize_t(py_basicsize);
23423     Py_DECREF(py_basicsize);
23424     py_basicsize = 0;
23425     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
23426         goto bad;
23427 #endif
23428     if ((size_t)basicsize < size) {
23429         PyErr_Format(PyExc_ValueError,
23430             "%.200s.%.200s size changed, may indicate binary incompatibility. "
23431             "Expected %zd from C header, got %zd from PyObject",
23432             module_name, class_name, size, basicsize);
23433         goto bad;
23434     }
23435     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
23436         PyErr_Format(PyExc_ValueError,
23437             "%.200s.%.200s size changed, may indicate binary incompatibility. "
23438             "Expected %zd from C header, got %zd from PyObject",
23439             module_name, class_name, size, basicsize);
23440         goto bad;
23441     }
23442     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
23443         PyOS_snprintf(warning, sizeof(warning),
23444             "%s.%s size changed, may indicate binary incompatibility. "
23445             "Expected %zd from C header, got %zd from PyObject",
23446             module_name, class_name, size, basicsize);
23447         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
23448     }
23449     return (PyTypeObject *)result;
23450 bad:
23451     Py_XDECREF(result);
23452     return NULL;
23453 }
23454 #endif
23455 
23456 /* PyObject_GenericGetAttrNoDict */
23457 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)23458 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
23459     PyErr_Format(PyExc_AttributeError,
23460 #if PY_MAJOR_VERSION >= 3
23461                  "'%.50s' object has no attribute '%U'",
23462                  tp->tp_name, attr_name);
23463 #else
23464                  "'%.50s' object has no attribute '%.400s'",
23465                  tp->tp_name, PyString_AS_STRING(attr_name));
23466 #endif
23467     return NULL;
23468 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)23469 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
23470     PyObject *descr;
23471     PyTypeObject *tp = Py_TYPE(obj);
23472     if (unlikely(!PyString_Check(attr_name))) {
23473         return PyObject_GenericGetAttr(obj, attr_name);
23474     }
23475     assert(!tp->tp_dictoffset);
23476     descr = _PyType_Lookup(tp, attr_name);
23477     if (unlikely(!descr)) {
23478         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
23479     }
23480     Py_INCREF(descr);
23481     #if PY_MAJOR_VERSION < 3
23482     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
23483     #endif
23484     {
23485         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
23486         if (unlikely(f)) {
23487             PyObject *res = f(descr, obj, (PyObject *)tp);
23488             Py_DECREF(descr);
23489             return res;
23490         }
23491     }
23492     return descr;
23493 }
23494 #endif
23495 
23496 /* PyObject_GenericGetAttr */
23497 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)23498 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
23499     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
23500         return PyObject_GenericGetAttr(obj, attr_name);
23501     }
23502     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
23503 }
23504 #endif
23505 
23506 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)23507 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
23508     __Pyx_PyThreadState_declare
23509     __Pyx_PyThreadState_assign
23510     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23511         __Pyx_PyErr_Clear();
23512 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)23513 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
23514     PyObject *result;
23515 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
23516     PyTypeObject* tp = Py_TYPE(obj);
23517     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
23518         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
23519     }
23520 #endif
23521     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
23522     if (unlikely(!result)) {
23523         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
23524     }
23525     return result;
23526 }
23527 
23528 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)23529 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
23530   int ret;
23531   PyObject *name_attr;
23532   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
23533   if (likely(name_attr)) {
23534       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
23535   } else {
23536       ret = -1;
23537   }
23538   if (unlikely(ret < 0)) {
23539       PyErr_Clear();
23540       ret = 0;
23541   }
23542   Py_XDECREF(name_attr);
23543   return ret;
23544 }
__Pyx_setup_reduce(PyObject * type_obj)23545 static int __Pyx_setup_reduce(PyObject* type_obj) {
23546     int ret = 0;
23547     PyObject *object_reduce = NULL;
23548     PyObject *object_reduce_ex = NULL;
23549     PyObject *reduce = NULL;
23550     PyObject *reduce_ex = NULL;
23551     PyObject *reduce_cython = NULL;
23552     PyObject *setstate = NULL;
23553     PyObject *setstate_cython = NULL;
23554 #if CYTHON_USE_PYTYPE_LOOKUP
23555     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
23556 #else
23557     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
23558 #endif
23559 #if CYTHON_USE_PYTYPE_LOOKUP
23560     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
23561 #else
23562     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
23563 #endif
23564     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
23565     if (reduce_ex == object_reduce_ex) {
23566 #if CYTHON_USE_PYTYPE_LOOKUP
23567         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
23568 #else
23569         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
23570 #endif
23571         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
23572         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
23573             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
23574             if (likely(reduce_cython)) {
23575                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23576                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23577             } else if (reduce == object_reduce || PyErr_Occurred()) {
23578                 goto __PYX_BAD;
23579             }
23580             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
23581             if (!setstate) PyErr_Clear();
23582             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
23583                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
23584                 if (likely(setstate_cython)) {
23585                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23586                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23587                 } else if (!setstate || PyErr_Occurred()) {
23588                     goto __PYX_BAD;
23589                 }
23590             }
23591             PyType_Modified((PyTypeObject*)type_obj);
23592         }
23593     }
23594     goto __PYX_GOOD;
23595 __PYX_BAD:
23596     if (!PyErr_Occurred())
23597         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
23598     ret = -1;
23599 __PYX_GOOD:
23600 #if !CYTHON_USE_PYTYPE_LOOKUP
23601     Py_XDECREF(object_reduce);
23602     Py_XDECREF(object_reduce_ex);
23603 #endif
23604     Py_XDECREF(reduce);
23605     Py_XDECREF(reduce_ex);
23606     Py_XDECREF(reduce_cython);
23607     Py_XDECREF(setstate);
23608     Py_XDECREF(setstate_cython);
23609     return ret;
23610 }
23611 
23612 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)23613 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
23614 #if PY_VERSION_HEX >= 0x02070000
23615     PyObject *ob = PyCapsule_New(vtable, 0, 0);
23616 #else
23617     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
23618 #endif
23619     if (!ob)
23620         goto bad;
23621     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
23622         goto bad;
23623     Py_DECREF(ob);
23624     return 0;
23625 bad:
23626     Py_XDECREF(ob);
23627     return -1;
23628 }
23629 
23630 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)23631 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
23632     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
23633     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
23634         PyErr_Format(PyExc_ImportError,
23635         #if PY_MAJOR_VERSION < 3
23636             "cannot import name %.230s", PyString_AS_STRING(name));
23637         #else
23638             "cannot import name %S", name);
23639         #endif
23640     }
23641     return value;
23642 }
23643 
23644 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)23645 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
23646     PyObject* fake_module;
23647     PyTypeObject* cached_type = NULL;
23648     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
23649     if (!fake_module) return NULL;
23650     Py_INCREF(fake_module);
23651     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
23652     if (cached_type) {
23653         if (!PyType_Check((PyObject*)cached_type)) {
23654             PyErr_Format(PyExc_TypeError,
23655                 "Shared Cython type %.200s is not a type object",
23656                 type->tp_name);
23657             goto bad;
23658         }
23659         if (cached_type->tp_basicsize != type->tp_basicsize) {
23660             PyErr_Format(PyExc_TypeError,
23661                 "Shared Cython type %.200s has the wrong size, try recompiling",
23662                 type->tp_name);
23663             goto bad;
23664         }
23665     } else {
23666         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
23667         PyErr_Clear();
23668         if (PyType_Ready(type) < 0) goto bad;
23669         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
23670             goto bad;
23671         Py_INCREF(type);
23672         cached_type = type;
23673     }
23674 done:
23675     Py_DECREF(fake_module);
23676     return cached_type;
23677 bad:
23678     Py_XDECREF(cached_type);
23679     cached_type = NULL;
23680     goto done;
23681 }
23682 
23683 /* CythonFunctionShared */
23684 #include <structmember.h>
23685 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)23686 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
23687 {
23688     if (unlikely(op->func_doc == NULL)) {
23689         if (op->func.m_ml->ml_doc) {
23690 #if PY_MAJOR_VERSION >= 3
23691             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
23692 #else
23693             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
23694 #endif
23695             if (unlikely(op->func_doc == NULL))
23696                 return NULL;
23697         } else {
23698             Py_INCREF(Py_None);
23699             return Py_None;
23700         }
23701     }
23702     Py_INCREF(op->func_doc);
23703     return op->func_doc;
23704 }
23705 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23706 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23707 {
23708     PyObject *tmp = op->func_doc;
23709     if (value == NULL) {
23710         value = Py_None;
23711     }
23712     Py_INCREF(value);
23713     op->func_doc = value;
23714     Py_XDECREF(tmp);
23715     return 0;
23716 }
23717 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23718 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23719 {
23720     if (unlikely(op->func_name == NULL)) {
23721 #if PY_MAJOR_VERSION >= 3
23722         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
23723 #else
23724         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
23725 #endif
23726         if (unlikely(op->func_name == NULL))
23727             return NULL;
23728     }
23729     Py_INCREF(op->func_name);
23730     return op->func_name;
23731 }
23732 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23733 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23734 {
23735     PyObject *tmp;
23736 #if PY_MAJOR_VERSION >= 3
23737     if (unlikely(value == NULL || !PyUnicode_Check(value)))
23738 #else
23739     if (unlikely(value == NULL || !PyString_Check(value)))
23740 #endif
23741     {
23742         PyErr_SetString(PyExc_TypeError,
23743                         "__name__ must be set to a string object");
23744         return -1;
23745     }
23746     tmp = op->func_name;
23747     Py_INCREF(value);
23748     op->func_name = value;
23749     Py_XDECREF(tmp);
23750     return 0;
23751 }
23752 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23753 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23754 {
23755     Py_INCREF(op->func_qualname);
23756     return op->func_qualname;
23757 }
23758 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23759 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23760 {
23761     PyObject *tmp;
23762 #if PY_MAJOR_VERSION >= 3
23763     if (unlikely(value == NULL || !PyUnicode_Check(value)))
23764 #else
23765     if (unlikely(value == NULL || !PyString_Check(value)))
23766 #endif
23767     {
23768         PyErr_SetString(PyExc_TypeError,
23769                         "__qualname__ must be set to a string object");
23770         return -1;
23771     }
23772     tmp = op->func_qualname;
23773     Py_INCREF(value);
23774     op->func_qualname = value;
23775     Py_XDECREF(tmp);
23776     return 0;
23777 }
23778 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)23779 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
23780 {
23781     PyObject *self;
23782     self = m->func_closure;
23783     if (self == NULL)
23784         self = Py_None;
23785     Py_INCREF(self);
23786     return self;
23787 }
23788 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23789 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23790 {
23791     if (unlikely(op->func_dict == NULL)) {
23792         op->func_dict = PyDict_New();
23793         if (unlikely(op->func_dict == NULL))
23794             return NULL;
23795     }
23796     Py_INCREF(op->func_dict);
23797     return op->func_dict;
23798 }
23799 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23800 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
23801 {
23802     PyObject *tmp;
23803     if (unlikely(value == NULL)) {
23804         PyErr_SetString(PyExc_TypeError,
23805                "function's dictionary may not be deleted");
23806         return -1;
23807     }
23808     if (unlikely(!PyDict_Check(value))) {
23809         PyErr_SetString(PyExc_TypeError,
23810                "setting function's dictionary to a non-dict");
23811         return -1;
23812     }
23813     tmp = op->func_dict;
23814     Py_INCREF(value);
23815     op->func_dict = value;
23816     Py_XDECREF(tmp);
23817     return 0;
23818 }
23819 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23820 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23821 {
23822     Py_INCREF(op->func_globals);
23823     return op->func_globals;
23824 }
23825 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23826 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23827 {
23828     Py_INCREF(Py_None);
23829     return Py_None;
23830 }
23831 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23832 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
23833 {
23834     PyObject* result = (op->func_code) ? op->func_code : Py_None;
23835     Py_INCREF(result);
23836     return result;
23837 }
23838 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)23839 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
23840     int result = 0;
23841     PyObject *res = op->defaults_getter((PyObject *) op);
23842     if (unlikely(!res))
23843         return -1;
23844     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23845     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
23846     Py_INCREF(op->defaults_tuple);
23847     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
23848     Py_INCREF(op->defaults_kwdict);
23849     #else
23850     op->defaults_tuple = PySequence_ITEM(res, 0);
23851     if (unlikely(!op->defaults_tuple)) result = -1;
23852     else {
23853         op->defaults_kwdict = PySequence_ITEM(res, 1);
23854         if (unlikely(!op->defaults_kwdict)) result = -1;
23855     }
23856     #endif
23857     Py_DECREF(res);
23858     return result;
23859 }
23860 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23861 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
23862     PyObject* tmp;
23863     if (!value) {
23864         value = Py_None;
23865     } else if (value != Py_None && !PyTuple_Check(value)) {
23866         PyErr_SetString(PyExc_TypeError,
23867                         "__defaults__ must be set to a tuple object");
23868         return -1;
23869     }
23870     Py_INCREF(value);
23871     tmp = op->defaults_tuple;
23872     op->defaults_tuple = value;
23873     Py_XDECREF(tmp);
23874     return 0;
23875 }
23876 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23877 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
23878     PyObject* result = op->defaults_tuple;
23879     if (unlikely(!result)) {
23880         if (op->defaults_getter) {
23881             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
23882             result = op->defaults_tuple;
23883         } else {
23884             result = Py_None;
23885         }
23886     }
23887     Py_INCREF(result);
23888     return result;
23889 }
23890 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23891 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
23892     PyObject* tmp;
23893     if (!value) {
23894         value = Py_None;
23895     } else if (value != Py_None && !PyDict_Check(value)) {
23896         PyErr_SetString(PyExc_TypeError,
23897                         "__kwdefaults__ must be set to a dict object");
23898         return -1;
23899     }
23900     Py_INCREF(value);
23901     tmp = op->defaults_kwdict;
23902     op->defaults_kwdict = value;
23903     Py_XDECREF(tmp);
23904     return 0;
23905 }
23906 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23907 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
23908     PyObject* result = op->defaults_kwdict;
23909     if (unlikely(!result)) {
23910         if (op->defaults_getter) {
23911             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
23912             result = op->defaults_kwdict;
23913         } else {
23914             result = Py_None;
23915         }
23916     }
23917     Py_INCREF(result);
23918     return result;
23919 }
23920 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)23921 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
23922     PyObject* tmp;
23923     if (!value || value == Py_None) {
23924         value = NULL;
23925     } else if (!PyDict_Check(value)) {
23926         PyErr_SetString(PyExc_TypeError,
23927                         "__annotations__ must be set to a dict object");
23928         return -1;
23929     }
23930     Py_XINCREF(value);
23931     tmp = op->func_annotations;
23932     op->func_annotations = value;
23933     Py_XDECREF(tmp);
23934     return 0;
23935 }
23936 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)23937 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
23938     PyObject* result = op->func_annotations;
23939     if (unlikely(!result)) {
23940         result = PyDict_New();
23941         if (unlikely(!result)) return NULL;
23942         op->func_annotations = result;
23943     }
23944     Py_INCREF(result);
23945     return result;
23946 }
23947 static PyGetSetDef __pyx_CyFunction_getsets[] = {
23948     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
23949     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
23950     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
23951     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
23952     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
23953     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
23954     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
23955     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
23956     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
23957     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
23958     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
23959     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
23960     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
23961     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
23962     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
23963     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
23964     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
23965     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
23966     {0, 0, 0, 0, 0}
23967 };
23968 static PyMemberDef __pyx_CyFunction_members[] = {
23969     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
23970     {0, 0, 0,  0, 0}
23971 };
23972 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)23973 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
23974 {
23975 #if PY_MAJOR_VERSION >= 3
23976     Py_INCREF(m->func_qualname);
23977     return m->func_qualname;
23978 #else
23979     return PyString_FromString(m->func.m_ml->ml_name);
23980 #endif
23981 }
23982 static PyMethodDef __pyx_CyFunction_methods[] = {
23983     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
23984     {0, 0, 0, 0}
23985 };
23986 #if PY_VERSION_HEX < 0x030500A0
23987 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
23988 #else
23989 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
23990 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)23991 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
23992                                        PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
23993     if (unlikely(op == NULL))
23994         return NULL;
23995     op->flags = flags;
23996     __Pyx_CyFunction_weakreflist(op) = NULL;
23997     op->func.m_ml = ml;
23998     op->func.m_self = (PyObject *) op;
23999     Py_XINCREF(closure);
24000     op->func_closure = closure;
24001     Py_XINCREF(module);
24002     op->func.m_module = module;
24003     op->func_dict = NULL;
24004     op->func_name = NULL;
24005     Py_INCREF(qualname);
24006     op->func_qualname = qualname;
24007     op->func_doc = NULL;
24008     op->func_classobj = NULL;
24009     op->func_globals = globals;
24010     Py_INCREF(op->func_globals);
24011     Py_XINCREF(code);
24012     op->func_code = code;
24013     op->defaults_pyobjects = 0;
24014     op->defaults_size = 0;
24015     op->defaults = NULL;
24016     op->defaults_tuple = NULL;
24017     op->defaults_kwdict = NULL;
24018     op->defaults_getter = NULL;
24019     op->func_annotations = NULL;
24020     return (PyObject *) op;
24021 }
24022 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)24023 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
24024 {
24025     Py_CLEAR(m->func_closure);
24026     Py_CLEAR(m->func.m_module);
24027     Py_CLEAR(m->func_dict);
24028     Py_CLEAR(m->func_name);
24029     Py_CLEAR(m->func_qualname);
24030     Py_CLEAR(m->func_doc);
24031     Py_CLEAR(m->func_globals);
24032     Py_CLEAR(m->func_code);
24033     Py_CLEAR(m->func_classobj);
24034     Py_CLEAR(m->defaults_tuple);
24035     Py_CLEAR(m->defaults_kwdict);
24036     Py_CLEAR(m->func_annotations);
24037     if (m->defaults) {
24038         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
24039         int i;
24040         for (i = 0; i < m->defaults_pyobjects; i++)
24041             Py_XDECREF(pydefaults[i]);
24042         PyObject_Free(m->defaults);
24043         m->defaults = NULL;
24044     }
24045     return 0;
24046 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)24047 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
24048 {
24049     if (__Pyx_CyFunction_weakreflist(m) != NULL)
24050         PyObject_ClearWeakRefs((PyObject *) m);
24051     __Pyx_CyFunction_clear(m);
24052     PyObject_GC_Del(m);
24053 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)24054 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
24055 {
24056     PyObject_GC_UnTrack(m);
24057     __Pyx__CyFunction_dealloc(m);
24058 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)24059 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
24060 {
24061     Py_VISIT(m->func_closure);
24062     Py_VISIT(m->func.m_module);
24063     Py_VISIT(m->func_dict);
24064     Py_VISIT(m->func_name);
24065     Py_VISIT(m->func_qualname);
24066     Py_VISIT(m->func_doc);
24067     Py_VISIT(m->func_globals);
24068     Py_VISIT(m->func_code);
24069     Py_VISIT(m->func_classobj);
24070     Py_VISIT(m->defaults_tuple);
24071     Py_VISIT(m->defaults_kwdict);
24072     if (m->defaults) {
24073         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
24074         int i;
24075         for (i = 0; i < m->defaults_pyobjects; i++)
24076             Py_VISIT(pydefaults[i]);
24077     }
24078     return 0;
24079 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)24080 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
24081 {
24082 #if PY_MAJOR_VERSION < 3
24083     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24084     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
24085         Py_INCREF(func);
24086         return func;
24087     }
24088     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
24089         if (type == NULL)
24090             type = (PyObject *)(Py_TYPE(obj));
24091         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
24092     }
24093     if (obj == Py_None)
24094         obj = NULL;
24095 #endif
24096     return __Pyx_PyMethod_New(func, obj, type);
24097 }
24098 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)24099 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
24100 {
24101 #if PY_MAJOR_VERSION >= 3
24102     return PyUnicode_FromFormat("<cyfunction %U at %p>",
24103                                 op->func_qualname, (void *)op);
24104 #else
24105     return PyString_FromFormat("<cyfunction %s at %p>",
24106                                PyString_AsString(op->func_qualname), (void *)op);
24107 #endif
24108 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)24109 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
24110     PyCFunctionObject* f = (PyCFunctionObject*)func;
24111     PyCFunction meth = f->m_ml->ml_meth;
24112     Py_ssize_t size;
24113     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
24114     case METH_VARARGS:
24115         if (likely(kw == NULL || PyDict_Size(kw) == 0))
24116             return (*meth)(self, arg);
24117         break;
24118     case METH_VARARGS | METH_KEYWORDS:
24119         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
24120     case METH_NOARGS:
24121         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
24122             size = PyTuple_GET_SIZE(arg);
24123             if (likely(size == 0))
24124                 return (*meth)(self, NULL);
24125             PyErr_Format(PyExc_TypeError,
24126                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
24127                 f->m_ml->ml_name, size);
24128             return NULL;
24129         }
24130         break;
24131     case METH_O:
24132         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
24133             size = PyTuple_GET_SIZE(arg);
24134             if (likely(size == 1)) {
24135                 PyObject *result, *arg0;
24136                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24137                 arg0 = PyTuple_GET_ITEM(arg, 0);
24138                 #else
24139                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
24140                 #endif
24141                 result = (*meth)(self, arg0);
24142                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
24143                 Py_DECREF(arg0);
24144                 #endif
24145                 return result;
24146             }
24147             PyErr_Format(PyExc_TypeError,
24148                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
24149                 f->m_ml->ml_name, size);
24150             return NULL;
24151         }
24152         break;
24153     default:
24154         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
24155                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
24156                         "longer supported!");
24157         return NULL;
24158     }
24159     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
24160                  f->m_ml->ml_name);
24161     return NULL;
24162 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)24163 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
24164     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
24165 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)24166 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
24167     PyObject *result;
24168     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
24169     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
24170         Py_ssize_t argc;
24171         PyObject *new_args;
24172         PyObject *self;
24173         argc = PyTuple_GET_SIZE(args);
24174         new_args = PyTuple_GetSlice(args, 1, argc);
24175         if (unlikely(!new_args))
24176             return NULL;
24177         self = PyTuple_GetItem(args, 0);
24178         if (unlikely(!self)) {
24179             Py_DECREF(new_args);
24180             return NULL;
24181         }
24182         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
24183         Py_DECREF(new_args);
24184     } else {
24185         result = __Pyx_CyFunction_Call(func, args, kw);
24186     }
24187     return result;
24188 }
24189 static PyTypeObject __pyx_CyFunctionType_type = {
24190     PyVarObject_HEAD_INIT(0, 0)
24191     "cython_function_or_method",
24192     sizeof(__pyx_CyFunctionObject),
24193     0,
24194     (destructor) __Pyx_CyFunction_dealloc,
24195     0,
24196     0,
24197     0,
24198 #if PY_MAJOR_VERSION < 3
24199     0,
24200 #else
24201     0,
24202 #endif
24203     (reprfunc) __Pyx_CyFunction_repr,
24204     0,
24205     0,
24206     0,
24207     0,
24208     __Pyx_CyFunction_CallAsMethod,
24209     0,
24210     0,
24211     0,
24212     0,
24213     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
24214     0,
24215     (traverseproc) __Pyx_CyFunction_traverse,
24216     (inquiry) __Pyx_CyFunction_clear,
24217     0,
24218 #if PY_VERSION_HEX < 0x030500A0
24219     offsetof(__pyx_CyFunctionObject, func_weakreflist),
24220 #else
24221     offsetof(PyCFunctionObject, m_weakreflist),
24222 #endif
24223     0,
24224     0,
24225     __pyx_CyFunction_methods,
24226     __pyx_CyFunction_members,
24227     __pyx_CyFunction_getsets,
24228     0,
24229     0,
24230     __Pyx_CyFunction_descr_get,
24231     0,
24232     offsetof(__pyx_CyFunctionObject, func_dict),
24233     0,
24234     0,
24235     0,
24236     0,
24237     0,
24238     0,
24239     0,
24240     0,
24241     0,
24242     0,
24243     0,
24244     0,
24245 #if PY_VERSION_HEX >= 0x030400a1
24246     0,
24247 #endif
24248 #if PY_VERSION_HEX >= 0x030800b1
24249     0,
24250 #endif
24251 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24252     0,
24253 #endif
24254 };
__pyx_CyFunction_init(void)24255 static int __pyx_CyFunction_init(void) {
24256     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
24257     if (unlikely(__pyx_CyFunctionType == NULL)) {
24258         return -1;
24259     }
24260     return 0;
24261 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)24262 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
24263     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24264     m->defaults = PyObject_Malloc(size);
24265     if (unlikely(!m->defaults))
24266         return PyErr_NoMemory();
24267     memset(m->defaults, 0, size);
24268     m->defaults_pyobjects = pyobjects;
24269     m->defaults_size = size;
24270     return m->defaults;
24271 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)24272 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
24273     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24274     m->defaults_tuple = tuple;
24275     Py_INCREF(tuple);
24276 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)24277 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
24278     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24279     m->defaults_kwdict = dict;
24280     Py_INCREF(dict);
24281 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)24282 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
24283     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
24284     m->func_annotations = dict;
24285     Py_INCREF(dict);
24286 }
24287 
24288 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)24289 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
24290                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
24291     PyObject *op = __Pyx_CyFunction_Init(
24292         PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
24293         ml, flags, qualname, closure, module, globals, code
24294     );
24295     if (likely(op)) {
24296         PyObject_GC_Track(op);
24297     }
24298     return op;
24299 }
24300 
24301 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)24302 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
24303     Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
24304     for (i=0; i < nbases; i++) {
24305         PyTypeObject *tmptype;
24306         PyObject *tmp = PyTuple_GET_ITEM(bases, i);
24307         tmptype = Py_TYPE(tmp);
24308 #if PY_MAJOR_VERSION < 3
24309         if (tmptype == &PyClass_Type)
24310             continue;
24311 #endif
24312         if (!metaclass) {
24313             metaclass = tmptype;
24314             continue;
24315         }
24316         if (PyType_IsSubtype(metaclass, tmptype))
24317             continue;
24318         if (PyType_IsSubtype(tmptype, metaclass)) {
24319             metaclass = tmptype;
24320             continue;
24321         }
24322         PyErr_SetString(PyExc_TypeError,
24323                         "metaclass conflict: "
24324                         "the metaclass of a derived class "
24325                         "must be a (non-strict) subclass "
24326                         "of the metaclasses of all its bases");
24327         return NULL;
24328     }
24329     if (!metaclass) {
24330 #if PY_MAJOR_VERSION < 3
24331         metaclass = &PyClass_Type;
24332 #else
24333         metaclass = &PyType_Type;
24334 #endif
24335     }
24336     Py_INCREF((PyObject*) metaclass);
24337     return (PyObject*) metaclass;
24338 }
24339 
24340 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)24341 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
24342                                            PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
24343     PyObject *ns;
24344     if (metaclass) {
24345         PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
24346         if (prep) {
24347             PyObject *pargs = PyTuple_Pack(2, name, bases);
24348             if (unlikely(!pargs)) {
24349                 Py_DECREF(prep);
24350                 return NULL;
24351             }
24352             ns = PyObject_Call(prep, pargs, mkw);
24353             Py_DECREF(prep);
24354             Py_DECREF(pargs);
24355         } else {
24356             if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
24357                 return NULL;
24358             PyErr_Clear();
24359             ns = PyDict_New();
24360         }
24361     } else {
24362         ns = PyDict_New();
24363     }
24364     if (unlikely(!ns))
24365         return NULL;
24366     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
24367     if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
24368     if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
24369     return ns;
24370 bad:
24371     Py_DECREF(ns);
24372     return NULL;
24373 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)24374 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
24375                                       PyObject *dict, PyObject *mkw,
24376                                       int calculate_metaclass, int allow_py2_metaclass) {
24377     PyObject *result, *margs;
24378     PyObject *owned_metaclass = NULL;
24379     if (allow_py2_metaclass) {
24380         owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
24381         if (owned_metaclass) {
24382             metaclass = owned_metaclass;
24383         } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
24384             PyErr_Clear();
24385         } else {
24386             return NULL;
24387         }
24388     }
24389     if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
24390         metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
24391         Py_XDECREF(owned_metaclass);
24392         if (unlikely(!metaclass))
24393             return NULL;
24394         owned_metaclass = metaclass;
24395     }
24396     margs = PyTuple_Pack(3, name, bases, dict);
24397     if (unlikely(!margs)) {
24398         result = NULL;
24399     } else {
24400         result = PyObject_Call(metaclass, margs, mkw);
24401         Py_DECREF(margs);
24402     }
24403     Py_XDECREF(owned_metaclass);
24404     return result;
24405 }
24406 
24407 /* ClassMethod */
__Pyx_Method_ClassMethod(PyObject * method)24408 static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
24409 #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000
24410     if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) {
24411         return PyClassMethod_New(method);
24412     }
24413 #else
24414 #if CYTHON_COMPILING_IN_PYSTON || CYTHON_COMPILING_IN_PYPY
24415     if (PyMethodDescr_Check(method))
24416 #else
24417     #if PY_MAJOR_VERSION == 2
24418     static PyTypeObject *methoddescr_type = NULL;
24419     if (methoddescr_type == NULL) {
24420        PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
24421        if (!meth) return NULL;
24422        methoddescr_type = Py_TYPE(meth);
24423        Py_DECREF(meth);
24424     }
24425     #else
24426     PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
24427     #endif
24428     if (__Pyx_TypeCheck(method, methoddescr_type))
24429 #endif
24430     {
24431         PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
24432         #if PY_VERSION_HEX < 0x03020000
24433         PyTypeObject *d_type = descr->d_type;
24434         #else
24435         PyTypeObject *d_type = descr->d_common.d_type;
24436         #endif
24437         return PyDescr_NewClassMethod(d_type, descr->d_method);
24438     }
24439 #endif
24440     else if (PyMethod_Check(method)) {
24441         return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
24442     }
24443     else {
24444         return PyClassMethod_New(method);
24445     }
24446 }
24447 
24448 /* GetNameInClass */
__Pyx_GetGlobalNameAfterAttributeLookup(PyObject * name)24449 static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
24450     PyObject *result;
24451     __Pyx_PyThreadState_declare
24452     __Pyx_PyThreadState_assign
24453     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24454         return NULL;
24455     __Pyx_PyErr_Clear();
24456     __Pyx_GetModuleGlobalNameUncached(result, name);
24457     return result;
24458 }
__Pyx__GetNameInClass(PyObject * nmspace,PyObject * name)24459 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
24460     PyObject *result;
24461     result = __Pyx_PyObject_GetAttrStr(nmspace, name);
24462     if (!result) {
24463         result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
24464     }
24465     return result;
24466 }
24467 
24468 /* CLineInTraceback */
24469 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)24470 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
24471     PyObject *use_cline;
24472     PyObject *ptype, *pvalue, *ptraceback;
24473 #if CYTHON_COMPILING_IN_CPYTHON
24474     PyObject **cython_runtime_dict;
24475 #endif
24476     if (unlikely(!__pyx_cython_runtime)) {
24477         return c_line;
24478     }
24479     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
24480 #if CYTHON_COMPILING_IN_CPYTHON
24481     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
24482     if (likely(cython_runtime_dict)) {
24483         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
24484             use_cline, *cython_runtime_dict,
24485             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
24486     } else
24487 #endif
24488     {
24489       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
24490       if (use_cline_obj) {
24491         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
24492         Py_DECREF(use_cline_obj);
24493       } else {
24494         PyErr_Clear();
24495         use_cline = NULL;
24496       }
24497     }
24498     if (!use_cline) {
24499         c_line = 0;
24500         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
24501     }
24502     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
24503         c_line = 0;
24504     }
24505     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
24506     return c_line;
24507 }
24508 #endif
24509 
24510 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)24511 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
24512     int start = 0, mid = 0, end = count - 1;
24513     if (end >= 0 && code_line > entries[end].code_line) {
24514         return count;
24515     }
24516     while (start < end) {
24517         mid = start + (end - start) / 2;
24518         if (code_line < entries[mid].code_line) {
24519             end = mid;
24520         } else if (code_line > entries[mid].code_line) {
24521              start = mid + 1;
24522         } else {
24523             return mid;
24524         }
24525     }
24526     if (code_line <= entries[mid].code_line) {
24527         return mid;
24528     } else {
24529         return mid + 1;
24530     }
24531 }
__pyx_find_code_object(int code_line)24532 static PyCodeObject *__pyx_find_code_object(int code_line) {
24533     PyCodeObject* code_object;
24534     int pos;
24535     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
24536         return NULL;
24537     }
24538     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24539     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
24540         return NULL;
24541     }
24542     code_object = __pyx_code_cache.entries[pos].code_object;
24543     Py_INCREF(code_object);
24544     return code_object;
24545 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)24546 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
24547     int pos, i;
24548     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
24549     if (unlikely(!code_line)) {
24550         return;
24551     }
24552     if (unlikely(!entries)) {
24553         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
24554         if (likely(entries)) {
24555             __pyx_code_cache.entries = entries;
24556             __pyx_code_cache.max_count = 64;
24557             __pyx_code_cache.count = 1;
24558             entries[0].code_line = code_line;
24559             entries[0].code_object = code_object;
24560             Py_INCREF(code_object);
24561         }
24562         return;
24563     }
24564     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24565     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
24566         PyCodeObject* tmp = entries[pos].code_object;
24567         entries[pos].code_object = code_object;
24568         Py_DECREF(tmp);
24569         return;
24570     }
24571     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
24572         int new_max = __pyx_code_cache.max_count + 64;
24573         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
24574             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
24575         if (unlikely(!entries)) {
24576             return;
24577         }
24578         __pyx_code_cache.entries = entries;
24579         __pyx_code_cache.max_count = new_max;
24580     }
24581     for (i=__pyx_code_cache.count; i>pos; i--) {
24582         entries[i] = entries[i-1];
24583     }
24584     entries[pos].code_line = code_line;
24585     entries[pos].code_object = code_object;
24586     __pyx_code_cache.count++;
24587     Py_INCREF(code_object);
24588 }
24589 
24590 /* AddTraceback */
24591 #include "compile.h"
24592 #include "frameobject.h"
24593 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)24594 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
24595             const char *funcname, int c_line,
24596             int py_line, const char *filename) {
24597     PyCodeObject *py_code = 0;
24598     PyObject *py_srcfile = 0;
24599     PyObject *py_funcname = 0;
24600     #if PY_MAJOR_VERSION < 3
24601     py_srcfile = PyString_FromString(filename);
24602     #else
24603     py_srcfile = PyUnicode_FromString(filename);
24604     #endif
24605     if (!py_srcfile) goto bad;
24606     if (c_line) {
24607         #if PY_MAJOR_VERSION < 3
24608         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24609         #else
24610         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24611         #endif
24612     }
24613     else {
24614         #if PY_MAJOR_VERSION < 3
24615         py_funcname = PyString_FromString(funcname);
24616         #else
24617         py_funcname = PyUnicode_FromString(funcname);
24618         #endif
24619     }
24620     if (!py_funcname) goto bad;
24621     py_code = __Pyx_PyCode_New(
24622         0,
24623         0,
24624         0,
24625         0,
24626         0,
24627         __pyx_empty_bytes, /*PyObject *code,*/
24628         __pyx_empty_tuple, /*PyObject *consts,*/
24629         __pyx_empty_tuple, /*PyObject *names,*/
24630         __pyx_empty_tuple, /*PyObject *varnames,*/
24631         __pyx_empty_tuple, /*PyObject *freevars,*/
24632         __pyx_empty_tuple, /*PyObject *cellvars,*/
24633         py_srcfile,   /*PyObject *filename,*/
24634         py_funcname,  /*PyObject *name,*/
24635         py_line,
24636         __pyx_empty_bytes  /*PyObject *lnotab*/
24637     );
24638     Py_DECREF(py_srcfile);
24639     Py_DECREF(py_funcname);
24640     return py_code;
24641 bad:
24642     Py_XDECREF(py_srcfile);
24643     Py_XDECREF(py_funcname);
24644     return NULL;
24645 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)24646 static void __Pyx_AddTraceback(const char *funcname, int c_line,
24647                                int py_line, const char *filename) {
24648     PyCodeObject *py_code = 0;
24649     PyFrameObject *py_frame = 0;
24650     PyThreadState *tstate = __Pyx_PyThreadState_Current;
24651     if (c_line) {
24652         c_line = __Pyx_CLineForTraceback(tstate, c_line);
24653     }
24654     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
24655     if (!py_code) {
24656         py_code = __Pyx_CreateCodeObjectForTraceback(
24657             funcname, c_line, py_line, filename);
24658         if (!py_code) goto bad;
24659         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
24660     }
24661     py_frame = PyFrame_New(
24662         tstate,            /*PyThreadState *tstate,*/
24663         py_code,           /*PyCodeObject *code,*/
24664         __pyx_d,    /*PyObject *globals,*/
24665         0                  /*PyObject *locals*/
24666     );
24667     if (!py_frame) goto bad;
24668     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
24669     PyTraceBack_Here(py_frame);
24670 bad:
24671     Py_XDECREF(py_code);
24672     Py_XDECREF(py_frame);
24673 }
24674 
24675 /* CIntFromPyVerify */
24676 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
24677     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
24678 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
24679     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
24680 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
24681     {\
24682         func_type value = func_value;\
24683         if (sizeof(target_type) < sizeof(func_type)) {\
24684             if (unlikely(value != (func_type) (target_type) value)) {\
24685                 func_type zero = 0;\
24686                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
24687                     return (target_type) -1;\
24688                 if (is_unsigned && unlikely(value < zero))\
24689                     goto raise_neg_overflow;\
24690                 else\
24691                     goto raise_overflow;\
24692             }\
24693         }\
24694         return (target_type) value;\
24695     }
24696 
24697 /* CIntToPy */
__Pyx_PyInt_From_int(int value)24698 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
24699 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24700 #pragma GCC diagnostic push
24701 #pragma GCC diagnostic ignored "-Wconversion"
24702 #endif
24703     const int neg_one = (int) -1, const_zero = (int) 0;
24704 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24705 #pragma GCC diagnostic pop
24706 #endif
24707     const int is_unsigned = neg_one > const_zero;
24708     if (is_unsigned) {
24709         if (sizeof(int) < sizeof(long)) {
24710             return PyInt_FromLong((long) value);
24711         } else if (sizeof(int) <= sizeof(unsigned long)) {
24712             return PyLong_FromUnsignedLong((unsigned long) value);
24713 #ifdef HAVE_LONG_LONG
24714         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24715             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24716 #endif
24717         }
24718     } else {
24719         if (sizeof(int) <= sizeof(long)) {
24720             return PyInt_FromLong((long) value);
24721 #ifdef HAVE_LONG_LONG
24722         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24723             return PyLong_FromLongLong((PY_LONG_LONG) value);
24724 #endif
24725         }
24726     }
24727     {
24728         int one = 1; int little = (int)*(unsigned char *)&one;
24729         unsigned char *bytes = (unsigned char *)&value;
24730         return _PyLong_FromByteArray(bytes, sizeof(int),
24731                                      little, !is_unsigned);
24732     }
24733 }
24734 
24735 /* CIntToPy */
__Pyx_PyInt_From_Uint32(Uint32 value)24736 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint32(Uint32 value) {
24737 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24738 #pragma GCC diagnostic push
24739 #pragma GCC diagnostic ignored "-Wconversion"
24740 #endif
24741     const Uint32 neg_one = (Uint32) -1, const_zero = (Uint32) 0;
24742 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24743 #pragma GCC diagnostic pop
24744 #endif
24745     const int is_unsigned = neg_one > const_zero;
24746     if (is_unsigned) {
24747         if (sizeof(Uint32) < sizeof(long)) {
24748             return PyInt_FromLong((long) value);
24749         } else if (sizeof(Uint32) <= sizeof(unsigned long)) {
24750             return PyLong_FromUnsignedLong((unsigned long) value);
24751 #ifdef HAVE_LONG_LONG
24752         } else if (sizeof(Uint32) <= sizeof(unsigned PY_LONG_LONG)) {
24753             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24754 #endif
24755         }
24756     } else {
24757         if (sizeof(Uint32) <= sizeof(long)) {
24758             return PyInt_FromLong((long) value);
24759 #ifdef HAVE_LONG_LONG
24760         } else if (sizeof(Uint32) <= sizeof(PY_LONG_LONG)) {
24761             return PyLong_FromLongLong((PY_LONG_LONG) value);
24762 #endif
24763         }
24764     }
24765     {
24766         int one = 1; int little = (int)*(unsigned char *)&one;
24767         unsigned char *bytes = (unsigned char *)&value;
24768         return _PyLong_FromByteArray(bytes, sizeof(Uint32),
24769                                      little, !is_unsigned);
24770     }
24771 }
24772 
24773 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)24774 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
24775 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24776 #pragma GCC diagnostic push
24777 #pragma GCC diagnostic ignored "-Wconversion"
24778 #endif
24779     const int neg_one = (int) -1, const_zero = (int) 0;
24780 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24781 #pragma GCC diagnostic pop
24782 #endif
24783     const int is_unsigned = neg_one > const_zero;
24784 #if PY_MAJOR_VERSION < 3
24785     if (likely(PyInt_Check(x))) {
24786         if (sizeof(int) < sizeof(long)) {
24787             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
24788         } else {
24789             long val = PyInt_AS_LONG(x);
24790             if (is_unsigned && unlikely(val < 0)) {
24791                 goto raise_neg_overflow;
24792             }
24793             return (int) val;
24794         }
24795     } else
24796 #endif
24797     if (likely(PyLong_Check(x))) {
24798         if (is_unsigned) {
24799 #if CYTHON_USE_PYLONG_INTERNALS
24800             const digit* digits = ((PyLongObject*)x)->ob_digit;
24801             switch (Py_SIZE(x)) {
24802                 case  0: return (int) 0;
24803                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
24804                 case 2:
24805                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
24806                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24807                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24808                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
24809                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24810                         }
24811                     }
24812                     break;
24813                 case 3:
24814                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
24815                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24816                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24817                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
24818                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24819                         }
24820                     }
24821                     break;
24822                 case 4:
24823                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
24824                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24825                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24826                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
24827                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
24828                         }
24829                     }
24830                     break;
24831             }
24832 #endif
24833 #if CYTHON_COMPILING_IN_CPYTHON
24834             if (unlikely(Py_SIZE(x) < 0)) {
24835                 goto raise_neg_overflow;
24836             }
24837 #else
24838             {
24839                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24840                 if (unlikely(result < 0))
24841                     return (int) -1;
24842                 if (unlikely(result == 1))
24843                     goto raise_neg_overflow;
24844             }
24845 #endif
24846             if (sizeof(int) <= sizeof(unsigned long)) {
24847                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
24848 #ifdef HAVE_LONG_LONG
24849             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24850                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
24851 #endif
24852             }
24853         } else {
24854 #if CYTHON_USE_PYLONG_INTERNALS
24855             const digit* digits = ((PyLongObject*)x)->ob_digit;
24856             switch (Py_SIZE(x)) {
24857                 case  0: return (int) 0;
24858                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
24859                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
24860                 case -2:
24861                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
24862                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24863                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24864                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24865                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24866                         }
24867                     }
24868                     break;
24869                 case 2:
24870                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
24871                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
24872                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24873                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24874                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24875                         }
24876                     }
24877                     break;
24878                 case -3:
24879                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
24880                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24881                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24882                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24883                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24884                         }
24885                     }
24886                     break;
24887                 case 3:
24888                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
24889                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
24890                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24891                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24892                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24893                         }
24894                     }
24895                     break;
24896                 case -4:
24897                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
24898                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24899                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24900                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
24901                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24902                         }
24903                     }
24904                     break;
24905                 case 4:
24906                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
24907                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
24908                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
24909                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
24910                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
24911                         }
24912                     }
24913                     break;
24914             }
24915 #endif
24916             if (sizeof(int) <= sizeof(long)) {
24917                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
24918 #ifdef HAVE_LONG_LONG
24919             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24920                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
24921 #endif
24922             }
24923         }
24924         {
24925 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
24926             PyErr_SetString(PyExc_RuntimeError,
24927                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
24928 #else
24929             int val;
24930             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
24931  #if PY_MAJOR_VERSION < 3
24932             if (likely(v) && !PyLong_Check(v)) {
24933                 PyObject *tmp = v;
24934                 v = PyNumber_Long(tmp);
24935                 Py_DECREF(tmp);
24936             }
24937  #endif
24938             if (likely(v)) {
24939                 int one = 1; int is_little = (int)*(unsigned char *)&one;
24940                 unsigned char *bytes = (unsigned char *)&val;
24941                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
24942                                               bytes, sizeof(val),
24943                                               is_little, !is_unsigned);
24944                 Py_DECREF(v);
24945                 if (likely(!ret))
24946                     return val;
24947             }
24948 #endif
24949             return (int) -1;
24950         }
24951     } else {
24952         int val;
24953         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24954         if (!tmp) return (int) -1;
24955         val = __Pyx_PyInt_As_int(tmp);
24956         Py_DECREF(tmp);
24957         return val;
24958     }
24959 raise_overflow:
24960     PyErr_SetString(PyExc_OverflowError,
24961         "value too large to convert to int");
24962     return (int) -1;
24963 raise_neg_overflow:
24964     PyErr_SetString(PyExc_OverflowError,
24965         "can't convert negative value to int");
24966     return (int) -1;
24967 }
24968 
24969 /* CIntFromPy */
__Pyx_PyInt_As_Uint8(PyObject * x)24970 static CYTHON_INLINE Uint8 __Pyx_PyInt_As_Uint8(PyObject *x) {
24971 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24972 #pragma GCC diagnostic push
24973 #pragma GCC diagnostic ignored "-Wconversion"
24974 #endif
24975     const Uint8 neg_one = (Uint8) -1, const_zero = (Uint8) 0;
24976 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24977 #pragma GCC diagnostic pop
24978 #endif
24979     const int is_unsigned = neg_one > const_zero;
24980 #if PY_MAJOR_VERSION < 3
24981     if (likely(PyInt_Check(x))) {
24982         if (sizeof(Uint8) < sizeof(long)) {
24983             __PYX_VERIFY_RETURN_INT(Uint8, long, PyInt_AS_LONG(x))
24984         } else {
24985             long val = PyInt_AS_LONG(x);
24986             if (is_unsigned && unlikely(val < 0)) {
24987                 goto raise_neg_overflow;
24988             }
24989             return (Uint8) val;
24990         }
24991     } else
24992 #endif
24993     if (likely(PyLong_Check(x))) {
24994         if (is_unsigned) {
24995 #if CYTHON_USE_PYLONG_INTERNALS
24996             const digit* digits = ((PyLongObject*)x)->ob_digit;
24997             switch (Py_SIZE(x)) {
24998                 case  0: return (Uint8) 0;
24999                 case  1: __PYX_VERIFY_RETURN_INT(Uint8, digit, digits[0])
25000                 case 2:
25001                     if (8 * sizeof(Uint8) > 1 * PyLong_SHIFT) {
25002                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25003                             __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25004                         } else if (8 * sizeof(Uint8) >= 2 * PyLong_SHIFT) {
25005                             return (Uint8) (((((Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0]));
25006                         }
25007                     }
25008                     break;
25009                 case 3:
25010                     if (8 * sizeof(Uint8) > 2 * PyLong_SHIFT) {
25011                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25012                             __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25013                         } else if (8 * sizeof(Uint8) >= 3 * PyLong_SHIFT) {
25014                             return (Uint8) (((((((Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0]));
25015                         }
25016                     }
25017                     break;
25018                 case 4:
25019                     if (8 * sizeof(Uint8) > 3 * PyLong_SHIFT) {
25020                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25021                             __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25022                         } else if (8 * sizeof(Uint8) >= 4 * PyLong_SHIFT) {
25023                             return (Uint8) (((((((((Uint8)digits[3]) << PyLong_SHIFT) | (Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0]));
25024                         }
25025                     }
25026                     break;
25027             }
25028 #endif
25029 #if CYTHON_COMPILING_IN_CPYTHON
25030             if (unlikely(Py_SIZE(x) < 0)) {
25031                 goto raise_neg_overflow;
25032             }
25033 #else
25034             {
25035                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25036                 if (unlikely(result < 0))
25037                     return (Uint8) -1;
25038                 if (unlikely(result == 1))
25039                     goto raise_neg_overflow;
25040             }
25041 #endif
25042             if (sizeof(Uint8) <= sizeof(unsigned long)) {
25043                 __PYX_VERIFY_RETURN_INT_EXC(Uint8, unsigned long, PyLong_AsUnsignedLong(x))
25044 #ifdef HAVE_LONG_LONG
25045             } else if (sizeof(Uint8) <= sizeof(unsigned PY_LONG_LONG)) {
25046                 __PYX_VERIFY_RETURN_INT_EXC(Uint8, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25047 #endif
25048             }
25049         } else {
25050 #if CYTHON_USE_PYLONG_INTERNALS
25051             const digit* digits = ((PyLongObject*)x)->ob_digit;
25052             switch (Py_SIZE(x)) {
25053                 case  0: return (Uint8) 0;
25054                 case -1: __PYX_VERIFY_RETURN_INT(Uint8, sdigit, (sdigit) (-(sdigit)digits[0]))
25055                 case  1: __PYX_VERIFY_RETURN_INT(Uint8,  digit, +digits[0])
25056                 case -2:
25057                     if (8 * sizeof(Uint8) - 1 > 1 * PyLong_SHIFT) {
25058                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25059                             __PYX_VERIFY_RETURN_INT(Uint8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25060                         } else if (8 * sizeof(Uint8) - 1 > 2 * PyLong_SHIFT) {
25061                             return (Uint8) (((Uint8)-1)*(((((Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
25062                         }
25063                     }
25064                     break;
25065                 case 2:
25066                     if (8 * sizeof(Uint8) > 1 * PyLong_SHIFT) {
25067                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25068                             __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25069                         } else if (8 * sizeof(Uint8) - 1 > 2 * PyLong_SHIFT) {
25070                             return (Uint8) ((((((Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
25071                         }
25072                     }
25073                     break;
25074                 case -3:
25075                     if (8 * sizeof(Uint8) - 1 > 2 * PyLong_SHIFT) {
25076                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25077                             __PYX_VERIFY_RETURN_INT(Uint8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25078                         } else if (8 * sizeof(Uint8) - 1 > 3 * PyLong_SHIFT) {
25079                             return (Uint8) (((Uint8)-1)*(((((((Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
25080                         }
25081                     }
25082                     break;
25083                 case 3:
25084                     if (8 * sizeof(Uint8) > 2 * PyLong_SHIFT) {
25085                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25086                             __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25087                         } else if (8 * sizeof(Uint8) - 1 > 3 * PyLong_SHIFT) {
25088                             return (Uint8) ((((((((Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
25089                         }
25090                     }
25091                     break;
25092                 case -4:
25093                     if (8 * sizeof(Uint8) - 1 > 3 * PyLong_SHIFT) {
25094                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25095                             __PYX_VERIFY_RETURN_INT(Uint8, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25096                         } else if (8 * sizeof(Uint8) - 1 > 4 * PyLong_SHIFT) {
25097                             return (Uint8) (((Uint8)-1)*(((((((((Uint8)digits[3]) << PyLong_SHIFT) | (Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
25098                         }
25099                     }
25100                     break;
25101                 case 4:
25102                     if (8 * sizeof(Uint8) > 3 * PyLong_SHIFT) {
25103                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25104                             __PYX_VERIFY_RETURN_INT(Uint8, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25105                         } else if (8 * sizeof(Uint8) - 1 > 4 * PyLong_SHIFT) {
25106                             return (Uint8) ((((((((((Uint8)digits[3]) << PyLong_SHIFT) | (Uint8)digits[2]) << PyLong_SHIFT) | (Uint8)digits[1]) << PyLong_SHIFT) | (Uint8)digits[0])));
25107                         }
25108                     }
25109                     break;
25110             }
25111 #endif
25112             if (sizeof(Uint8) <= sizeof(long)) {
25113                 __PYX_VERIFY_RETURN_INT_EXC(Uint8, long, PyLong_AsLong(x))
25114 #ifdef HAVE_LONG_LONG
25115             } else if (sizeof(Uint8) <= sizeof(PY_LONG_LONG)) {
25116                 __PYX_VERIFY_RETURN_INT_EXC(Uint8, PY_LONG_LONG, PyLong_AsLongLong(x))
25117 #endif
25118             }
25119         }
25120         {
25121 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25122             PyErr_SetString(PyExc_RuntimeError,
25123                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25124 #else
25125             Uint8 val;
25126             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25127  #if PY_MAJOR_VERSION < 3
25128             if (likely(v) && !PyLong_Check(v)) {
25129                 PyObject *tmp = v;
25130                 v = PyNumber_Long(tmp);
25131                 Py_DECREF(tmp);
25132             }
25133  #endif
25134             if (likely(v)) {
25135                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25136                 unsigned char *bytes = (unsigned char *)&val;
25137                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25138                                               bytes, sizeof(val),
25139                                               is_little, !is_unsigned);
25140                 Py_DECREF(v);
25141                 if (likely(!ret))
25142                     return val;
25143             }
25144 #endif
25145             return (Uint8) -1;
25146         }
25147     } else {
25148         Uint8 val;
25149         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25150         if (!tmp) return (Uint8) -1;
25151         val = __Pyx_PyInt_As_Uint8(tmp);
25152         Py_DECREF(tmp);
25153         return val;
25154     }
25155 raise_overflow:
25156     PyErr_SetString(PyExc_OverflowError,
25157         "value too large to convert to Uint8");
25158     return (Uint8) -1;
25159 raise_neg_overflow:
25160     PyErr_SetString(PyExc_OverflowError,
25161         "can't convert negative value to Uint8");
25162     return (Uint8) -1;
25163 }
25164 
25165 /* CIntToPy */
__Pyx_PyInt_From_long(long value)25166 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
25167 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25168 #pragma GCC diagnostic push
25169 #pragma GCC diagnostic ignored "-Wconversion"
25170 #endif
25171     const long neg_one = (long) -1, const_zero = (long) 0;
25172 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25173 #pragma GCC diagnostic pop
25174 #endif
25175     const int is_unsigned = neg_one > const_zero;
25176     if (is_unsigned) {
25177         if (sizeof(long) < sizeof(long)) {
25178             return PyInt_FromLong((long) value);
25179         } else if (sizeof(long) <= sizeof(unsigned long)) {
25180             return PyLong_FromUnsignedLong((unsigned long) value);
25181 #ifdef HAVE_LONG_LONG
25182         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25183             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25184 #endif
25185         }
25186     } else {
25187         if (sizeof(long) <= sizeof(long)) {
25188             return PyInt_FromLong((long) value);
25189 #ifdef HAVE_LONG_LONG
25190         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25191             return PyLong_FromLongLong((PY_LONG_LONG) value);
25192 #endif
25193         }
25194     }
25195     {
25196         int one = 1; int little = (int)*(unsigned char *)&one;
25197         unsigned char *bytes = (unsigned char *)&value;
25198         return _PyLong_FromByteArray(bytes, sizeof(long),
25199                                      little, !is_unsigned);
25200     }
25201 }
25202 
25203 /* CIntFromPy */
__Pyx_PyInt_As_Uint32(PyObject * x)25204 static CYTHON_INLINE Uint32 __Pyx_PyInt_As_Uint32(PyObject *x) {
25205 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25206 #pragma GCC diagnostic push
25207 #pragma GCC diagnostic ignored "-Wconversion"
25208 #endif
25209     const Uint32 neg_one = (Uint32) -1, const_zero = (Uint32) 0;
25210 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25211 #pragma GCC diagnostic pop
25212 #endif
25213     const int is_unsigned = neg_one > const_zero;
25214 #if PY_MAJOR_VERSION < 3
25215     if (likely(PyInt_Check(x))) {
25216         if (sizeof(Uint32) < sizeof(long)) {
25217             __PYX_VERIFY_RETURN_INT(Uint32, long, PyInt_AS_LONG(x))
25218         } else {
25219             long val = PyInt_AS_LONG(x);
25220             if (is_unsigned && unlikely(val < 0)) {
25221                 goto raise_neg_overflow;
25222             }
25223             return (Uint32) val;
25224         }
25225     } else
25226 #endif
25227     if (likely(PyLong_Check(x))) {
25228         if (is_unsigned) {
25229 #if CYTHON_USE_PYLONG_INTERNALS
25230             const digit* digits = ((PyLongObject*)x)->ob_digit;
25231             switch (Py_SIZE(x)) {
25232                 case  0: return (Uint32) 0;
25233                 case  1: __PYX_VERIFY_RETURN_INT(Uint32, digit, digits[0])
25234                 case 2:
25235                     if (8 * sizeof(Uint32) > 1 * PyLong_SHIFT) {
25236                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25237                             __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25238                         } else if (8 * sizeof(Uint32) >= 2 * PyLong_SHIFT) {
25239                             return (Uint32) (((((Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0]));
25240                         }
25241                     }
25242                     break;
25243                 case 3:
25244                     if (8 * sizeof(Uint32) > 2 * PyLong_SHIFT) {
25245                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25246                             __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25247                         } else if (8 * sizeof(Uint32) >= 3 * PyLong_SHIFT) {
25248                             return (Uint32) (((((((Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0]));
25249                         }
25250                     }
25251                     break;
25252                 case 4:
25253                     if (8 * sizeof(Uint32) > 3 * PyLong_SHIFT) {
25254                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25255                             __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25256                         } else if (8 * sizeof(Uint32) >= 4 * PyLong_SHIFT) {
25257                             return (Uint32) (((((((((Uint32)digits[3]) << PyLong_SHIFT) | (Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0]));
25258                         }
25259                     }
25260                     break;
25261             }
25262 #endif
25263 #if CYTHON_COMPILING_IN_CPYTHON
25264             if (unlikely(Py_SIZE(x) < 0)) {
25265                 goto raise_neg_overflow;
25266             }
25267 #else
25268             {
25269                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25270                 if (unlikely(result < 0))
25271                     return (Uint32) -1;
25272                 if (unlikely(result == 1))
25273                     goto raise_neg_overflow;
25274             }
25275 #endif
25276             if (sizeof(Uint32) <= sizeof(unsigned long)) {
25277                 __PYX_VERIFY_RETURN_INT_EXC(Uint32, unsigned long, PyLong_AsUnsignedLong(x))
25278 #ifdef HAVE_LONG_LONG
25279             } else if (sizeof(Uint32) <= sizeof(unsigned PY_LONG_LONG)) {
25280                 __PYX_VERIFY_RETURN_INT_EXC(Uint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25281 #endif
25282             }
25283         } else {
25284 #if CYTHON_USE_PYLONG_INTERNALS
25285             const digit* digits = ((PyLongObject*)x)->ob_digit;
25286             switch (Py_SIZE(x)) {
25287                 case  0: return (Uint32) 0;
25288                 case -1: __PYX_VERIFY_RETURN_INT(Uint32, sdigit, (sdigit) (-(sdigit)digits[0]))
25289                 case  1: __PYX_VERIFY_RETURN_INT(Uint32,  digit, +digits[0])
25290                 case -2:
25291                     if (8 * sizeof(Uint32) - 1 > 1 * PyLong_SHIFT) {
25292                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25293                             __PYX_VERIFY_RETURN_INT(Uint32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25294                         } else if (8 * sizeof(Uint32) - 1 > 2 * PyLong_SHIFT) {
25295                             return (Uint32) (((Uint32)-1)*(((((Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
25296                         }
25297                     }
25298                     break;
25299                 case 2:
25300                     if (8 * sizeof(Uint32) > 1 * PyLong_SHIFT) {
25301                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25302                             __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25303                         } else if (8 * sizeof(Uint32) - 1 > 2 * PyLong_SHIFT) {
25304                             return (Uint32) ((((((Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
25305                         }
25306                     }
25307                     break;
25308                 case -3:
25309                     if (8 * sizeof(Uint32) - 1 > 2 * PyLong_SHIFT) {
25310                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25311                             __PYX_VERIFY_RETURN_INT(Uint32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25312                         } else if (8 * sizeof(Uint32) - 1 > 3 * PyLong_SHIFT) {
25313                             return (Uint32) (((Uint32)-1)*(((((((Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
25314                         }
25315                     }
25316                     break;
25317                 case 3:
25318                     if (8 * sizeof(Uint32) > 2 * PyLong_SHIFT) {
25319                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25320                             __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25321                         } else if (8 * sizeof(Uint32) - 1 > 3 * PyLong_SHIFT) {
25322                             return (Uint32) ((((((((Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
25323                         }
25324                     }
25325                     break;
25326                 case -4:
25327                     if (8 * sizeof(Uint32) - 1 > 3 * PyLong_SHIFT) {
25328                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25329                             __PYX_VERIFY_RETURN_INT(Uint32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25330                         } else if (8 * sizeof(Uint32) - 1 > 4 * PyLong_SHIFT) {
25331                             return (Uint32) (((Uint32)-1)*(((((((((Uint32)digits[3]) << PyLong_SHIFT) | (Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
25332                         }
25333                     }
25334                     break;
25335                 case 4:
25336                     if (8 * sizeof(Uint32) > 3 * PyLong_SHIFT) {
25337                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25338                             __PYX_VERIFY_RETURN_INT(Uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25339                         } else if (8 * sizeof(Uint32) - 1 > 4 * PyLong_SHIFT) {
25340                             return (Uint32) ((((((((((Uint32)digits[3]) << PyLong_SHIFT) | (Uint32)digits[2]) << PyLong_SHIFT) | (Uint32)digits[1]) << PyLong_SHIFT) | (Uint32)digits[0])));
25341                         }
25342                     }
25343                     break;
25344             }
25345 #endif
25346             if (sizeof(Uint32) <= sizeof(long)) {
25347                 __PYX_VERIFY_RETURN_INT_EXC(Uint32, long, PyLong_AsLong(x))
25348 #ifdef HAVE_LONG_LONG
25349             } else if (sizeof(Uint32) <= sizeof(PY_LONG_LONG)) {
25350                 __PYX_VERIFY_RETURN_INT_EXC(Uint32, PY_LONG_LONG, PyLong_AsLongLong(x))
25351 #endif
25352             }
25353         }
25354         {
25355 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25356             PyErr_SetString(PyExc_RuntimeError,
25357                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25358 #else
25359             Uint32 val;
25360             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25361  #if PY_MAJOR_VERSION < 3
25362             if (likely(v) && !PyLong_Check(v)) {
25363                 PyObject *tmp = v;
25364                 v = PyNumber_Long(tmp);
25365                 Py_DECREF(tmp);
25366             }
25367  #endif
25368             if (likely(v)) {
25369                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25370                 unsigned char *bytes = (unsigned char *)&val;
25371                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25372                                               bytes, sizeof(val),
25373                                               is_little, !is_unsigned);
25374                 Py_DECREF(v);
25375                 if (likely(!ret))
25376                     return val;
25377             }
25378 #endif
25379             return (Uint32) -1;
25380         }
25381     } else {
25382         Uint32 val;
25383         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25384         if (!tmp) return (Uint32) -1;
25385         val = __Pyx_PyInt_As_Uint32(tmp);
25386         Py_DECREF(tmp);
25387         return val;
25388     }
25389 raise_overflow:
25390     PyErr_SetString(PyExc_OverflowError,
25391         "value too large to convert to Uint32");
25392     return (Uint32) -1;
25393 raise_neg_overflow:
25394     PyErr_SetString(PyExc_OverflowError,
25395         "can't convert negative value to Uint32");
25396     return (Uint32) -1;
25397 }
25398 
25399 /* CIntToPy */
__Pyx_PyInt_From_SDL_bool(SDL_bool value)25400 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SDL_bool(SDL_bool value) {
25401 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25402 #pragma GCC diagnostic push
25403 #pragma GCC diagnostic ignored "-Wconversion"
25404 #endif
25405     const SDL_bool neg_one = (SDL_bool) -1, const_zero = (SDL_bool) 0;
25406 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25407 #pragma GCC diagnostic pop
25408 #endif
25409     const int is_unsigned = neg_one > const_zero;
25410     if (is_unsigned) {
25411         if (sizeof(SDL_bool) < sizeof(long)) {
25412             return PyInt_FromLong((long) value);
25413         } else if (sizeof(SDL_bool) <= sizeof(unsigned long)) {
25414             return PyLong_FromUnsignedLong((unsigned long) value);
25415 #ifdef HAVE_LONG_LONG
25416         } else if (sizeof(SDL_bool) <= sizeof(unsigned PY_LONG_LONG)) {
25417             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25418 #endif
25419         }
25420     } else {
25421         if (sizeof(SDL_bool) <= sizeof(long)) {
25422             return PyInt_FromLong((long) value);
25423 #ifdef HAVE_LONG_LONG
25424         } else if (sizeof(SDL_bool) <= sizeof(PY_LONG_LONG)) {
25425             return PyLong_FromLongLong((PY_LONG_LONG) value);
25426 #endif
25427         }
25428     }
25429     {
25430         int one = 1; int little = (int)*(unsigned char *)&one;
25431         unsigned char *bytes = (unsigned char *)&value;
25432         return _PyLong_FromByteArray(bytes, sizeof(SDL_bool),
25433                                      little, !is_unsigned);
25434     }
25435 }
25436 
25437 /* CIntToPy */
__Pyx_PyInt_From_Uint8(Uint8 value)25438 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Uint8(Uint8 value) {
25439 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25440 #pragma GCC diagnostic push
25441 #pragma GCC diagnostic ignored "-Wconversion"
25442 #endif
25443     const Uint8 neg_one = (Uint8) -1, const_zero = (Uint8) 0;
25444 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25445 #pragma GCC diagnostic pop
25446 #endif
25447     const int is_unsigned = neg_one > const_zero;
25448     if (is_unsigned) {
25449         if (sizeof(Uint8) < sizeof(long)) {
25450             return PyInt_FromLong((long) value);
25451         } else if (sizeof(Uint8) <= sizeof(unsigned long)) {
25452             return PyLong_FromUnsignedLong((unsigned long) value);
25453 #ifdef HAVE_LONG_LONG
25454         } else if (sizeof(Uint8) <= sizeof(unsigned PY_LONG_LONG)) {
25455             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25456 #endif
25457         }
25458     } else {
25459         if (sizeof(Uint8) <= sizeof(long)) {
25460             return PyInt_FromLong((long) value);
25461 #ifdef HAVE_LONG_LONG
25462         } else if (sizeof(Uint8) <= sizeof(PY_LONG_LONG)) {
25463             return PyLong_FromLongLong((PY_LONG_LONG) value);
25464 #endif
25465         }
25466     }
25467     {
25468         int one = 1; int little = (int)*(unsigned char *)&one;
25469         unsigned char *bytes = (unsigned char *)&value;
25470         return _PyLong_FromByteArray(bytes, sizeof(Uint8),
25471                                      little, !is_unsigned);
25472     }
25473 }
25474 
25475 /* CIntToPy */
__Pyx_PyInt_From_SDL_BlendMode(SDL_BlendMode value)25476 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SDL_BlendMode(SDL_BlendMode value) {
25477 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25478 #pragma GCC diagnostic push
25479 #pragma GCC diagnostic ignored "-Wconversion"
25480 #endif
25481     const SDL_BlendMode neg_one = (SDL_BlendMode) -1, const_zero = (SDL_BlendMode) 0;
25482 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25483 #pragma GCC diagnostic pop
25484 #endif
25485     const int is_unsigned = neg_one > const_zero;
25486     if (is_unsigned) {
25487         if (sizeof(SDL_BlendMode) < sizeof(long)) {
25488             return PyInt_FromLong((long) value);
25489         } else if (sizeof(SDL_BlendMode) <= sizeof(unsigned long)) {
25490             return PyLong_FromUnsignedLong((unsigned long) value);
25491 #ifdef HAVE_LONG_LONG
25492         } else if (sizeof(SDL_BlendMode) <= sizeof(unsigned PY_LONG_LONG)) {
25493             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25494 #endif
25495         }
25496     } else {
25497         if (sizeof(SDL_BlendMode) <= sizeof(long)) {
25498             return PyInt_FromLong((long) value);
25499 #ifdef HAVE_LONG_LONG
25500         } else if (sizeof(SDL_BlendMode) <= sizeof(PY_LONG_LONG)) {
25501             return PyLong_FromLongLong((PY_LONG_LONG) value);
25502 #endif
25503         }
25504     }
25505     {
25506         int one = 1; int little = (int)*(unsigned char *)&one;
25507         unsigned char *bytes = (unsigned char *)&value;
25508         return _PyLong_FromByteArray(bytes, sizeof(SDL_BlendMode),
25509                                      little, !is_unsigned);
25510     }
25511 }
25512 
25513 /* CIntFromPy */
__Pyx_PyInt_As_SDL_BlendMode(PyObject * x)25514 static CYTHON_INLINE SDL_BlendMode __Pyx_PyInt_As_SDL_BlendMode(PyObject *x) {
25515 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25516 #pragma GCC diagnostic push
25517 #pragma GCC diagnostic ignored "-Wconversion"
25518 #endif
25519     const SDL_BlendMode neg_one = (SDL_BlendMode) -1, const_zero = (SDL_BlendMode) 0;
25520 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25521 #pragma GCC diagnostic pop
25522 #endif
25523     const int is_unsigned = neg_one > const_zero;
25524 #if PY_MAJOR_VERSION < 3
25525     if (likely(PyInt_Check(x))) {
25526         if (sizeof(SDL_BlendMode) < sizeof(long)) {
25527             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, long, PyInt_AS_LONG(x))
25528         } else {
25529             long val = PyInt_AS_LONG(x);
25530             if (is_unsigned && unlikely(val < 0)) {
25531                 goto raise_neg_overflow;
25532             }
25533             return (SDL_BlendMode) val;
25534         }
25535     } else
25536 #endif
25537     if (likely(PyLong_Check(x))) {
25538         if (is_unsigned) {
25539 #if CYTHON_USE_PYLONG_INTERNALS
25540             const digit* digits = ((PyLongObject*)x)->ob_digit;
25541             switch (Py_SIZE(x)) {
25542                 case  0: return (SDL_BlendMode) 0;
25543                 case  1: __PYX_VERIFY_RETURN_INT(SDL_BlendMode, digit, digits[0])
25544                 case 2:
25545                     if (8 * sizeof(SDL_BlendMode) > 1 * PyLong_SHIFT) {
25546                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25547                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25548                         } else if (8 * sizeof(SDL_BlendMode) >= 2 * PyLong_SHIFT) {
25549                             return (SDL_BlendMode) (((((SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0]));
25550                         }
25551                     }
25552                     break;
25553                 case 3:
25554                     if (8 * sizeof(SDL_BlendMode) > 2 * PyLong_SHIFT) {
25555                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25556                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25557                         } else if (8 * sizeof(SDL_BlendMode) >= 3 * PyLong_SHIFT) {
25558                             return (SDL_BlendMode) (((((((SDL_BlendMode)digits[2]) << PyLong_SHIFT) | (SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0]));
25559                         }
25560                     }
25561                     break;
25562                 case 4:
25563                     if (8 * sizeof(SDL_BlendMode) > 3 * PyLong_SHIFT) {
25564                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25565                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25566                         } else if (8 * sizeof(SDL_BlendMode) >= 4 * PyLong_SHIFT) {
25567                             return (SDL_BlendMode) (((((((((SDL_BlendMode)digits[3]) << PyLong_SHIFT) | (SDL_BlendMode)digits[2]) << PyLong_SHIFT) | (SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0]));
25568                         }
25569                     }
25570                     break;
25571             }
25572 #endif
25573 #if CYTHON_COMPILING_IN_CPYTHON
25574             if (unlikely(Py_SIZE(x) < 0)) {
25575                 goto raise_neg_overflow;
25576             }
25577 #else
25578             {
25579                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25580                 if (unlikely(result < 0))
25581                     return (SDL_BlendMode) -1;
25582                 if (unlikely(result == 1))
25583                     goto raise_neg_overflow;
25584             }
25585 #endif
25586             if (sizeof(SDL_BlendMode) <= sizeof(unsigned long)) {
25587                 __PYX_VERIFY_RETURN_INT_EXC(SDL_BlendMode, unsigned long, PyLong_AsUnsignedLong(x))
25588 #ifdef HAVE_LONG_LONG
25589             } else if (sizeof(SDL_BlendMode) <= sizeof(unsigned PY_LONG_LONG)) {
25590                 __PYX_VERIFY_RETURN_INT_EXC(SDL_BlendMode, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25591 #endif
25592             }
25593         } else {
25594 #if CYTHON_USE_PYLONG_INTERNALS
25595             const digit* digits = ((PyLongObject*)x)->ob_digit;
25596             switch (Py_SIZE(x)) {
25597                 case  0: return (SDL_BlendMode) 0;
25598                 case -1: __PYX_VERIFY_RETURN_INT(SDL_BlendMode, sdigit, (sdigit) (-(sdigit)digits[0]))
25599                 case  1: __PYX_VERIFY_RETURN_INT(SDL_BlendMode,  digit, +digits[0])
25600                 case -2:
25601                     if (8 * sizeof(SDL_BlendMode) - 1 > 1 * PyLong_SHIFT) {
25602                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25603                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25604                         } else if (8 * sizeof(SDL_BlendMode) - 1 > 2 * PyLong_SHIFT) {
25605                             return (SDL_BlendMode) (((SDL_BlendMode)-1)*(((((SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0])));
25606                         }
25607                     }
25608                     break;
25609                 case 2:
25610                     if (8 * sizeof(SDL_BlendMode) > 1 * PyLong_SHIFT) {
25611                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25612                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25613                         } else if (8 * sizeof(SDL_BlendMode) - 1 > 2 * PyLong_SHIFT) {
25614                             return (SDL_BlendMode) ((((((SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0])));
25615                         }
25616                     }
25617                     break;
25618                 case -3:
25619                     if (8 * sizeof(SDL_BlendMode) - 1 > 2 * PyLong_SHIFT) {
25620                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25621                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25622                         } else if (8 * sizeof(SDL_BlendMode) - 1 > 3 * PyLong_SHIFT) {
25623                             return (SDL_BlendMode) (((SDL_BlendMode)-1)*(((((((SDL_BlendMode)digits[2]) << PyLong_SHIFT) | (SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0])));
25624                         }
25625                     }
25626                     break;
25627                 case 3:
25628                     if (8 * sizeof(SDL_BlendMode) > 2 * PyLong_SHIFT) {
25629                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25630                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25631                         } else if (8 * sizeof(SDL_BlendMode) - 1 > 3 * PyLong_SHIFT) {
25632                             return (SDL_BlendMode) ((((((((SDL_BlendMode)digits[2]) << PyLong_SHIFT) | (SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0])));
25633                         }
25634                     }
25635                     break;
25636                 case -4:
25637                     if (8 * sizeof(SDL_BlendMode) - 1 > 3 * PyLong_SHIFT) {
25638                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25639                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25640                         } else if (8 * sizeof(SDL_BlendMode) - 1 > 4 * PyLong_SHIFT) {
25641                             return (SDL_BlendMode) (((SDL_BlendMode)-1)*(((((((((SDL_BlendMode)digits[3]) << PyLong_SHIFT) | (SDL_BlendMode)digits[2]) << PyLong_SHIFT) | (SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0])));
25642                         }
25643                     }
25644                     break;
25645                 case 4:
25646                     if (8 * sizeof(SDL_BlendMode) > 3 * PyLong_SHIFT) {
25647                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25648                             __PYX_VERIFY_RETURN_INT(SDL_BlendMode, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25649                         } else if (8 * sizeof(SDL_BlendMode) - 1 > 4 * PyLong_SHIFT) {
25650                             return (SDL_BlendMode) ((((((((((SDL_BlendMode)digits[3]) << PyLong_SHIFT) | (SDL_BlendMode)digits[2]) << PyLong_SHIFT) | (SDL_BlendMode)digits[1]) << PyLong_SHIFT) | (SDL_BlendMode)digits[0])));
25651                         }
25652                     }
25653                     break;
25654             }
25655 #endif
25656             if (sizeof(SDL_BlendMode) <= sizeof(long)) {
25657                 __PYX_VERIFY_RETURN_INT_EXC(SDL_BlendMode, long, PyLong_AsLong(x))
25658 #ifdef HAVE_LONG_LONG
25659             } else if (sizeof(SDL_BlendMode) <= sizeof(PY_LONG_LONG)) {
25660                 __PYX_VERIFY_RETURN_INT_EXC(SDL_BlendMode, PY_LONG_LONG, PyLong_AsLongLong(x))
25661 #endif
25662             }
25663         }
25664         {
25665 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25666             PyErr_SetString(PyExc_RuntimeError,
25667                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25668 #else
25669             SDL_BlendMode val;
25670             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25671  #if PY_MAJOR_VERSION < 3
25672             if (likely(v) && !PyLong_Check(v)) {
25673                 PyObject *tmp = v;
25674                 v = PyNumber_Long(tmp);
25675                 Py_DECREF(tmp);
25676             }
25677  #endif
25678             if (likely(v)) {
25679                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25680                 unsigned char *bytes = (unsigned char *)&val;
25681                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25682                                               bytes, sizeof(val),
25683                                               is_little, !is_unsigned);
25684                 Py_DECREF(v);
25685                 if (likely(!ret))
25686                     return val;
25687             }
25688 #endif
25689             return (SDL_BlendMode) -1;
25690         }
25691     } else {
25692         SDL_BlendMode val;
25693         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25694         if (!tmp) return (SDL_BlendMode) -1;
25695         val = __Pyx_PyInt_As_SDL_BlendMode(tmp);
25696         Py_DECREF(tmp);
25697         return val;
25698     }
25699 raise_overflow:
25700     PyErr_SetString(PyExc_OverflowError,
25701         "value too large to convert to SDL_BlendMode");
25702     return (SDL_BlendMode) -1;
25703 raise_neg_overflow:
25704     PyErr_SetString(PyExc_OverflowError,
25705         "can't convert negative value to SDL_BlendMode");
25706     return (SDL_BlendMode) -1;
25707 }
25708 
25709 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)25710 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
25711 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25712 #pragma GCC diagnostic push
25713 #pragma GCC diagnostic ignored "-Wconversion"
25714 #endif
25715     const long neg_one = (long) -1, const_zero = (long) 0;
25716 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25717 #pragma GCC diagnostic pop
25718 #endif
25719     const int is_unsigned = neg_one > const_zero;
25720 #if PY_MAJOR_VERSION < 3
25721     if (likely(PyInt_Check(x))) {
25722         if (sizeof(long) < sizeof(long)) {
25723             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
25724         } else {
25725             long val = PyInt_AS_LONG(x);
25726             if (is_unsigned && unlikely(val < 0)) {
25727                 goto raise_neg_overflow;
25728             }
25729             return (long) val;
25730         }
25731     } else
25732 #endif
25733     if (likely(PyLong_Check(x))) {
25734         if (is_unsigned) {
25735 #if CYTHON_USE_PYLONG_INTERNALS
25736             const digit* digits = ((PyLongObject*)x)->ob_digit;
25737             switch (Py_SIZE(x)) {
25738                 case  0: return (long) 0;
25739                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
25740                 case 2:
25741                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25742                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25743                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25744                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
25745                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25746                         }
25747                     }
25748                     break;
25749                 case 3:
25750                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25751                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25752                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25753                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
25754                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25755                         }
25756                     }
25757                     break;
25758                 case 4:
25759                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25760                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25761                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25762                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
25763                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25764                         }
25765                     }
25766                     break;
25767             }
25768 #endif
25769 #if CYTHON_COMPILING_IN_CPYTHON
25770             if (unlikely(Py_SIZE(x) < 0)) {
25771                 goto raise_neg_overflow;
25772             }
25773 #else
25774             {
25775                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25776                 if (unlikely(result < 0))
25777                     return (long) -1;
25778                 if (unlikely(result == 1))
25779                     goto raise_neg_overflow;
25780             }
25781 #endif
25782             if (sizeof(long) <= sizeof(unsigned long)) {
25783                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
25784 #ifdef HAVE_LONG_LONG
25785             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25786                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25787 #endif
25788             }
25789         } else {
25790 #if CYTHON_USE_PYLONG_INTERNALS
25791             const digit* digits = ((PyLongObject*)x)->ob_digit;
25792             switch (Py_SIZE(x)) {
25793                 case  0: return (long) 0;
25794                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
25795                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
25796                 case -2:
25797                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
25798                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25799                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25800                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25801                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25802                         }
25803                     }
25804                     break;
25805                 case 2:
25806                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25807                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25808                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25809                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25810                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25811                         }
25812                     }
25813                     break;
25814                 case -3:
25815                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25816                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25817                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25818                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25819                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25820                         }
25821                     }
25822                     break;
25823                 case 3:
25824                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25825                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25826                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25827                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25828                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25829                         }
25830                     }
25831                     break;
25832                 case -4:
25833                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25834                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25835                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25836                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25837                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25838                         }
25839                     }
25840                     break;
25841                 case 4:
25842                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25843                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25844                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25845                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25846                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25847                         }
25848                     }
25849                     break;
25850             }
25851 #endif
25852             if (sizeof(long) <= sizeof(long)) {
25853                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
25854 #ifdef HAVE_LONG_LONG
25855             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25856                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
25857 #endif
25858             }
25859         }
25860         {
25861 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25862             PyErr_SetString(PyExc_RuntimeError,
25863                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25864 #else
25865             long val;
25866             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25867  #if PY_MAJOR_VERSION < 3
25868             if (likely(v) && !PyLong_Check(v)) {
25869                 PyObject *tmp = v;
25870                 v = PyNumber_Long(tmp);
25871                 Py_DECREF(tmp);
25872             }
25873  #endif
25874             if (likely(v)) {
25875                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25876                 unsigned char *bytes = (unsigned char *)&val;
25877                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25878                                               bytes, sizeof(val),
25879                                               is_little, !is_unsigned);
25880                 Py_DECREF(v);
25881                 if (likely(!ret))
25882                     return val;
25883             }
25884 #endif
25885             return (long) -1;
25886         }
25887     } else {
25888         long val;
25889         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25890         if (!tmp) return (long) -1;
25891         val = __Pyx_PyInt_As_long(tmp);
25892         Py_DECREF(tmp);
25893         return val;
25894     }
25895 raise_overflow:
25896     PyErr_SetString(PyExc_OverflowError,
25897         "value too large to convert to long");
25898     return (long) -1;
25899 raise_neg_overflow:
25900     PyErr_SetString(PyExc_OverflowError,
25901         "can't convert negative value to long");
25902     return (long) -1;
25903 }
25904 
25905 /* FastTypeChecks */
25906 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)25907 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
25908     while (a) {
25909         a = a->tp_base;
25910         if (a == b)
25911             return 1;
25912     }
25913     return b == &PyBaseObject_Type;
25914 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)25915 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
25916     PyObject *mro;
25917     if (a == b) return 1;
25918     mro = a->tp_mro;
25919     if (likely(mro)) {
25920         Py_ssize_t i, n;
25921         n = PyTuple_GET_SIZE(mro);
25922         for (i = 0; i < n; i++) {
25923             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
25924                 return 1;
25925         }
25926         return 0;
25927     }
25928     return __Pyx_InBases(a, b);
25929 }
25930 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)25931 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
25932     PyObject *exception, *value, *tb;
25933     int res;
25934     __Pyx_PyThreadState_declare
25935     __Pyx_PyThreadState_assign
25936     __Pyx_ErrFetch(&exception, &value, &tb);
25937     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
25938     if (unlikely(res == -1)) {
25939         PyErr_WriteUnraisable(err);
25940         res = 0;
25941     }
25942     if (!res) {
25943         res = PyObject_IsSubclass(err, exc_type2);
25944         if (unlikely(res == -1)) {
25945             PyErr_WriteUnraisable(err);
25946             res = 0;
25947         }
25948     }
25949     __Pyx_ErrRestore(exception, value, tb);
25950     return res;
25951 }
25952 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)25953 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
25954     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
25955     if (!res) {
25956         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
25957     }
25958     return res;
25959 }
25960 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)25961 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
25962     Py_ssize_t i, n;
25963     assert(PyExceptionClass_Check(exc_type));
25964     n = PyTuple_GET_SIZE(tuple);
25965 #if PY_MAJOR_VERSION >= 3
25966     for (i=0; i<n; i++) {
25967         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
25968     }
25969 #endif
25970     for (i=0; i<n; i++) {
25971         PyObject *t = PyTuple_GET_ITEM(tuple, i);
25972         #if PY_MAJOR_VERSION < 3
25973         if (likely(exc_type == t)) return 1;
25974         #endif
25975         if (likely(PyExceptionClass_Check(t))) {
25976             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
25977         } else {
25978         }
25979     }
25980     return 0;
25981 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)25982 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
25983     if (likely(err == exc_type)) return 1;
25984     if (likely(PyExceptionClass_Check(err))) {
25985         if (likely(PyExceptionClass_Check(exc_type))) {
25986             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
25987         } else if (likely(PyTuple_Check(exc_type))) {
25988             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
25989         } else {
25990         }
25991     }
25992     return PyErr_GivenExceptionMatches(err, exc_type);
25993 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)25994 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
25995     assert(PyExceptionClass_Check(exc_type1));
25996     assert(PyExceptionClass_Check(exc_type2));
25997     if (likely(err == exc_type1 || err == exc_type2)) return 1;
25998     if (likely(PyExceptionClass_Check(err))) {
25999         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
26000     }
26001     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
26002 }
26003 #endif
26004 
26005 /* SwapException */
26006 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)26007 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26008     PyObject *tmp_type, *tmp_value, *tmp_tb;
26009     #if CYTHON_USE_EXC_INFO_STACK
26010     _PyErr_StackItem *exc_info = tstate->exc_info;
26011     tmp_type = exc_info->exc_type;
26012     tmp_value = exc_info->exc_value;
26013     tmp_tb = exc_info->exc_traceback;
26014     exc_info->exc_type = *type;
26015     exc_info->exc_value = *value;
26016     exc_info->exc_traceback = *tb;
26017     #else
26018     tmp_type = tstate->exc_type;
26019     tmp_value = tstate->exc_value;
26020     tmp_tb = tstate->exc_traceback;
26021     tstate->exc_type = *type;
26022     tstate->exc_value = *value;
26023     tstate->exc_traceback = *tb;
26024     #endif
26025     *type = tmp_type;
26026     *value = tmp_value;
26027     *tb = tmp_tb;
26028 }
26029 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)26030 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
26031     PyObject *tmp_type, *tmp_value, *tmp_tb;
26032     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
26033     PyErr_SetExcInfo(*type, *value, *tb);
26034     *type = tmp_type;
26035     *value = tmp_value;
26036     *tb = tmp_tb;
26037 }
26038 #endif
26039 
26040 /* PyObjectCallMethod1 */
__Pyx__PyObject_CallMethod1(PyObject * method,PyObject * arg)26041 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
26042     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
26043     Py_DECREF(method);
26044     return result;
26045 }
__Pyx_PyObject_CallMethod1(PyObject * obj,PyObject * method_name,PyObject * arg)26046 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
26047     PyObject *method = NULL, *result;
26048     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
26049     if (likely(is_method)) {
26050         result = __Pyx_PyObject_Call2Args(method, obj, arg);
26051         Py_DECREF(method);
26052         return result;
26053     }
26054     if (unlikely(!method)) return NULL;
26055     return __Pyx__PyObject_CallMethod1(method, arg);
26056 }
26057 
26058 /* CoroutineBase */
26059 #include <structmember.h>
26060 #include <frameobject.h>
26061 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
__Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState * __pyx_tstate,PyObject ** pvalue)26062 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
26063     PyObject *et, *ev, *tb;
26064     PyObject *value = NULL;
26065     __Pyx_ErrFetch(&et, &ev, &tb);
26066     if (!et) {
26067         Py_XDECREF(tb);
26068         Py_XDECREF(ev);
26069         Py_INCREF(Py_None);
26070         *pvalue = Py_None;
26071         return 0;
26072     }
26073     if (likely(et == PyExc_StopIteration)) {
26074         if (!ev) {
26075             Py_INCREF(Py_None);
26076             value = Py_None;
26077         }
26078 #if PY_VERSION_HEX >= 0x030300A0
26079         else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
26080             value = ((PyStopIterationObject *)ev)->value;
26081             Py_INCREF(value);
26082             Py_DECREF(ev);
26083         }
26084 #endif
26085         else if (unlikely(PyTuple_Check(ev))) {
26086             if (PyTuple_GET_SIZE(ev) >= 1) {
26087 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26088                 value = PyTuple_GET_ITEM(ev, 0);
26089                 Py_INCREF(value);
26090 #else
26091                 value = PySequence_ITEM(ev, 0);
26092 #endif
26093             } else {
26094                 Py_INCREF(Py_None);
26095                 value = Py_None;
26096             }
26097             Py_DECREF(ev);
26098         }
26099         else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
26100             value = ev;
26101         }
26102         if (likely(value)) {
26103             Py_XDECREF(tb);
26104             Py_DECREF(et);
26105             *pvalue = value;
26106             return 0;
26107         }
26108     } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
26109         __Pyx_ErrRestore(et, ev, tb);
26110         return -1;
26111     }
26112     PyErr_NormalizeException(&et, &ev, &tb);
26113     if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
26114         __Pyx_ErrRestore(et, ev, tb);
26115         return -1;
26116     }
26117     Py_XDECREF(tb);
26118     Py_DECREF(et);
26119 #if PY_VERSION_HEX >= 0x030300A0
26120     value = ((PyStopIterationObject *)ev)->value;
26121     Py_INCREF(value);
26122     Py_DECREF(ev);
26123 #else
26124     {
26125         PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
26126         Py_DECREF(ev);
26127         if (likely(args)) {
26128             value = PySequence_GetItem(args, 0);
26129             Py_DECREF(args);
26130         }
26131         if (unlikely(!value)) {
26132             __Pyx_ErrRestore(NULL, NULL, NULL);
26133             Py_INCREF(Py_None);
26134             value = Py_None;
26135         }
26136     }
26137 #endif
26138     *pvalue = value;
26139     return 0;
26140 }
26141 static CYTHON_INLINE
__Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct * exc_state)26142 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
26143     PyObject *t, *v, *tb;
26144     t = exc_state->exc_type;
26145     v = exc_state->exc_value;
26146     tb = exc_state->exc_traceback;
26147     exc_state->exc_type = NULL;
26148     exc_state->exc_value = NULL;
26149     exc_state->exc_traceback = NULL;
26150     Py_XDECREF(t);
26151     Py_XDECREF(v);
26152     Py_XDECREF(tb);
26153 }
26154 #define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
__Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject * gen)26155 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
26156     const char *msg;
26157     if ((0)) {
26158     #ifdef __Pyx_Coroutine_USED
26159     } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
26160         msg = "coroutine already executing";
26161     #endif
26162     #ifdef __Pyx_AsyncGen_USED
26163     } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
26164         msg = "async generator already executing";
26165     #endif
26166     } else {
26167         msg = "generator already executing";
26168     }
26169     PyErr_SetString(PyExc_ValueError, msg);
26170 }
26171 #define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
__Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject * gen)26172 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
26173     const char *msg;
26174     if ((0)) {
26175     #ifdef __Pyx_Coroutine_USED
26176     } else if (__Pyx_Coroutine_Check(gen)) {
26177         msg = "can't send non-None value to a just-started coroutine";
26178     #endif
26179     #ifdef __Pyx_AsyncGen_USED
26180     } else if (__Pyx_AsyncGen_CheckExact(gen)) {
26181         msg = "can't send non-None value to a just-started async generator";
26182     #endif
26183     } else {
26184         msg = "can't send non-None value to a just-started generator";
26185     }
26186     PyErr_SetString(PyExc_TypeError, msg);
26187 }
26188 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
__Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject * gen,PyObject * value,CYTHON_UNUSED int closing)26189 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
26190     #ifdef __Pyx_Coroutine_USED
26191     if (!closing && __Pyx_Coroutine_Check(gen)) {
26192         PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
26193     } else
26194     #endif
26195     if (value) {
26196         #ifdef __Pyx_AsyncGen_USED
26197         if (__Pyx_AsyncGen_CheckExact(gen))
26198             PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
26199         else
26200         #endif
26201         PyErr_SetNone(PyExc_StopIteration);
26202     }
26203 }
26204 static
__Pyx_Coroutine_SendEx(__pyx_CoroutineObject * self,PyObject * value,int closing)26205 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
26206     __Pyx_PyThreadState_declare
26207     PyThreadState *tstate;
26208     __Pyx_ExcInfoStruct *exc_state;
26209     PyObject *retval;
26210     assert(!self->is_running);
26211     if (unlikely(self->resume_label == 0)) {
26212         if (unlikely(value && value != Py_None)) {
26213             return __Pyx_Coroutine_NotStartedError((PyObject*)self);
26214         }
26215     }
26216     if (unlikely(self->resume_label == -1)) {
26217         return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
26218     }
26219 #if CYTHON_FAST_THREAD_STATE
26220     __Pyx_PyThreadState_assign
26221     tstate = __pyx_tstate;
26222 #else
26223     tstate = __Pyx_PyThreadState_Current;
26224 #endif
26225     exc_state = &self->gi_exc_state;
26226     if (exc_state->exc_type) {
26227         #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
26228         #else
26229         if (exc_state->exc_traceback) {
26230             PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
26231             PyFrameObject *f = tb->tb_frame;
26232             Py_XINCREF(tstate->frame);
26233             assert(f->f_back == NULL);
26234             f->f_back = tstate->frame;
26235         }
26236         #endif
26237     }
26238 #if CYTHON_USE_EXC_INFO_STACK
26239     exc_state->previous_item = tstate->exc_info;
26240     tstate->exc_info = exc_state;
26241 #else
26242     if (exc_state->exc_type) {
26243         __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
26244     } else {
26245         __Pyx_Coroutine_ExceptionClear(exc_state);
26246         __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
26247     }
26248 #endif
26249     self->is_running = 1;
26250     retval = self->body((PyObject *) self, tstate, value);
26251     self->is_running = 0;
26252 #if CYTHON_USE_EXC_INFO_STACK
26253     exc_state = &self->gi_exc_state;
26254     tstate->exc_info = exc_state->previous_item;
26255     exc_state->previous_item = NULL;
26256     __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
26257 #endif
26258     return retval;
26259 }
__Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct * exc_state)26260 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
26261     PyObject *exc_tb = exc_state->exc_traceback;
26262     if (likely(exc_tb)) {
26263 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
26264 #else
26265         PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
26266         PyFrameObject *f = tb->tb_frame;
26267         Py_CLEAR(f->f_back);
26268 #endif
26269     }
26270 }
26271 static CYTHON_INLINE
__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject * gen,PyObject * retval)26272 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
26273     if (unlikely(!retval)) {
26274         __Pyx_PyThreadState_declare
26275         __Pyx_PyThreadState_assign
26276         if (!__Pyx_PyErr_Occurred()) {
26277             PyObject *exc = PyExc_StopIteration;
26278             #ifdef __Pyx_AsyncGen_USED
26279             if (__Pyx_AsyncGen_CheckExact(gen))
26280                 exc = __Pyx_PyExc_StopAsyncIteration;
26281             #endif
26282             __Pyx_PyErr_SetNone(exc);
26283         }
26284     }
26285     return retval;
26286 }
26287 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
26288 static CYTHON_INLINE
__Pyx_PyGen_Send(PyGenObject * gen,PyObject * arg)26289 PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
26290 #if PY_VERSION_HEX <= 0x030A00A1
26291     return _PyGen_Send(gen, arg);
26292 #else
26293     PyObject *result;
26294     if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
26295         if (PyAsyncGen_CheckExact(gen)) {
26296             assert(result == Py_None);
26297             PyErr_SetNone(PyExc_StopAsyncIteration);
26298         }
26299         else if (result == Py_None) {
26300             PyErr_SetNone(PyExc_StopIteration);
26301         }
26302         else {
26303             _PyGen_SetStopIterationValue(result);
26304         }
26305         Py_CLEAR(result);
26306     }
26307     return result;
26308 #endif
26309 }
26310 #endif
26311 static CYTHON_INLINE
__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject * gen)26312 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
26313     PyObject *ret;
26314     PyObject *val = NULL;
26315     __Pyx_Coroutine_Undelegate(gen);
26316     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
26317     ret = __Pyx_Coroutine_SendEx(gen, val, 0);
26318     Py_XDECREF(val);
26319     return ret;
26320 }
__Pyx_Coroutine_Send(PyObject * self,PyObject * value)26321 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
26322     PyObject *retval;
26323     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
26324     PyObject *yf = gen->yieldfrom;
26325     if (unlikely(gen->is_running))
26326         return __Pyx_Coroutine_AlreadyRunningError(gen);
26327     if (yf) {
26328         PyObject *ret;
26329         gen->is_running = 1;
26330         #ifdef __Pyx_Generator_USED
26331         if (__Pyx_Generator_CheckExact(yf)) {
26332             ret = __Pyx_Coroutine_Send(yf, value);
26333         } else
26334         #endif
26335         #ifdef __Pyx_Coroutine_USED
26336         if (__Pyx_Coroutine_Check(yf)) {
26337             ret = __Pyx_Coroutine_Send(yf, value);
26338         } else
26339         #endif
26340         #ifdef __Pyx_AsyncGen_USED
26341         if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
26342             ret = __Pyx_async_gen_asend_send(yf, value);
26343         } else
26344         #endif
26345         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
26346         if (PyGen_CheckExact(yf)) {
26347             ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
26348         } else
26349         #endif
26350         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
26351         if (PyCoro_CheckExact(yf)) {
26352             ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
26353         } else
26354         #endif
26355         {
26356             if (value == Py_None)
26357                 ret = Py_TYPE(yf)->tp_iternext(yf);
26358             else
26359                 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
26360         }
26361         gen->is_running = 0;
26362         if (likely(ret)) {
26363             return ret;
26364         }
26365         retval = __Pyx_Coroutine_FinishDelegation(gen);
26366     } else {
26367         retval = __Pyx_Coroutine_SendEx(gen, value, 0);
26368     }
26369     return __Pyx_Coroutine_MethodReturn(self, retval);
26370 }
__Pyx_Coroutine_CloseIter(__pyx_CoroutineObject * gen,PyObject * yf)26371 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
26372     PyObject *retval = NULL;
26373     int err = 0;
26374     #ifdef __Pyx_Generator_USED
26375     if (__Pyx_Generator_CheckExact(yf)) {
26376         retval = __Pyx_Coroutine_Close(yf);
26377         if (!retval)
26378             return -1;
26379     } else
26380     #endif
26381     #ifdef __Pyx_Coroutine_USED
26382     if (__Pyx_Coroutine_Check(yf)) {
26383         retval = __Pyx_Coroutine_Close(yf);
26384         if (!retval)
26385             return -1;
26386     } else
26387     if (__Pyx_CoroutineAwait_CheckExact(yf)) {
26388         retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
26389         if (!retval)
26390             return -1;
26391     } else
26392     #endif
26393     #ifdef __Pyx_AsyncGen_USED
26394     if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
26395         retval = __Pyx_async_gen_asend_close(yf, NULL);
26396     } else
26397     if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
26398         retval = __Pyx_async_gen_athrow_close(yf, NULL);
26399     } else
26400     #endif
26401     {
26402         PyObject *meth;
26403         gen->is_running = 1;
26404         meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
26405         if (unlikely(!meth)) {
26406             if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
26407                 PyErr_WriteUnraisable(yf);
26408             }
26409             PyErr_Clear();
26410         } else {
26411             retval = PyObject_CallFunction(meth, NULL);
26412             Py_DECREF(meth);
26413             if (!retval)
26414                 err = -1;
26415         }
26416         gen->is_running = 0;
26417     }
26418     Py_XDECREF(retval);
26419     return err;
26420 }
__Pyx_Generator_Next(PyObject * self)26421 static PyObject *__Pyx_Generator_Next(PyObject *self) {
26422     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
26423     PyObject *yf = gen->yieldfrom;
26424     if (unlikely(gen->is_running))
26425         return __Pyx_Coroutine_AlreadyRunningError(gen);
26426     if (yf) {
26427         PyObject *ret;
26428         gen->is_running = 1;
26429         #ifdef __Pyx_Generator_USED
26430         if (__Pyx_Generator_CheckExact(yf)) {
26431             ret = __Pyx_Generator_Next(yf);
26432         } else
26433         #endif
26434         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
26435         if (PyGen_CheckExact(yf)) {
26436             ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
26437         } else
26438         #endif
26439         #ifdef __Pyx_Coroutine_USED
26440         if (__Pyx_Coroutine_Check(yf)) {
26441             ret = __Pyx_Coroutine_Send(yf, Py_None);
26442         } else
26443         #endif
26444             ret = Py_TYPE(yf)->tp_iternext(yf);
26445         gen->is_running = 0;
26446         if (likely(ret)) {
26447             return ret;
26448         }
26449         return __Pyx_Coroutine_FinishDelegation(gen);
26450     }
26451     return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
26452 }
__Pyx_Coroutine_Close_Method(PyObject * self,CYTHON_UNUSED PyObject * arg)26453 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
26454     return __Pyx_Coroutine_Close(self);
26455 }
__Pyx_Coroutine_Close(PyObject * self)26456 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
26457     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26458     PyObject *retval, *raised_exception;
26459     PyObject *yf = gen->yieldfrom;
26460     int err = 0;
26461     if (unlikely(gen->is_running))
26462         return __Pyx_Coroutine_AlreadyRunningError(gen);
26463     if (yf) {
26464         Py_INCREF(yf);
26465         err = __Pyx_Coroutine_CloseIter(gen, yf);
26466         __Pyx_Coroutine_Undelegate(gen);
26467         Py_DECREF(yf);
26468     }
26469     if (err == 0)
26470         PyErr_SetNone(PyExc_GeneratorExit);
26471     retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
26472     if (unlikely(retval)) {
26473         const char *msg;
26474         Py_DECREF(retval);
26475         if ((0)) {
26476         #ifdef __Pyx_Coroutine_USED
26477         } else if (__Pyx_Coroutine_Check(self)) {
26478             msg = "coroutine ignored GeneratorExit";
26479         #endif
26480         #ifdef __Pyx_AsyncGen_USED
26481         } else if (__Pyx_AsyncGen_CheckExact(self)) {
26482 #if PY_VERSION_HEX < 0x03060000
26483             msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
26484 #else
26485             msg = "async generator ignored GeneratorExit";
26486 #endif
26487         #endif
26488         } else {
26489             msg = "generator ignored GeneratorExit";
26490         }
26491         PyErr_SetString(PyExc_RuntimeError, msg);
26492         return NULL;
26493     }
26494     raised_exception = PyErr_Occurred();
26495     if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
26496         if (raised_exception) PyErr_Clear();
26497         Py_INCREF(Py_None);
26498         return Py_None;
26499     }
26500     return NULL;
26501 }
__Pyx__Coroutine_Throw(PyObject * self,PyObject * typ,PyObject * val,PyObject * tb,PyObject * args,int close_on_genexit)26502 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
26503                                         PyObject *args, int close_on_genexit) {
26504     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26505     PyObject *yf = gen->yieldfrom;
26506     if (unlikely(gen->is_running))
26507         return __Pyx_Coroutine_AlreadyRunningError(gen);
26508     if (yf) {
26509         PyObject *ret;
26510         Py_INCREF(yf);
26511         if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
26512             int err = __Pyx_Coroutine_CloseIter(gen, yf);
26513             Py_DECREF(yf);
26514             __Pyx_Coroutine_Undelegate(gen);
26515             if (err < 0)
26516                 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
26517             goto throw_here;
26518         }
26519         gen->is_running = 1;
26520         if (0
26521         #ifdef __Pyx_Generator_USED
26522             || __Pyx_Generator_CheckExact(yf)
26523         #endif
26524         #ifdef __Pyx_Coroutine_USED
26525             || __Pyx_Coroutine_Check(yf)
26526         #endif
26527             ) {
26528             ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
26529         #ifdef __Pyx_Coroutine_USED
26530         } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
26531             ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
26532         #endif
26533         } else {
26534             PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
26535             if (unlikely(!meth)) {
26536                 Py_DECREF(yf);
26537                 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
26538                     gen->is_running = 0;
26539                     return NULL;
26540                 }
26541                 PyErr_Clear();
26542                 __Pyx_Coroutine_Undelegate(gen);
26543                 gen->is_running = 0;
26544                 goto throw_here;
26545             }
26546             if (likely(args)) {
26547                 ret = PyObject_CallObject(meth, args);
26548             } else {
26549                 ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
26550             }
26551             Py_DECREF(meth);
26552         }
26553         gen->is_running = 0;
26554         Py_DECREF(yf);
26555         if (!ret) {
26556             ret = __Pyx_Coroutine_FinishDelegation(gen);
26557         }
26558         return __Pyx_Coroutine_MethodReturn(self, ret);
26559     }
26560 throw_here:
26561     __Pyx_Raise(typ, val, tb, NULL);
26562     return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
26563 }
__Pyx_Coroutine_Throw(PyObject * self,PyObject * args)26564 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
26565     PyObject *typ;
26566     PyObject *val = NULL;
26567     PyObject *tb = NULL;
26568     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
26569         return NULL;
26570     return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
26571 }
__Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct * exc_state,visitproc visit,void * arg)26572 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
26573     Py_VISIT(exc_state->exc_type);
26574     Py_VISIT(exc_state->exc_value);
26575     Py_VISIT(exc_state->exc_traceback);
26576     return 0;
26577 }
__Pyx_Coroutine_traverse(__pyx_CoroutineObject * gen,visitproc visit,void * arg)26578 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
26579     Py_VISIT(gen->closure);
26580     Py_VISIT(gen->classobj);
26581     Py_VISIT(gen->yieldfrom);
26582     return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
26583 }
__Pyx_Coroutine_clear(PyObject * self)26584 static int __Pyx_Coroutine_clear(PyObject *self) {
26585     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26586     Py_CLEAR(gen->closure);
26587     Py_CLEAR(gen->classobj);
26588     Py_CLEAR(gen->yieldfrom);
26589     __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
26590 #ifdef __Pyx_AsyncGen_USED
26591     if (__Pyx_AsyncGen_CheckExact(self)) {
26592         Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
26593     }
26594 #endif
26595     Py_CLEAR(gen->gi_code);
26596     Py_CLEAR(gen->gi_frame);
26597     Py_CLEAR(gen->gi_name);
26598     Py_CLEAR(gen->gi_qualname);
26599     Py_CLEAR(gen->gi_modulename);
26600     return 0;
26601 }
__Pyx_Coroutine_dealloc(PyObject * self)26602 static void __Pyx_Coroutine_dealloc(PyObject *self) {
26603     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26604     PyObject_GC_UnTrack(gen);
26605     if (gen->gi_weakreflist != NULL)
26606         PyObject_ClearWeakRefs(self);
26607     if (gen->resume_label >= 0) {
26608         PyObject_GC_Track(self);
26609 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
26610         if (PyObject_CallFinalizerFromDealloc(self))
26611 #else
26612         Py_TYPE(gen)->tp_del(self);
26613         if (Py_REFCNT(self) > 0)
26614 #endif
26615         {
26616             return;
26617         }
26618         PyObject_GC_UnTrack(self);
26619     }
26620 #ifdef __Pyx_AsyncGen_USED
26621     if (__Pyx_AsyncGen_CheckExact(self)) {
26622         /* We have to handle this case for asynchronous generators
26623            right here, because this code has to be between UNTRACK
26624            and GC_Del. */
26625         Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
26626     }
26627 #endif
26628     __Pyx_Coroutine_clear(self);
26629     PyObject_GC_Del(gen);
26630 }
__Pyx_Coroutine_del(PyObject * self)26631 static void __Pyx_Coroutine_del(PyObject *self) {
26632     PyObject *error_type, *error_value, *error_traceback;
26633     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
26634     __Pyx_PyThreadState_declare
26635     if (gen->resume_label < 0) {
26636         return;
26637     }
26638 #if !CYTHON_USE_TP_FINALIZE
26639     assert(self->ob_refcnt == 0);
26640     __Pyx_SET_REFCNT(self, 1);
26641 #endif
26642     __Pyx_PyThreadState_assign
26643     __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
26644 #ifdef __Pyx_AsyncGen_USED
26645     if (__Pyx_AsyncGen_CheckExact(self)) {
26646         __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
26647         PyObject *finalizer = agen->ag_finalizer;
26648         if (finalizer && !agen->ag_closed) {
26649             PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
26650             if (unlikely(!res)) {
26651                 PyErr_WriteUnraisable(self);
26652             } else {
26653                 Py_DECREF(res);
26654             }
26655             __Pyx_ErrRestore(error_type, error_value, error_traceback);
26656             return;
26657         }
26658     }
26659 #endif
26660     if (unlikely(gen->resume_label == 0 && !error_value)) {
26661 #ifdef __Pyx_Coroutine_USED
26662 #ifdef __Pyx_Generator_USED
26663     if (!__Pyx_Generator_CheckExact(self))
26664 #endif
26665         {
26666         PyObject_GC_UnTrack(self);
26667 #if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
26668         if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
26669             PyErr_WriteUnraisable(self);
26670 #else
26671         {PyObject *msg;
26672         char *cmsg;
26673         #if CYTHON_COMPILING_IN_PYPY
26674         msg = NULL;
26675         cmsg = (char*) "coroutine was never awaited";
26676         #else
26677         char *cname;
26678         PyObject *qualname;
26679         qualname = gen->gi_qualname;
26680         cname = PyString_AS_STRING(qualname);
26681         msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
26682         if (unlikely(!msg)) {
26683             PyErr_Clear();
26684             cmsg = (char*) "coroutine was never awaited";
26685         } else {
26686             cmsg = PyString_AS_STRING(msg);
26687         }
26688         #endif
26689         if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
26690             PyErr_WriteUnraisable(self);
26691         Py_XDECREF(msg);}
26692 #endif
26693         PyObject_GC_Track(self);
26694         }
26695 #endif
26696     } else {
26697         PyObject *res = __Pyx_Coroutine_Close(self);
26698         if (unlikely(!res)) {
26699             if (PyErr_Occurred())
26700                 PyErr_WriteUnraisable(self);
26701         } else {
26702             Py_DECREF(res);
26703         }
26704     }
26705     __Pyx_ErrRestore(error_type, error_value, error_traceback);
26706 #if !CYTHON_USE_TP_FINALIZE
26707     assert(Py_REFCNT(self) > 0);
26708     if (--self->ob_refcnt == 0) {
26709         return;
26710     }
26711     {
26712         Py_ssize_t refcnt = Py_REFCNT(self);
26713         _Py_NewReference(self);
26714         __Pyx_SET_REFCNT(self, refcnt);
26715     }
26716 #if CYTHON_COMPILING_IN_CPYTHON
26717     assert(PyType_IS_GC(Py_TYPE(self)) &&
26718            _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
26719     _Py_DEC_REFTOTAL;
26720 #endif
26721 #ifdef COUNT_ALLOCS
26722     --Py_TYPE(self)->tp_frees;
26723     --Py_TYPE(self)->tp_allocs;
26724 #endif
26725 #endif
26726 }
26727 static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject * self,CYTHON_UNUSED void * context)26728 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
26729 {
26730     PyObject *name = self->gi_name;
26731     if (unlikely(!name)) name = Py_None;
26732     Py_INCREF(name);
26733     return name;
26734 }
26735 static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject * self,PyObject * value,CYTHON_UNUSED void * context)26736 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
26737 {
26738     PyObject *tmp;
26739 #if PY_MAJOR_VERSION >= 3
26740     if (unlikely(value == NULL || !PyUnicode_Check(value)))
26741 #else
26742     if (unlikely(value == NULL || !PyString_Check(value)))
26743 #endif
26744     {
26745         PyErr_SetString(PyExc_TypeError,
26746                         "__name__ must be set to a string object");
26747         return -1;
26748     }
26749     tmp = self->gi_name;
26750     Py_INCREF(value);
26751     self->gi_name = value;
26752     Py_XDECREF(tmp);
26753     return 0;
26754 }
26755 static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject * self,CYTHON_UNUSED void * context)26756 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
26757 {
26758     PyObject *name = self->gi_qualname;
26759     if (unlikely(!name)) name = Py_None;
26760     Py_INCREF(name);
26761     return name;
26762 }
26763 static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject * self,PyObject * value,CYTHON_UNUSED void * context)26764 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
26765 {
26766     PyObject *tmp;
26767 #if PY_MAJOR_VERSION >= 3
26768     if (unlikely(value == NULL || !PyUnicode_Check(value)))
26769 #else
26770     if (unlikely(value == NULL || !PyString_Check(value)))
26771 #endif
26772     {
26773         PyErr_SetString(PyExc_TypeError,
26774                         "__qualname__ must be set to a string object");
26775         return -1;
26776     }
26777     tmp = self->gi_qualname;
26778     Py_INCREF(value);
26779     self->gi_qualname = value;
26780     Py_XDECREF(tmp);
26781     return 0;
26782 }
26783 static PyObject *
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject * self,CYTHON_UNUSED void * context)26784 __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
26785 {
26786     PyObject *frame = self->gi_frame;
26787     if (!frame) {
26788         if (unlikely(!self->gi_code)) {
26789             Py_RETURN_NONE;
26790         }
26791         frame = (PyObject *) PyFrame_New(
26792             PyThreadState_Get(),            /*PyThreadState *tstate,*/
26793             (PyCodeObject*) self->gi_code,  /*PyCodeObject *code,*/
26794             __pyx_d,                 /*PyObject *globals,*/
26795             0                               /*PyObject *locals*/
26796         );
26797         if (unlikely(!frame))
26798             return NULL;
26799         self->gi_frame = frame;
26800     }
26801     Py_INCREF(frame);
26802     return frame;
26803 }
__Pyx__Coroutine_New(PyTypeObject * type,__pyx_coroutine_body_t body,PyObject * code,PyObject * closure,PyObject * name,PyObject * qualname,PyObject * module_name)26804 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
26805             PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
26806             PyObject *name, PyObject *qualname, PyObject *module_name) {
26807     __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
26808     if (unlikely(!gen))
26809         return NULL;
26810     return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
26811 }
__Pyx__Coroutine_NewInit(__pyx_CoroutineObject * gen,__pyx_coroutine_body_t body,PyObject * code,PyObject * closure,PyObject * name,PyObject * qualname,PyObject * module_name)26812 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
26813             __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
26814             PyObject *name, PyObject *qualname, PyObject *module_name) {
26815     gen->body = body;
26816     gen->closure = closure;
26817     Py_XINCREF(closure);
26818     gen->is_running = 0;
26819     gen->resume_label = 0;
26820     gen->classobj = NULL;
26821     gen->yieldfrom = NULL;
26822     gen->gi_exc_state.exc_type = NULL;
26823     gen->gi_exc_state.exc_value = NULL;
26824     gen->gi_exc_state.exc_traceback = NULL;
26825 #if CYTHON_USE_EXC_INFO_STACK
26826     gen->gi_exc_state.previous_item = NULL;
26827 #endif
26828     gen->gi_weakreflist = NULL;
26829     Py_XINCREF(qualname);
26830     gen->gi_qualname = qualname;
26831     Py_XINCREF(name);
26832     gen->gi_name = name;
26833     Py_XINCREF(module_name);
26834     gen->gi_modulename = module_name;
26835     Py_XINCREF(code);
26836     gen->gi_code = code;
26837     gen->gi_frame = NULL;
26838     PyObject_GC_Track(gen);
26839     return gen;
26840 }
26841 
26842 /* PatchModuleWithCoroutine */
__Pyx_Coroutine_patch_module(PyObject * module,const char * py_code)26843 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
26844 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
26845     int result;
26846     PyObject *globals, *result_obj;
26847     globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
26848     result = PyDict_SetItemString(globals, "_cython_coroutine_type",
26849     #ifdef __Pyx_Coroutine_USED
26850         (PyObject*)__pyx_CoroutineType);
26851     #else
26852         Py_None);
26853     #endif
26854     if (unlikely(result < 0)) goto ignore;
26855     result = PyDict_SetItemString(globals, "_cython_generator_type",
26856     #ifdef __Pyx_Generator_USED
26857         (PyObject*)__pyx_GeneratorType);
26858     #else
26859         Py_None);
26860     #endif
26861     if (unlikely(result < 0)) goto ignore;
26862     if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
26863     if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
26864     result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
26865     if (unlikely(!result_obj)) goto ignore;
26866     Py_DECREF(result_obj);
26867     Py_DECREF(globals);
26868     return module;
26869 ignore:
26870     Py_XDECREF(globals);
26871     PyErr_WriteUnraisable(module);
26872     if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
26873         Py_DECREF(module);
26874         module = NULL;
26875     }
26876 #else
26877     py_code++;
26878 #endif
26879     return module;
26880 }
26881 
26882 /* PatchGeneratorABC */
26883 #ifndef CYTHON_REGISTER_ABCS
26884 #define CYTHON_REGISTER_ABCS 1
26885 #endif
26886 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
26887 static PyObject* __Pyx_patch_abc_module(PyObject *module);
__Pyx_patch_abc_module(PyObject * module)26888 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
26889     module = __Pyx_Coroutine_patch_module(
26890         module, ""
26891 "if _cython_generator_type is not None:\n"
26892 "    try: Generator = _module.Generator\n"
26893 "    except AttributeError: pass\n"
26894 "    else: Generator.register(_cython_generator_type)\n"
26895 "if _cython_coroutine_type is not None:\n"
26896 "    try: Coroutine = _module.Coroutine\n"
26897 "    except AttributeError: pass\n"
26898 "    else: Coroutine.register(_cython_coroutine_type)\n"
26899     );
26900     return module;
26901 }
26902 #endif
__Pyx_patch_abc(void)26903 static int __Pyx_patch_abc(void) {
26904 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
26905     static int abc_patched = 0;
26906     if (CYTHON_REGISTER_ABCS && !abc_patched) {
26907         PyObject *module;
26908         module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
26909         if (!module) {
26910             PyErr_WriteUnraisable(NULL);
26911             if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
26912                     ((PY_MAJOR_VERSION >= 3) ?
26913                         "Cython module failed to register with collections.abc module" :
26914                         "Cython module failed to register with collections module"), 1) < 0)) {
26915                 return -1;
26916             }
26917         } else {
26918             module = __Pyx_patch_abc_module(module);
26919             abc_patched = 1;
26920             if (unlikely(!module))
26921                 return -1;
26922             Py_DECREF(module);
26923         }
26924         module = PyImport_ImportModule("backports_abc");
26925         if (module) {
26926             module = __Pyx_patch_abc_module(module);
26927             Py_XDECREF(module);
26928         }
26929         if (!module) {
26930             PyErr_Clear();
26931         }
26932     }
26933 #else
26934     if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
26935 #endif
26936     return 0;
26937 }
26938 
26939 /* Generator */
26940 static PyMethodDef __pyx_Generator_methods[] = {
26941     {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
26942      (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
26943     {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
26944      (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
26945     {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
26946      (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
26947     {0, 0, 0, 0}
26948 };
26949 static PyMemberDef __pyx_Generator_memberlist[] = {
26950     {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
26951     {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
26952      (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
26953     {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
26954     {0, 0, 0, 0, 0}
26955 };
26956 static PyGetSetDef __pyx_Generator_getsets[] = {
26957     {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
26958      (char*) PyDoc_STR("name of the generator"), 0},
26959     {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
26960      (char*) PyDoc_STR("qualified name of the generator"), 0},
26961     {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
26962      (char*) PyDoc_STR("Frame of the generator"), 0},
26963     {0, 0, 0, 0, 0}
26964 };
26965 static PyTypeObject __pyx_GeneratorType_type = {
26966     PyVarObject_HEAD_INIT(0, 0)
26967     "generator",
26968     sizeof(__pyx_CoroutineObject),
26969     0,
26970     (destructor) __Pyx_Coroutine_dealloc,
26971     0,
26972     0,
26973     0,
26974     0,
26975     0,
26976     0,
26977     0,
26978     0,
26979     0,
26980     0,
26981     0,
26982     0,
26983     0,
26984     0,
26985     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
26986     0,
26987     (traverseproc) __Pyx_Coroutine_traverse,
26988     0,
26989     0,
26990     offsetof(__pyx_CoroutineObject, gi_weakreflist),
26991     0,
26992     (iternextfunc) __Pyx_Generator_Next,
26993     __pyx_Generator_methods,
26994     __pyx_Generator_memberlist,
26995     __pyx_Generator_getsets,
26996     0,
26997     0,
26998     0,
26999     0,
27000     0,
27001     0,
27002     0,
27003     0,
27004     0,
27005     0,
27006     0,
27007     0,
27008     0,
27009     0,
27010     0,
27011 #if CYTHON_USE_TP_FINALIZE
27012     0,
27013 #else
27014     __Pyx_Coroutine_del,
27015 #endif
27016     0,
27017 #if CYTHON_USE_TP_FINALIZE
27018     __Pyx_Coroutine_del,
27019 #elif PY_VERSION_HEX >= 0x030400a1
27020     0,
27021 #endif
27022 #if PY_VERSION_HEX >= 0x030800b1
27023     0,
27024 #endif
27025 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
27026     0,
27027 #endif
27028 };
__pyx_Generator_init(void)27029 static int __pyx_Generator_init(void) {
27030     __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
27031     __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
27032     __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
27033     if (unlikely(!__pyx_GeneratorType)) {
27034         return -1;
27035     }
27036     return 0;
27037 }
27038 
27039 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)27040 static int __Pyx_check_binary_version(void) {
27041     char ctversion[4], rtversion[4];
27042     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27043     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
27044     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
27045         char message[200];
27046         PyOS_snprintf(message, sizeof(message),
27047                       "compiletime version %s of module '%.100s' "
27048                       "does not match runtime version %s",
27049                       ctversion, __Pyx_MODULE_NAME, rtversion);
27050         return PyErr_WarnEx(NULL, message, 1);
27051     }
27052     return 0;
27053 }
27054 
27055 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)27056 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27057     while (t->p) {
27058         #if PY_MAJOR_VERSION < 3
27059         if (t->is_unicode) {
27060             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27061         } else if (t->intern) {
27062             *t->p = PyString_InternFromString(t->s);
27063         } else {
27064             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27065         }
27066         #else
27067         if (t->is_unicode | t->is_str) {
27068             if (t->intern) {
27069                 *t->p = PyUnicode_InternFromString(t->s);
27070             } else if (t->encoding) {
27071                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27072             } else {
27073                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27074             }
27075         } else {
27076             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27077         }
27078         #endif
27079         if (!*t->p)
27080             return -1;
27081         if (PyObject_Hash(*t->p) == -1)
27082             return -1;
27083         ++t;
27084     }
27085     return 0;
27086 }
27087 
__Pyx_PyUnicode_FromString(const char * c_str)27088 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
27089     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27090 }
__Pyx_PyObject_AsString(PyObject * o)27091 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
27092     Py_ssize_t ignore;
27093     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27094 }
27095 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27096 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)27097 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27098     char* defenc_c;
27099     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27100     if (!defenc) return NULL;
27101     defenc_c = PyBytes_AS_STRING(defenc);
27102 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27103     {
27104         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27105         char* c;
27106         for (c = defenc_c; c < end; c++) {
27107             if ((unsigned char) (*c) >= 128) {
27108                 PyUnicode_AsASCIIString(o);
27109                 return NULL;
27110             }
27111         }
27112     }
27113 #endif
27114     *length = PyBytes_GET_SIZE(defenc);
27115     return defenc_c;
27116 }
27117 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)27118 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27119     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
27120 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27121     if (likely(PyUnicode_IS_ASCII(o))) {
27122         *length = PyUnicode_GET_LENGTH(o);
27123         return PyUnicode_AsUTF8(o);
27124     } else {
27125         PyUnicode_AsASCIIString(o);
27126         return NULL;
27127     }
27128 #else
27129     return PyUnicode_AsUTF8AndSize(o, length);
27130 #endif
27131 }
27132 #endif
27133 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)27134 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27135 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27136     if (
27137 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27138             __Pyx_sys_getdefaultencoding_not_ascii &&
27139 #endif
27140             PyUnicode_Check(o)) {
27141         return __Pyx_PyUnicode_AsStringAndSize(o, length);
27142     } else
27143 #endif
27144 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27145     if (PyByteArray_Check(o)) {
27146         *length = PyByteArray_GET_SIZE(o);
27147         return PyByteArray_AS_STRING(o);
27148     } else
27149 #endif
27150     {
27151         char* result;
27152         int r = PyBytes_AsStringAndSize(o, &result, length);
27153         if (unlikely(r < 0)) {
27154             return NULL;
27155         } else {
27156             return result;
27157         }
27158     }
27159 }
__Pyx_PyObject_IsTrue(PyObject * x)27160 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
27161    int is_true = x == Py_True;
27162    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
27163    else return PyObject_IsTrue(x);
27164 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)27165 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
27166     int retval;
27167     if (unlikely(!x)) return -1;
27168     retval = __Pyx_PyObject_IsTrue(x);
27169     Py_DECREF(x);
27170     return retval;
27171 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)27172 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
27173 #if PY_MAJOR_VERSION >= 3
27174     if (PyLong_Check(result)) {
27175         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
27176                 "__int__ returned non-int (type %.200s).  "
27177                 "The ability to return an instance of a strict subclass of int "
27178                 "is deprecated, and may be removed in a future version of Python.",
27179                 Py_TYPE(result)->tp_name)) {
27180             Py_DECREF(result);
27181             return NULL;
27182         }
27183         return result;
27184     }
27185 #endif
27186     PyErr_Format(PyExc_TypeError,
27187                  "__%.4s__ returned non-%.4s (type %.200s)",
27188                  type_name, type_name, Py_TYPE(result)->tp_name);
27189     Py_DECREF(result);
27190     return NULL;
27191 }
__Pyx_PyNumber_IntOrLong(PyObject * x)27192 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
27193 #if CYTHON_USE_TYPE_SLOTS
27194   PyNumberMethods *m;
27195 #endif
27196   const char *name = NULL;
27197   PyObject *res = NULL;
27198 #if PY_MAJOR_VERSION < 3
27199   if (likely(PyInt_Check(x) || PyLong_Check(x)))
27200 #else
27201   if (likely(PyLong_Check(x)))
27202 #endif
27203     return __Pyx_NewRef(x);
27204 #if CYTHON_USE_TYPE_SLOTS
27205   m = Py_TYPE(x)->tp_as_number;
27206   #if PY_MAJOR_VERSION < 3
27207   if (m && m->nb_int) {
27208     name = "int";
27209     res = m->nb_int(x);
27210   }
27211   else if (m && m->nb_long) {
27212     name = "long";
27213     res = m->nb_long(x);
27214   }
27215   #else
27216   if (likely(m && m->nb_int)) {
27217     name = "int";
27218     res = m->nb_int(x);
27219   }
27220   #endif
27221 #else
27222   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
27223     res = PyNumber_Int(x);
27224   }
27225 #endif
27226   if (likely(res)) {
27227 #if PY_MAJOR_VERSION < 3
27228     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
27229 #else
27230     if (unlikely(!PyLong_CheckExact(res))) {
27231 #endif
27232         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
27233     }
27234   }
27235   else if (!PyErr_Occurred()) {
27236     PyErr_SetString(PyExc_TypeError,
27237                     "an integer is required");
27238   }
27239   return res;
27240 }
27241 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
27242   Py_ssize_t ival;
27243   PyObject *x;
27244 #if PY_MAJOR_VERSION < 3
27245   if (likely(PyInt_CheckExact(b))) {
27246     if (sizeof(Py_ssize_t) >= sizeof(long))
27247         return PyInt_AS_LONG(b);
27248     else
27249         return PyInt_AsSsize_t(b);
27250   }
27251 #endif
27252   if (likely(PyLong_CheckExact(b))) {
27253     #if CYTHON_USE_PYLONG_INTERNALS
27254     const digit* digits = ((PyLongObject*)b)->ob_digit;
27255     const Py_ssize_t size = Py_SIZE(b);
27256     if (likely(__Pyx_sst_abs(size) <= 1)) {
27257         ival = likely(size) ? digits[0] : 0;
27258         if (size == -1) ival = -ival;
27259         return ival;
27260     } else {
27261       switch (size) {
27262          case 2:
27263            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27264              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27265            }
27266            break;
27267          case -2:
27268            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27269              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27270            }
27271            break;
27272          case 3:
27273            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27274              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27275            }
27276            break;
27277          case -3:
27278            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27279              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27280            }
27281            break;
27282          case 4:
27283            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27284              return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27285            }
27286            break;
27287          case -4:
27288            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27289              return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27290            }
27291            break;
27292       }
27293     }
27294     #endif
27295     return PyLong_AsSsize_t(b);
27296   }
27297   x = PyNumber_Index(b);
27298   if (!x) return -1;
27299   ival = PyInt_AsSsize_t(x);
27300   Py_DECREF(x);
27301   return ival;
27302 }
27303 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
27304   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
27305 }
27306 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
27307     return PyInt_FromSize_t(ival);
27308 }
27309 
27310 
27311 #endif /* Py_PYTHON_H */
27312