/* Generated by Cython 0.27.3 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_27_3"
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__renpy__gl__gldraw
#define __PYX_HAVE_API__renpy__gl__gldraw
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include "SDL.h"
#include "glcompat.h"
#include "pygame_sdl2/pygame_sdl2.h"
#include "eglsupport.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "gldraw.pyx",
  "gldraw.pxd",
  "stringsource",
  "matrix.pxd",
  "render.pxd",
  "gltexture.pxd",
};
/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif


/*--- Type declarations ---*/
struct __pyx_obj_5renpy_7display_6matrix_Matrix;
struct __pyx_obj_5renpy_7display_6matrix_Matrix2D;
struct __pyx_obj_5renpy_7display_6render_Render;
struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore;
struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid;
struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw;
struct __pyx_obj_5renpy_2gl_6gldraw_Environ;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half;
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit;
struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit;
struct __pyx_opt_args_5renpy_7display_6render_6Render_absolute_blit;

/* "renpy/display/render.pxd":107
 *     # operations ###############################################################
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)             # <<<<<<<<<<<<<<
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 */
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "renpy/display/render.pxd":108
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)             # <<<<<<<<<<<<<<
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 * 
 */
struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "renpy/display/render.pxd":109
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */
struct __pyx_opt_args_5renpy_7display_6render_6Render_absolute_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "renpy/display/matrix.pxd":1
 * cdef class Matrix:             # <<<<<<<<<<<<<<
 * 
 *     cdef float m[0]
 */
struct __pyx_obj_5renpy_7display_6matrix_Matrix {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix *__pyx_vtab;
  float m[0];
  float xdx;
  float xdy;
  float xdz;
  float xdw;
  float ydx;
  float ydy;
  float ydz;
  float ydw;
  float zdx;
  float zdy;
  float zdz;
  float zdw;
  float wdx;
  float wdy;
  float wdz;
  float wdw;
};


/* "renpy/display/matrix.pxd":43
 *     cpdef bint is_unit_aligned(Matrix self)
 * 
 * cdef class Matrix2D(Matrix):             # <<<<<<<<<<<<<<
 *     pass
 */
struct __pyx_obj_5renpy_7display_6matrix_Matrix2D {
  struct __pyx_obj_5renpy_7display_6matrix_Matrix __pyx_base;
};


/* "renpy/display/render.pxd":25
 * from renpy.display.matrix cimport Matrix, Matrix2D
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint mark, cache_killed
 */
struct __pyx_obj_5renpy_7display_6render_Render {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6render_Render *__pyx_vtab;
  int mark;
  int cache_killed;
  float width;
  float height;
  PyObject *layer_name;
  PyObject *children;
  PyObject *parents;
  PyObject *depends_on_list;
  int operation;
  double operation_complete;
  int operation_alpha;
  PyObject *operation_parameter;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *forward;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *reverse;
  double alpha;
  double over;
  PyObject *nearest;
  PyObject *focuses;
  PyObject *pass_focuses;
  PyObject *focus_screen;
  PyObject *draw_func;
  PyObject *render_of;
  int opaque;
  PyObject *visible_children;
  int xclipping;
  int yclipping;
  PyObject *surface;
  PyObject *alpha_surface;
  PyObject *half_cache;
  int modal;
  int text_input;
  PyObject *mesh;
  PyObject *shaders;
  PyObject *uniforms;
  PyObject *properties;
  PyObject *cached_texture;
  PyObject *cached_model;
  int loaded;
};


/* "gltexture.pxd":26
 * from gldraw cimport Environ
 * 
 * cdef class TextureCore:             # <<<<<<<<<<<<<<
 *     cdef public int width
 *     cdef public int height
 */
struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureCore *__pyx_vtab;
  int width;
  int height;
  int generation;
  unsigned int number;
  int format;
  double xmul;
  double xadd;
  double ymul;
  double yadd;
  PyObject *premult;
  PyObject *premult_size;
  int premult_left;
  int premult_right;
  int premult_top;
  int premult_bottom;
  int nearest;
  PyObject *free_list;
  PyObject *debug;
};


/* "gltexture.pxd":52
 *     cdef public object debug
 * 
 * cdef class TextureGrid:             # <<<<<<<<<<<<<<
 * 
 * 
 */
struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureGrid *__pyx_vtab;
  PyObject *__weakref__;
  int width;
  int height;
  PyObject *rows;
  PyObject *columns;
  PyObject *tiles;
  struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *half_cache;
  PyObject *debug;
  int ready;
};


/* "renpy/gl/gldraw.pxd":27
 * cdef class Environ
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     cdef bint did_init
 */
struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *__pyx_vtab;
  int did_init;
  int did_texture_test;
  struct __pyx_obj_5renpy_2gl_6gldraw_Environ *environ;
  PyObject *rtt;
  PyObject *window;
  PyObject *virtual_size;
  PyObject *physical_size;
  PyObject *drawable_size;
  PyObject *virtual_box;
  PyObject *physical_box;
  PyObject *mouse_old_visible;
  PyObject *mouse_info;
  PyObject *texture_cache;
  double last_redraw_time;
  double redraw_period;
  PyObject *info;
  PyObject *old_fullscreen;
  PyObject *fullscreen_surface;
  PyObject *display_info;
  PyObject *clip_cache;
  int fast_dissolve;
  int allow_fixed;
  PyObject *default_clip;
  int did_render_to_texture;
  float dpi_scale;
  PyObject *ready_texture_queue;
  PyObject *clip_rtt_box;
  PyObject *draw_per_virt;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *virt_to_draw;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *draw_to_virt;
  int fast_redraw_frames;
};


/* "renpy/gl/gldraw.pxd":25
 * cimport renpy.display.render as render
 * 
 * cdef class Environ             # <<<<<<<<<<<<<<
 * 
 * cdef class GLDraw:
 */
struct __pyx_obj_5renpy_2gl_6gldraw_Environ {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *__pyx_vtab;
};


/* "renpy/gl/gldraw.pyx":475
 *         self.old_fullscreen = None
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init {
  PyObject_HEAD
  PyObject *__pyx_v_extensions;
};


/* "renpy/gl/gldraw.pyx":1140
 *         return 0
 * 
 *     def render_to_texture(self, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         width = int(math.ceil(what.width * self.draw_per_virt))
 */
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture {
  PyObject_HEAD
  PyObject *__pyx_v_alpha;
  PyObject *__pyx_v_height;
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self;
  PyObject *__pyx_v_what;
  PyObject *__pyx_v_width;
};


/* "renpy/gl/gldraw.pyx":1171
 * 
 * 
 *     def is_pixel_opaque(self, what, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the pixel is not 100% transparent.
 */
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque {
  PyObject_HEAD
  PyObject *__pyx_v_alpha_holder;
  PyObject *__pyx_v_reverse;
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self;
  PyObject *__pyx_v_what;
};


/* "renpy/gl/gldraw.pyx":1218
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half {
  PyObject_HEAD
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw;
  PyObject *__pyx_v_height;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix2D *__pyx_v_reverse;
  PyObject *__pyx_v_what;
  PyObject *__pyx_v_width;
};



/* "renpy/display/matrix.pxd":1
 * cdef class Matrix:             # <<<<<<<<<<<<<<
 * 
 *     cdef float m[0]
 */

struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix {
  void (*transform4)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float *, float, float, float, float);
  void (*transform3)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float, float, float, float);
  void (*transform2)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float, float, float, float);
  int (*is_unit_aligned)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix *__pyx_vtabptr_5renpy_7display_6matrix_Matrix;
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform4(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float *, float, float, float, float);
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform3(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float, float, float, float);
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform2(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float, float, float, float);


/* "renpy/display/matrix.pxd":43
 *     cpdef bint is_unit_aligned(Matrix self)
 * 
 * cdef class Matrix2D(Matrix):             # <<<<<<<<<<<<<<
 *     pass
 */

struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix2D {
  struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix __pyx_base;
};
static struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix2D *__pyx_vtabptr_5renpy_7display_6matrix_Matrix2D;


/* "renpy/display/render.pxd":25
 * from renpy.display.matrix cimport Matrix, Matrix2D
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint mark, cache_killed
 */

struct __pyx_vtabstruct_5renpy_7display_6render_Render {
  int (*blit)(struct __pyx_obj_5renpy_7display_6render_Render *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_blit *__pyx_optional_args);
  int (*subpixel_blit)(struct __pyx_obj_5renpy_7display_6render_Render *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit *__pyx_optional_args);
  int (*absolute_blit)(struct __pyx_obj_5renpy_7display_6render_Render *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_absolute_blit *__pyx_optional_args);
};
static struct __pyx_vtabstruct_5renpy_7display_6render_Render *__pyx_vtabptr_5renpy_7display_6render_Render;


/* "gltexture.pxd":26
 * from gldraw cimport Environ
 * 
 * cdef class TextureCore:             # <<<<<<<<<<<<<<
 *     cdef public int width
 *     cdef public int height
 */

struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureCore {
  void (*make_ready)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore *);
  void (*make_nearest)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore *);
  void (*make_linear)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore *);
  int (*allocate)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureCore *__pyx_vtabptr_5renpy_2gl_9gltexture_TextureCore;


/* "gltexture.pxd":52
 *     cdef public object debug
 * 
 * cdef class TextureGrid:             # <<<<<<<<<<<<<<
 * 
 * 
 */

struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureGrid {
  void (*make_ready)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, int, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureGrid *__pyx_vtabptr_5renpy_2gl_9gltexture_TextureGrid;


/* "renpy/gl/gldraw.pyx":1466
 * 
 * 
 * cdef class Environ(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef void blit(self):
 */

struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ {
  void (*blit)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *);
  void (*blend)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double);
  void (*imageblend)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, int);
  void (*set_vertex)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, float *);
  void (*set_texture)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, float *);
  void (*set_color)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, double, double, double);
  void (*set_clip)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, PyObject *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *);
  void (*unset_clip)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *);
  void (*ortho)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, double, double, double, double, double);
  void (*viewport)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int, int, int);
};
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *__pyx_vtabptr_5renpy_2gl_6gldraw_Environ;


/* "renpy/gl/gldraw.pyx":83
 * frame_times = [ ]
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, allow_fixed=True):
 */

struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw {
  PyObject *(*set_clip)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch);
  int (*draw_render_textures)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch);
  int (*draw_transformed)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, int, int, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *__pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_DivideObjC(op1, op2, floatval, inplace)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_DivideCObj(op1, op2, floatval, inplace)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* pop.proto */
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
#define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ?\
    __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
#else
#define __Pyx_PyList_Pop(L)  __Pyx__PyObject_Pop(L)
#define __Pyx_PyObject_Pop(L)  __Pyx__PyObject_Pop(L)
#endif

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    ((likely((cfunc)->func)) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
             ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
              (PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ?\
                (PY_VERSION_HEX >= 0x030700A0 ?\
                    (*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM(__pyx_empty_tuple, 0), 0) :\
                    (*(__Pyx_PyCFunctionFastWithKeywords)(cfunc)->func)(self, &PyTuple_GET_ITEM(__pyx_empty_tuple, 0), 0, NULL)) :\
              (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
                    (*(__Pyx_PyCFunctionFastWithKeywords)(cfunc)->func)(self, &PyTuple_GET_ITEM(__pyx_empty_tuple, 0), 0, NULL) :\
                    __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* pop_index.proto */
static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix);
static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix);
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix);
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
    (likely(PyList_CheckExact(L) && __Pyx_fits_Py_ssize_t(ix, type, is_signed))) ?\
        __Pyx__PyList_PopIndex(L, py_ix, ix) : (\
        (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
            __Pyx__PyObject_PopIndex(L, py_ix)))
#define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
    __Pyx_fits_Py_ssize_t(ix, type, is_signed) ?\
        __Pyx__PyList_PopIndex(L, py_ix, ix) : (\
        (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
            __Pyx__PyObject_PopIndex(L, py_ix)))
#else
#define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)\
    __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) (\
    (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) :\
        __Pyx__PyObject_PopIndex(L, py_ix))
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* IncludeStringH.proto */
#include <string.h>

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_GLint(GLint value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

/* ModuleImport.proto */
static PyObject *__Pyx_ImportModule(const char *name);

/* TypeImport.proto */
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static PyObject *__pyx_f_5renpy_2gl_6gldraw_6GLDraw_set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_reverse, int __pyx_v_nearest, int __pyx_v_subpixel, int __pyx_skip_dispatch); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_blit(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_blend(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_fraction); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_imageblend(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_fraction, CYTHON_UNUSED int __pyx_v_ramp); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_vertex(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED float *__pyx_v_vertices); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_texture(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED int __pyx_v_unit, CYTHON_UNUSED float *__pyx_v_coords); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_color(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_r, CYTHON_UNUSED double __pyx_v_g, CYTHON_UNUSED double __pyx_v_b, CYTHON_UNUSED double __pyx_v_a); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_clip(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_clip_box, CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_unset_clip(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_ortho(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_left, CYTHON_UNUSED double __pyx_v_right, CYTHON_UNUSED double __pyx_v_bottom, CYTHON_UNUSED double __pyx_v_top, CYTHON_UNUSED double __pyx_v_near, CYTHON_UNUSED double __pyx_v_far); /* proto*/
static void __pyx_f_5renpy_2gl_6gldraw_7Environ_viewport(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED int __pyx_v_x, CYTHON_UNUSED int __pyx_v_y, CYTHON_UNUSED int __pyx_v_w, CYTHON_UNUSED int __pyx_v_h); /* proto*/
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform4(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float *__pyx_v_ow, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w); /* proto*/
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform3(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w); /* proto*/
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform2(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w); /* proto*/

/* Module declarations from 'renpy.display.matrix' */
static PyTypeObject *__pyx_ptype_5renpy_7display_6matrix_Matrix = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6matrix_Matrix2D = 0;

/* Module declarations from 'renpy.display.render' */
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Render = 0;

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'libc.stddef' */

/* Module declarations from 'sdl2' */

/* Module declarations from 'renpy.gl.gl' */
static int (*__pyx_f_5renpy_2gl_2gl_glBlendFunc)(GLenum, GLenum); /*proto*/
static int (*__pyx_f_5renpy_2gl_2gl_glClear)(GLbitfield); /*proto*/
static int (*__pyx_f_5renpy_2gl_2gl_glClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); /*proto*/
static int (*__pyx_f_5renpy_2gl_2gl_glEnable)(GLenum); /*proto*/
static int (*__pyx_f_5renpy_2gl_2gl_glFinish)(void); /*proto*/
static int (*__pyx_f_5renpy_2gl_2gl_glGetIntegerv)(GLenum, GLint *); /*proto*/
static GLchar *(*__pyx_f_5renpy_2gl_2gl_glGetString)(GLenum); /*proto*/
static int (*__pyx_f_5renpy_2gl_2gl_glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLubyte *); /*proto*/

/* Module declarations from 'pygame_sdl2' */

/* Module declarations from 'renpy.gl.gltexture' */
static PyTypeObject *__pyx_ptype_5renpy_2gl_9gltexture_TextureCore = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_9gltexture_TextureGrid = 0;
static PyObject *(*__pyx_f_5renpy_2gl_9gltexture_blit)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, double, double, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_5renpy_2gl_9gltexture_blend)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, double, double, double, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_5renpy_2gl_9gltexture_imageblend)(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, double, double, double, int, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch); /*proto*/

/* Module declarations from 'renpy.gl.gldraw' */
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw_Environ = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw_GLDraw = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct__init = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half = 0;
static int __pyx_v_5renpy_2gl_6gldraw_EGL;
static int __pyx_v_5renpy_2gl_6gldraw_DISSOLVE;
static int __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE;
static int __pyx_v_5renpy_2gl_6gldraw_PIXELLATE;
static int __pyx_v_5renpy_2gl_6gldraw_FLATTEN;
static PyObject *__pyx_v_5renpy_2gl_6gldraw_IDENTITY = 0;
static PyObject *__pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw__set_state(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *); /*proto*/
static PyObject *__pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_Environ__set_state(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "renpy.gl.gldraw"
extern int __pyx_module_is_main_renpy__gl__gldraw;
int __pyx_module_is_main_renpy__gl__gldraw = 0;

/* Implementation of 'renpy.gl.gldraw' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_round;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_range;
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_s[] = "    %s";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k__3[] = "";
static const char __pyx_k_gl[] = "gl";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_xo[] = "xo";
static const char __pyx_k_yo[] = "yo";
static const char __pyx_k_Rtt[] = "Rtt";
static const char __pyx_k__13[] = " ";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_fbo[] = "fbo";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_ios[] = "ios";
static const char __pyx_k_log[] = "log";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_rgb[] = "rgb";
static const char __pyx_k_rtt[] = "rtt";
static const char __pyx_k_ceil[] = "ceil";
static const char __pyx_k_clip[] = "clip";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_fill[] = "fill";
static const char __pyx_k_flip[] = "flip";
static const char __pyx_k_game[] = "game";
static const char __pyx_k_init[] = "init";
static const char __pyx_k_kill[] = "kill";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_over[] = "over";
static const char __pyx_k_plog[] = "plog";
static const char __pyx_k_quit[] = "quit";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_surf[] = "surf";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_what[] = "what";
static const char __pyx_k_Color[] = "Color";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_color[] = "color";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_fixed[] = "fixed";
static const char __pyx_k_mouse[] = "mouse";
static const char __pyx_k_movie[] = "movie";
static const char __pyx_k_pixel[] = "pixel";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_ready[] = "ready";
static const char __pyx_k_renpy[] = "renpy";
static const char __pyx_k_round[] = "round";
static const char __pyx_k_sleep[] = "sleep";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_video[] = "video";
static const char __pyx_k_vsync[] = "vsync";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_FboRtt[] = "FboRtt";
static const char __pyx_k_OPENGL[] = "OPENGL";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_config[] = "config";
static const char __pyx_k_deinit[] = "deinit";
static const char __pyx_k_envval[] = "envval";
static const char __pyx_k_envvar[] = "envvar";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_height[] = "height";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_mobile[] = "mobile";
static const char __pyx_k_module[] = "module";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_pygame[] = "pygame";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_render[] = "render";
static const char __pyx_k_shader[] = "shader";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_use_gl[] = "use_gl";
static const char __pyx_k_CopyRtt[] = "CopyRtt";
static const char __pyx_k_FLATTEN[] = "FLATTEN";
static const char __pyx_k_Surface[] = "Surface";
static const char __pyx_k_WeakSet[] = "WeakSet";
static const char __pyx_k_android[] = "android";
static const char __pyx_k_cleanup[] = "cleanup";
static const char __pyx_k_display[] = "display";
static const char __pyx_k_environ[] = "environ";
static const char __pyx_k_get_pos[] = "get_pos";
static const char __pyx_k_gl_size[] = "gl_size";
static const char __pyx_k_limited[] = "limited";
static const char __pyx_k_nearest[] = "nearest";
static const char __pyx_k_os_path[] = "os.path";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_req_ext[] = "req_ext";
static const char __pyx_k_reverse[] = "reverse";
static const char __pyx_k_set_pos[] = "set_pos";
static const char __pyx_k_surface[] = "surface";
static const char __pyx_k_texture[] = "texture";
static const char __pyx_k_weakref[] = "weakref";
static const char __pyx_k_windows[] = "windows";
static const char __pyx_k_DISSOLVE[] = "DISSOLVE";
static const char __pyx_k_IDENTITY[] = "IDENTITY";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_Rtt_init[] = "Rtt.init";
static const char __pyx_k_Vendor_r[] = "Vendor: %r";
static const char __pyx_k_additive[] = "additive";
static const char __pyx_k_get_half[] = "get_half";
static const char __pyx_k_get_info[] = "get_info";
static const char __pyx_k_get_size[] = "get_size";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_module_2[] = "__module__";
static const char __pyx_k_pgrender[] = "pgrender";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_renderer[] = "renderer";
static const char __pyx_k_set_clip[] = "set_clip";
static const char __pyx_k_set_mode[] = "set_mode";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_subpixel[] = "subpixel";
static const char __pyx_k_surftree[] = "surftree";
static const char __pyx_k_use_gles[] = "use_gles";
static const char __pyx_k_DOUBLEBUF[] = "DOUBLEBUF";
static const char __pyx_k_PIXELLATE[] = "PIXELLATE";
static const char __pyx_k_RESIZABLE[] = "RESIZABLE";
static const char __pyx_k_Version_r[] = "Version: %r";
static const char __pyx_k_can_block[] = "can_block";
static const char __pyx_k_current_h[] = "current_h";
static const char __pyx_k_current_w[] = "current_w";
static const char __pyx_k_dimension[] = "dimension";
static const char __pyx_k_dpi_scale[] = "dpi_scale";
static const char __pyx_k_draw_func[] = "draw_func";
static const char __pyx_k_exception[] = "exception";
static const char __pyx_k_get_flags[] = "get_flags";
static const char __pyx_k_gl_enable[] = "gl_enable";
static const char __pyx_k_gl_resize[] = "gl_resize";
static const char __pyx_k_glrtt_fbo[] = "glrtt_fbo";
static const char __pyx_k_gltexture[] = "gltexture";
static const char __pyx_k_interface[] = "interface";
static const char __pyx_k_is_opaque[] = "is_opaque";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_post_init[] = "post_init";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_resizable[] = "resizable";
static const char __pyx_k_text_rect[] = "text_rect";
static const char __pyx_k_transform[] = "transform";
static const char __pyx_k_transient[] = "transient";
static const char __pyx_k_Extensions[] = "Extensions:";
static const char __pyx_k_RENPY_FAIL[] = "RENPY_FAIL_";
static const char __pyx_k_Renderer_r[] = "Renderer: %r";
static const char __pyx_k_Rtt_deinit[] = "Rtt.deinit";
static const char __pyx_k_Rtt_render[] = "Rtt.render";
static const char __pyx_k_draw_mouse[] = "draw_mouse";
static const char __pyx_k_emscripten[] = "emscripten";
static const char __pyx_k_first_pass[] = "first_pass";
static const char __pyx_k_fullscreen[] = "fullscreen";
static const char __pyx_k_get_window[] = "get_window";
static const char __pyx_k_gl_tearing[] = "gl_tearing";
static const char __pyx_k_glrtt_copy[] = "glrtt_copy";
static const char __pyx_k_half_cache[] = "half_cache";
static const char __pyx_k_make_ready[] = "make_ready";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_subsurface[] = "subsurface";
static const char __pyx_k_GL_Disabled[] = "GL Disabled.";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_allow_fixed[] = "allow_fixed";
static const char __pyx_k_draw_screen[] = "draw_screen";
static const char __pyx_k_frame_times[] = "frame_times";
static const char __pyx_k_get_surface[] = "get_surface";
static const char __pyx_k_non_aligned[] = "non_aligned";
static const char __pyx_k_preferences[] = "preferences";
static const char __pyx_k_pygame_sdl2[] = "pygame_sdl2";
static const char __pyx_k_screen_rect[] = "screen_rect";
static const char __pyx_k_set_visible[] = "set_visible";
static const char __pyx_k_RENPY_GL_RTT[] = "RENPY_GL_RTT";
static const char __pyx_k_gl_framerate[] = "gl_framerate";
static const char __pyx_k_gl_powersave[] = "gl_powersave";
static const char __pyx_k_load_texture[] = "load_texture";
static const char __pyx_k_needs_redraw[] = "needs_redraw";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_refresh_rate[] = "refresh_rate";
static const char __pyx_k_render_movie[] = "render_movie";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_virtual_size[] = "virtual_size";
static const char __pyx_k_GL_ALPHA_SIZE[] = "GL_ALPHA_SIZE";
static const char __pyx_k_IMAGEDISSOLVE[] = "IMAGEDISSOLVE";
static const char __pyx_k_ShaderEnviron[] = "ShaderEnviron";
static const char __pyx_k_Using_FBO_RTT[] = "Using FBO RTT.";
static const char __pyx_k_Windowed_mode[] = "Windowed mode.";
static const char __pyx_k_clip_mode_rtt[] = "clip_mode_rtt";
static const char __pyx_k_flip_unscaled[] = "flip_unscaled";
static const char __pyx_k_kill_textures[] = "kill_textures";
static const char __pyx_k_physical_size[] = "physical_size";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_texture_count[] = "texture_count";
static const char __pyx_k_use_subsystem[] = "use_subsystem";
static const char __pyx_k_Display_Info_s[] = "Display Info: %s";
static const char __pyx_k_LimitedEnviron[] = "LimitedEnviron";
static const char __pyx_k_RENPY_GL_VSYNC[] = "RENPY_GL_VSYNC";
static const char __pyx_k_Using_copy_RTT[] = "Using copy RTT.";
static const char __pyx_k_frame_duration[] = "frame_duration";
static const char __pyx_k_get_mouse_info[] = "get_mouse_info";
static const char __pyx_k_get_size_limit[] = "get_size_limit";
static const char __pyx_k_gl_clear_color[] = "gl_clear_color";
static const char __pyx_k_set_rgba_masks[] = "set_rgba_masks";
static const char __pyx_k_Fullscreen_mode[] = "Fullscreen mode.";
static const char __pyx_k_GL_SWAP_CONTROL[] = "GL_SWAP_CONTROL";
static const char __pyx_k_Not_implemented[] = "Not implemented.";
static const char __pyx_k_glenviron_fixed[] = "glenviron_fixed";
static const char __pyx_k_max_window_size[] = "max_window_size";
static const char __pyx_k_operation_alpha[] = "operation_alpha";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_renpy_gl_gldraw[] = "renpy.gl.gldraw";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_translate_point[] = "translate_point";
static const char __pyx_k_RENPY_GL_ENVIRON[] = "RENPY_GL_ENVIRON";
static const char __pyx_k_Using_0_renderer[] = "Using {0} renderer.";
static const char __pyx_k_WINDOW_MAXIMIZED[] = "WINDOW_MAXIMIZED";
static const char __pyx_k_adjust_view_size[] = "adjust_view_size";
static const char __pyx_k_clip_mode_screen[] = "clip_mode_screen";
static const char __pyx_k_dealloc_textures[] = "dealloc_textures";
static const char __pyx_k_draw_transformed[] = "draw_transformed";
static const char __pyx_k_fullscreen_video[] = "fullscreen_video";
static const char __pyx_k_get_window_flags[] = "get_window_flags";
static const char __pyx_k_gl_set_attribute[] = "gl_set_attribute";
static const char __pyx_k_glenviron_shader[] = "glenviron_shader";
static const char __pyx_k_nearest_neighbor[] = "nearest_neighbor";
static const char __pyx_k_surface_unscaled[] = "surface_unscaled";
static const char __pyx_k_WINDOW_FULLSCREEN[] = "WINDOW_FULLSCREEN";
static const char __pyx_k_WeakKeyDictionary[] = "WeakKeyDictionary";
static const char __pyx_k_get_drawable_size[] = "get_drawable_size";
static const char __pyx_k_glenviron_limited[] = "glenviron_limited";
static const char __pyx_k_render_to_texture[] = "render_to_texture";
static const char __pyx_k_start_draw_screen[] = "start draw_screen";
static const char __pyx_k_untranslate_point[] = "untranslate_point";
static const char __pyx_k_Glew_init_failed_s[] = "Glew init failed: %s";
static const char __pyx_k_Initializing_EGL_s[] = "Initializing EGL: %s";
static const char __pyx_k_Rtt_get_size_limit[] = "Rtt.get_size_limit";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_fast_redraw_frames[] = "fast_redraw_frames";
static const char __pyx_k_get_display_bounds[] = "get_display_bounds";
static const char __pyx_k_operation_complete[] = "operation_complete";
static const char __pyx_k_test_texture_sizes[] = "test_texture_sizes";
static const char __pyx_k_total_texture_size[] = "total_texture_size";
static const char __pyx_k_pyx_unpickle_GLDraw[] = "__pyx_unpickle_GLDraw";
static const char __pyx_k_FixedFunctionEnviron[] = "FixedFunctionEnviron";
static const char __pyx_k_GL_ARB_vertex_shader[] = "GL_ARB_vertex_shader";
static const char __pyx_k_Unknown_drawing_type[] = "Unknown drawing type. ";
static const char __pyx_k_WINDOW_ALLOW_HIGHDPI[] = "WINDOW_ALLOW_HIGHDPI";
static const char __pyx_k_draw_render_textures[] = "draw_render_textures";
static const char __pyx_k_pyx_unpickle_Environ[] = "__pyx_unpickle_Environ";
static const char __pyx_k_RENPY_bogus_extension[] = "RENPY_bogus_extension";
static const char __pyx_k_GL_ARB_fragment_shader[] = "GL_ARB_fragment_shader";
static const char __pyx_k_swap_interval_r_frames[] = "swap interval: %r frames";
static const char __pyx_k_Shaders_are_blacklisted[] = "Shaders are blacklisted.";
static const char __pyx_k_use_drawable_resolution[] = "use_drawable_resolution";
static const char __pyx_k_GL_CONTEXT_MAJOR_VERSION[] = "GL_CONTEXT_MAJOR_VERSION";
static const char __pyx_k_GL_CONTEXT_MINOR_VERSION[] = "GL_CONTEXT_MINOR_VERSION";
static const char __pyx_k_Using_shader_environment[] = "Using shader environment.";
static const char __pyx_k_after_broken_vsync_sleep[] = "after broken vsync sleep";
static const char __pyx_k_primary_display_bounds_r[] = "primary display bounds: %r";
static const char __pyx_k_Can_t_find_a_workable_rtt[] = "Can't find a workable rtt.";
static const char __pyx_k_GL_ARB_framebuffer_object[] = "GL_ARB_framebuffer_object";
static const char __pyx_k_GL_is_totally_blacklisted[] = "GL is totally blacklisted.";
static const char __pyx_k_Number_of_texture_units_d[] = "Number of texture units: %d";
static const char __pyx_k_Using_limited_environment[] = "Using limited environment.";
static const char __pyx_k_WINDOW_FULLSCREEN_DESKTOP[] = "WINDOW_FULLSCREEN_DESKTOP";
static const char __pyx_k_get_half_locals_draw_func[] = "get_half.<locals>.draw_func";
static const char __pyx_k_init_locals_use_subsystem[] = "init.<locals>.use_subsystem";
static const char __pyx_k_texture_grid_from_drawing[] = "texture_grid_from_drawing";
static const char __pyx_k_texture_grid_from_surface[] = "texture_grid_from_surface";
static const char __pyx_k_GL_ARB_texture_env_combine[] = "GL_ARB_texture_env_combine";
static const char __pyx_k_GL_NV_texture_env_combine4[] = "GL_NV_texture_env_combine4";
static const char __pyx_k_kill_textures_and_surfaces[] = "kill_textures_and_surfaces";
static const char __pyx_k_GL_ARB_texture_env_crossbar[] = "GL_ARB_texture_env_crossbar";
static const char __pyx_k_Could_not_get_pygame_screen_r[] = "Could not get pygame screen: %r";
static const char __pyx_k_Fixed_function_is_blacklisted[] = "Fixed-function is blacklisted.";
static const char __pyx_k_Opening_in_fullscreen_failed_r[] = "Opening in fullscreen failed: %r";
static const char __pyx_k_Initializing_shader_environment[] = "Initializing shader environment failed:";
static const char __pyx_k_Screen_sizes_virtual_r_physical[] = "Screen sizes: virtual=%r physical=%r drawable=%r";
static const char __pyx_k_Subclasses_of_this_class_handle[] = "\n    Subclasses of this class handle rendering to a texture.\n    ";
static const char __pyx_k_home_tom_ab_renpy_renpy_gl_gldr[] = "/home/tom/ab/renpy/renpy/gl/gldraw.pyx";
static const char __pyx_k_Can_t_find_a_workable_environmen[] = "Can't find a workable environment.";
static const char __pyx_k_Incompatible_checksums_s_vs_0x9a[] = "Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())";
static const char __pyx_k_Using_fixed_function_environment[] = "Using fixed-function environment (clause 1).";
static const char __pyx_k_is_pixel_opaque_locals_draw_func[] = "is_pixel_opaque.<locals>.draw_func";
static const char __pyx_k_render_to_texture_locals_draw_fu[] = "render_to_texture.<locals>.draw_func";
static const char __pyx_k_Using_fixed_function_environment_2[] = "Using fixed-function environment (clause 2).";
static PyObject *__pyx_kp_s_Can_t_find_a_workable_environmen;
static PyObject *__pyx_kp_s_Can_t_find_a_workable_rtt;
static PyObject *__pyx_n_s_Color;
static PyObject *__pyx_n_s_CopyRtt;
static PyObject *__pyx_kp_s_Could_not_get_pygame_screen_r;
static PyObject *__pyx_n_s_DISSOLVE;
static PyObject *__pyx_n_s_DOUBLEBUF;
static PyObject *__pyx_kp_s_Display_Info_s;
static PyObject *__pyx_kp_s_Extensions;
static PyObject *__pyx_n_s_FLATTEN;
static PyObject *__pyx_n_s_FboRtt;
static PyObject *__pyx_n_s_FixedFunctionEnviron;
static PyObject *__pyx_kp_s_Fixed_function_is_blacklisted;
static PyObject *__pyx_kp_s_Fullscreen_mode;
static PyObject *__pyx_n_s_GL_ALPHA_SIZE;
static PyObject *__pyx_n_s_GL_ARB_fragment_shader;
static PyObject *__pyx_n_s_GL_ARB_framebuffer_object;
static PyObject *__pyx_n_s_GL_ARB_texture_env_combine;
static PyObject *__pyx_n_s_GL_ARB_texture_env_crossbar;
static PyObject *__pyx_n_s_GL_ARB_vertex_shader;
static PyObject *__pyx_n_s_GL_CONTEXT_MAJOR_VERSION;
static PyObject *__pyx_n_s_GL_CONTEXT_MINOR_VERSION;
static PyObject *__pyx_kp_s_GL_Disabled;
static PyObject *__pyx_n_s_GL_NV_texture_env_combine4;
static PyObject *__pyx_n_s_GL_SWAP_CONTROL;
static PyObject *__pyx_kp_s_GL_is_totally_blacklisted;
static PyObject *__pyx_kp_s_Glew_init_failed_s;
static PyObject *__pyx_n_s_IDENTITY;
static PyObject *__pyx_n_s_IMAGEDISSOLVE;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x9a;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4;
static PyObject *__pyx_kp_s_Initializing_EGL_s;
static PyObject *__pyx_kp_s_Initializing_shader_environment;
static PyObject *__pyx_n_s_KeyError;
static PyObject *__pyx_n_s_LimitedEnviron;
static PyObject *__pyx_kp_s_Not_implemented;
static PyObject *__pyx_kp_s_Number_of_texture_units_d;
static PyObject *__pyx_n_s_OPENGL;
static PyObject *__pyx_kp_s_Opening_in_fullscreen_failed_r;
static PyObject *__pyx_n_s_PIXELLATE;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_RENPY_FAIL;
static PyObject *__pyx_n_s_RENPY_GL_ENVIRON;
static PyObject *__pyx_n_s_RENPY_GL_RTT;
static PyObject *__pyx_n_s_RENPY_GL_VSYNC;
static PyObject *__pyx_n_s_RENPY_bogus_extension;
static PyObject *__pyx_n_s_RESIZABLE;
static PyObject *__pyx_kp_s_Renderer_r;
static PyObject *__pyx_n_s_Rtt;
static PyObject *__pyx_n_s_Rtt_deinit;
static PyObject *__pyx_n_s_Rtt_get_size_limit;
static PyObject *__pyx_n_s_Rtt_init;
static PyObject *__pyx_n_s_Rtt_render;
static PyObject *__pyx_kp_s_Screen_sizes_virtual_r_physical;
static PyObject *__pyx_n_s_ShaderEnviron;
static PyObject *__pyx_kp_s_Shaders_are_blacklisted;
static PyObject *__pyx_kp_s_Subclasses_of_this_class_handle;
static PyObject *__pyx_n_s_Surface;
static PyObject *__pyx_kp_s_Unknown_drawing_type;
static PyObject *__pyx_kp_s_Using_0_renderer;
static PyObject *__pyx_kp_s_Using_FBO_RTT;
static PyObject *__pyx_kp_s_Using_copy_RTT;
static PyObject *__pyx_kp_s_Using_fixed_function_environment;
static PyObject *__pyx_kp_s_Using_fixed_function_environment_2;
static PyObject *__pyx_kp_s_Using_limited_environment;
static PyObject *__pyx_kp_s_Using_shader_environment;
static PyObject *__pyx_kp_s_Vendor_r;
static PyObject *__pyx_kp_s_Version_r;
static PyObject *__pyx_n_s_WINDOW_ALLOW_HIGHDPI;
static PyObject *__pyx_n_s_WINDOW_FULLSCREEN;
static PyObject *__pyx_n_s_WINDOW_FULLSCREEN_DESKTOP;
static PyObject *__pyx_n_s_WINDOW_MAXIMIZED;
static PyObject *__pyx_n_s_WeakKeyDictionary;
static PyObject *__pyx_n_s_WeakSet;
static PyObject *__pyx_kp_s_Windowed_mode;
static PyObject *__pyx_kp_s__13;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_additive;
static PyObject *__pyx_n_s_adjust_view_size;
static PyObject *__pyx_kp_s_after_broken_vsync_sleep;
static PyObject *__pyx_n_s_allow_fixed;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_android;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_can_block;
static PyObject *__pyx_n_s_ceil;
static PyObject *__pyx_n_s_cleanup;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_clip;
static PyObject *__pyx_n_s_clip_mode_rtt;
static PyObject *__pyx_n_s_clip_mode_screen;
static PyObject *__pyx_n_s_color;
static PyObject *__pyx_n_s_config;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_current_h;
static PyObject *__pyx_n_s_current_w;
static PyObject *__pyx_n_s_dealloc_textures;
static PyObject *__pyx_n_s_deinit;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_dimension;
static PyObject *__pyx_n_s_display;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dpi_scale;
static PyObject *__pyx_n_s_draw_func;
static PyObject *__pyx_n_s_draw_mouse;
static PyObject *__pyx_n_s_draw_render_textures;
static PyObject *__pyx_n_s_draw_screen;
static PyObject *__pyx_n_s_draw_transformed;
static PyObject *__pyx_n_s_emscripten;
static PyObject *__pyx_n_s_environ;
static PyObject *__pyx_n_s_envval;
static PyObject *__pyx_n_s_envvar;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_exception;
static PyObject *__pyx_n_s_fast_redraw_frames;
static PyObject *__pyx_n_s_fbo;
static PyObject *__pyx_n_s_fill;
static PyObject *__pyx_n_s_first_pass;
static PyObject *__pyx_n_s_fixed;
static PyObject *__pyx_n_s_flip;
static PyObject *__pyx_n_s_flip_unscaled;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_frame_duration;
static PyObject *__pyx_n_s_frame_times;
static PyObject *__pyx_n_s_fullscreen;
static PyObject *__pyx_n_s_fullscreen_video;
static PyObject *__pyx_n_s_game;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_display_bounds;
static PyObject *__pyx_n_s_get_drawable_size;
static PyObject *__pyx_n_s_get_flags;
static PyObject *__pyx_n_s_get_half;
static PyObject *__pyx_n_s_get_half_locals_draw_func;
static PyObject *__pyx_n_s_get_info;
static PyObject *__pyx_n_s_get_mouse_info;
static PyObject *__pyx_n_s_get_pos;
static PyObject *__pyx_n_s_get_size;
static PyObject *__pyx_n_s_get_size_limit;
static PyObject *__pyx_n_s_get_surface;
static PyObject *__pyx_n_s_get_window;
static PyObject *__pyx_n_s_get_window_flags;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_gl;
static PyObject *__pyx_n_s_gl_clear_color;
static PyObject *__pyx_n_s_gl_enable;
static PyObject *__pyx_n_s_gl_framerate;
static PyObject *__pyx_n_s_gl_powersave;
static PyObject *__pyx_n_s_gl_resize;
static PyObject *__pyx_n_s_gl_set_attribute;
static PyObject *__pyx_n_s_gl_size;
static PyObject *__pyx_n_s_gl_tearing;
static PyObject *__pyx_n_s_glenviron_fixed;
static PyObject *__pyx_n_s_glenviron_limited;
static PyObject *__pyx_n_s_glenviron_shader;
static PyObject *__pyx_n_s_glrtt_copy;
static PyObject *__pyx_n_s_glrtt_fbo;
static PyObject *__pyx_n_s_gltexture;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_half_cache;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init_locals_use_subsystem;
static PyObject *__pyx_n_s_interface;
static PyObject *__pyx_n_s_ios;
static PyObject *__pyx_n_s_is_opaque;
static PyObject *__pyx_n_s_is_pixel_opaque_locals_draw_func;
static PyObject *__pyx_n_s_kill;
static PyObject *__pyx_n_s_kill_textures;
static PyObject *__pyx_n_s_kill_textures_and_surfaces;
static PyObject *__pyx_n_s_limited;
static PyObject *__pyx_n_s_load_texture;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_ready;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_s_max_window_size;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_mobile;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_module_2;
static PyObject *__pyx_n_s_mouse;
static PyObject *__pyx_n_s_movie;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_nearest;
static PyObject *__pyx_n_s_nearest_neighbor;
static PyObject *__pyx_n_s_needs_redraw;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_non_aligned;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_operation_alpha;
static PyObject *__pyx_n_s_operation_complete;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_os_path;
static PyObject *__pyx_n_s_over;
static PyObject *__pyx_n_s_pgrender;
static PyObject *__pyx_n_s_physical_size;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_pixel;
static PyObject *__pyx_n_s_plog;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_post_init;
static PyObject *__pyx_n_s_preferences;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_kp_s_primary_display_bounds_r;
static PyObject *__pyx_n_s_pygame;
static PyObject *__pyx_n_s_pygame_sdl2;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Environ;
static PyObject *__pyx_n_s_pyx_unpickle_GLDraw;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_quit;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_ready;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_refresh_rate;
static PyObject *__pyx_n_s_render;
static PyObject *__pyx_n_s_render_movie;
static PyObject *__pyx_n_s_render_to_texture;
static PyObject *__pyx_n_s_render_to_texture_locals_draw_fu;
static PyObject *__pyx_n_s_renderer;
static PyObject *__pyx_n_s_renpy;
static PyObject *__pyx_n_s_renpy_gl_gldraw;
static PyObject *__pyx_n_s_req_ext;
static PyObject *__pyx_n_s_resizable;
static PyObject *__pyx_n_s_reverse;
static PyObject *__pyx_n_s_rgb;
static PyObject *__pyx_n_s_round;
static PyObject *__pyx_n_s_rtt;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_n_s_screen_rect;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_set_clip;
static PyObject *__pyx_n_s_set_mode;
static PyObject *__pyx_n_s_set_pos;
static PyObject *__pyx_n_s_set_rgba_masks;
static PyObject *__pyx_n_s_set_visible;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shader;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_kp_s_start_draw_screen;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_subpixel;
static PyObject *__pyx_n_s_subsurface;
static PyObject *__pyx_n_s_surf;
static PyObject *__pyx_n_s_surface;
static PyObject *__pyx_n_s_surface_unscaled;
static PyObject *__pyx_n_s_surftree;
static PyObject *__pyx_kp_s_swap_interval_r_frames;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_test_texture_sizes;
static PyObject *__pyx_n_s_text_rect;
static PyObject *__pyx_n_s_texture;
static PyObject *__pyx_n_s_texture_count;
static PyObject *__pyx_n_s_texture_grid_from_drawing;
static PyObject *__pyx_n_s_texture_grid_from_surface;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_total_texture_size;
static PyObject *__pyx_n_s_transform;
static PyObject *__pyx_n_s_transient;
static PyObject *__pyx_n_s_translate_point;
static PyObject *__pyx_n_s_untranslate_point;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_use_drawable_resolution;
static PyObject *__pyx_n_s_use_gl;
static PyObject *__pyx_n_s_use_gles;
static PyObject *__pyx_n_s_use_subsystem;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_video;
static PyObject *__pyx_n_s_virtual_size;
static PyObject *__pyx_n_s_vsync;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_weakref;
static PyObject *__pyx_n_s_what;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_windows;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xo;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_yo;
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw___init__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_allow_fixed); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_2get_texture_size(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4set_mode(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_virtual_size, PyObject *__pyx_v_physical_size, PyObject *__pyx_v_fullscreen); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_6quit(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_envvar, PyObject *__pyx_v_envval, PyObject *__pyx_v_req_ext); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8init(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_10can_block(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12should_redraw(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_needs_redraw, PyObject *__pyx_v_first_pass, PyObject *__pyx_v_can_block); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_14mutated_surface(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_16load_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf, PyObject *__pyx_v_transient); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18ready_one_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_20solid_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_h, PyObject *__pyx_v_color); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_22clip_mode_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_24clip_mode_rtt(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_26set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, CYTHON_UNUSED PyObject *__pyx_v_fullscreen_video, PyObject *__pyx_v_flip); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_32draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_reverse, int __pyx_v_nearest, int __pyx_v_subpixel); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_34render_to_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_draw_func(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_y, CYTHON_UNUSED PyObject *__pyx_v_w, CYTHON_UNUSED PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_36is_pixel_opaque(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_38get_half(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_40translate_point(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_42untranslate_point(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_44update_mouse(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_46mouse_event(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_ev); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_48get_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_50set_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_52draw_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_54screenshot(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, PyObject *__pyx_v_fullscreen_video); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_56kill_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_58event_peek_sleep(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_60get_physical_size(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_62__reduce_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_64__setstate_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_init(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_2deinit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_4render(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_texture, CYTHON_UNUSED PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_y, CYTHON_UNUSED PyObject *__pyx_v_w, CYTHON_UNUSED PyObject *__pyx_v_h, CYTHON_UNUSED PyObject *__pyx_v_draw_func); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_6get_size_limit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_dimension); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_7Environ___reduce_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_7Environ_2__setstate_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_2__pyx_unpickle_Environ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_Environ(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_GLDraw(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0};
static PyObject *__pyx_float__5;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_2_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_60;
static PyObject *__pyx_int_102;
static PyObject *__pyx_int_162010000;
static PyObject *__pyx_int_222419149;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__41;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__51;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__57;
static PyObject *__pyx_codeobj__59;

/* "renpy/gl/gldraw.pyx":85
 * cdef class GLDraw:
 * 
 *     def __init__(self, allow_fixed=True):             # <<<<<<<<<<<<<<
 * 
 *         # Did we do the first-time init?
 */

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_allow_fixed = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_allow_fixed,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allow_fixed);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 85, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_allow_fixed = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 85, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw___init__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_allow_fixed);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw___init__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_allow_fixed) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  float __pyx_t_5;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "renpy/gl/gldraw.pyx":88
 * 
 *         # Did we do the first-time init?
 *         self.did_init = False             # <<<<<<<<<<<<<<
 * 
 *         # The GL environment to use.
 */
  __pyx_v_self->did_init = 0;

  /* "renpy/gl/gldraw.pyx":91
 * 
 *         # The GL environment to use.
 *         self.environ = None             # <<<<<<<<<<<<<<
 * 
 *         # The GL render-to-texture to use.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->environ);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
  __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None);

  /* "renpy/gl/gldraw.pyx":94
 * 
 *         # The GL render-to-texture to use.
 *         self.rtt = None             # <<<<<<<<<<<<<<
 * 
 *         # The screen.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->rtt);
  __Pyx_DECREF(__pyx_v_self->rtt);
  __pyx_v_self->rtt = Py_None;

  /* "renpy/gl/gldraw.pyx":97
 * 
 *         # The screen.
 *         self.window = None             # <<<<<<<<<<<<<<
 * 
 *         # The virtual size of the screen, as requested by the game.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->window);
  __Pyx_DECREF(__pyx_v_self->window);
  __pyx_v_self->window = Py_None;

  /* "renpy/gl/gldraw.pyx":100
 * 
 *         # The virtual size of the screen, as requested by the game.
 *         self.virtual_size = None             # <<<<<<<<<<<<<<
 * 
 *         # The physical size of the window we got.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->virtual_size);
  __Pyx_DECREF(__pyx_v_self->virtual_size);
  __pyx_v_self->virtual_size = ((PyObject*)Py_None);

  /* "renpy/gl/gldraw.pyx":103
 * 
 *         # The physical size of the window we got.
 *         self.physical_size = None             # <<<<<<<<<<<<<<
 * 
 *         # Is the mouse currently visible?
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(__pyx_v_self->physical_size);
  __pyx_v_self->physical_size = ((PyObject*)Py_None);

  /* "renpy/gl/gldraw.pyx":106
 * 
 *         # Is the mouse currently visible?
 *         self.mouse_old_visible = None             # <<<<<<<<<<<<<<
 * 
 *         # The (x, y) and texture of the software mouse.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->mouse_old_visible);
  __Pyx_DECREF(__pyx_v_self->mouse_old_visible);
  __pyx_v_self->mouse_old_visible = Py_None;

  /* "renpy/gl/gldraw.pyx":109
 * 
 *         # The (x, y) and texture of the software mouse.
 *         self.mouse_info = (0, 0, None)             # <<<<<<<<<<<<<<
 * 
 *         # This is used to cache the surface->texture operation.
 */
  __Pyx_INCREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);
  __Pyx_GOTREF(__pyx_v_self->mouse_info);
  __Pyx_DECREF(__pyx_v_self->mouse_info);
  __pyx_v_self->mouse_info = __pyx_tuple_;

  /* "renpy/gl/gldraw.pyx":112
 * 
 *         # This is used to cache the surface->texture operation.
 *         self.texture_cache = weakref.WeakKeyDictionary()             # <<<<<<<<<<<<<<
 * 
 *         # The time of the last redraw.
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_WeakKeyDictionary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->texture_cache);
  __Pyx_DECREF(__pyx_v_self->texture_cache);
  __pyx_v_self->texture_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":115
 * 
 *         # The time of the last redraw.
 *         self.last_redraw_time = 0             # <<<<<<<<<<<<<<
 * 
 *         # The time between redraws.
 */
  __pyx_v_self->last_redraw_time = 0.0;

  /* "renpy/gl/gldraw.pyx":118
 * 
 *         # The time between redraws.
 *         self.redraw_period = .2             # <<<<<<<<<<<<<<
 * 
 *         # Info.
 */
  __pyx_v_self->redraw_period = .2;

  /* "renpy/gl/gldraw.pyx":121
 * 
 *         # Info.
 *         self.info = { "resizable" : True, "additive" : True }             # <<<<<<<<<<<<<<
 * 
 *         if not ANGLE:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_resizable, Py_True) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_additive, Py_True) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->info);
  __Pyx_DECREF(__pyx_v_self->info);
  __pyx_v_self->info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":124
 * 
 *         if not ANGLE:
 *             self.info["renderer"] = "gl"             # <<<<<<<<<<<<<<
 *         else:
 *             self.info["renderer"] = "angle"
 */
  if (unlikely(__pyx_v_self->info == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 124, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_renderer, __pyx_n_s_gl) < 0)) __PYX_ERR(0, 124, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":129
 * 
 *         # Old value of fullscreen.
 *         self.old_fullscreen = None             # <<<<<<<<<<<<<<
 * 
 *         # We don't use a fullscreen surface, so this needs to be set
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->old_fullscreen);
  __Pyx_DECREF(__pyx_v_self->old_fullscreen);
  __pyx_v_self->old_fullscreen = Py_None;

  /* "renpy/gl/gldraw.pyx":133
 *         # We don't use a fullscreen surface, so this needs to be set
 *         # to None at all times.
 *         self.fullscreen_surface = None             # <<<<<<<<<<<<<<
 * 
 *         # The display info, from pygame.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->fullscreen_surface);
  __Pyx_DECREF(__pyx_v_self->fullscreen_surface);
  __pyx_v_self->fullscreen_surface = Py_None;

  /* "renpy/gl/gldraw.pyx":136
 * 
 *         # The display info, from pygame.
 *         self.display_info = None             # <<<<<<<<<<<<<<
 * 
 *         # Should we use the fast (but incorrect) dissolve mode?
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->display_info);
  __Pyx_DECREF(__pyx_v_self->display_info);
  __pyx_v_self->display_info = Py_None;

  /* "renpy/gl/gldraw.pyx":139
 * 
 *         # Should we use the fast (but incorrect) dissolve mode?
 *         self.fast_dissolve = False # renpy.android             # <<<<<<<<<<<<<<
 * 
 *         # Should we allow the fixed-function environment?
 */
  __pyx_v_self->fast_dissolve = 0;

  /* "renpy/gl/gldraw.pyx":142
 * 
 *         # Should we allow the fixed-function environment?
 *         self.allow_fixed = allow_fixed             # <<<<<<<<<<<<<<
 * 
 *         # Did we do the texture test at least once?
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
  __pyx_v_self->allow_fixed = __pyx_t_4;

  /* "renpy/gl/gldraw.pyx":145
 * 
 *         # Did we do the texture test at least once?
 *         self.did_texture_test = False             # <<<<<<<<<<<<<<
 * 
 *         # Did we do a render_to_texture?
 */
  __pyx_v_self->did_texture_test = 0;

  /* "renpy/gl/gldraw.pyx":148
 * 
 *         # Did we do a render_to_texture?
 *         self.did_render_to_texture = False             # <<<<<<<<<<<<<<
 * 
 *         # The DPI scale factor.
 */
  __pyx_v_self->did_render_to_texture = 0;

  /* "renpy/gl/gldraw.pyx":151
 * 
 *         # The DPI scale factor.
 *         self.dpi_scale = renpy.display.interface.dpi_scale             # <<<<<<<<<<<<<<
 * 
 *         # The number of frames to draw fast if the screen needs to be
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dpi_scale); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->dpi_scale = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":155
 *         # The number of frames to draw fast if the screen needs to be
 *         # updated.
 *         self.fast_redraw_frames = 0             # <<<<<<<<<<<<<<
 * 
 *         # The queue of textures that might need to be made ready.
 */
  __pyx_v_self->fast_redraw_frames = 0;

  /* "renpy/gl/gldraw.pyx":158
 * 
 *         # The queue of textures that might need to be made ready.
 *         self.ready_texture_queue = weakref.WeakSet()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_weakref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_WeakSet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->ready_texture_queue);
  __Pyx_DECREF(__pyx_v_self->ready_texture_queue);
  __pyx_v_self->ready_texture_queue = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":85
 * cdef class GLDraw:
 * 
 *     def __init__(self, allow_fixed=True):             # <<<<<<<<<<<<<<
 * 
 *         # Did we do the first-time init?
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":161
 * 
 * 
 *     def get_texture_size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the amount of memory locked up in textures.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3get_texture_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_2get_texture_size[] = "\n        Returns the amount of memory locked up in textures.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3get_texture_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_texture_size (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_2get_texture_size(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_2get_texture_size(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_texture_size", 0);

  /* "renpy/gl/gldraw.pyx":166
 *         """
 * 
 *         return gltexture.total_texture_size, gltexture.texture_count             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_total_texture_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_texture_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":161
 * 
 * 
 *     def get_texture_size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the amount of memory locked up in textures.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_texture_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":169
 * 
 * 
 *     def set_mode(self, virtual_size, physical_size, fullscreen):             # <<<<<<<<<<<<<<
 *         """
 *         This changes the video mode. It also initializes OpenGL, if it
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_5set_mode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_4set_mode[] = "\n        This changes the video mode. It also initializes OpenGL, if it\n        can. It returns True if it was successful, or False if OpenGL isn't\n        working for some reason.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_5set_mode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_virtual_size = 0;
  PyObject *__pyx_v_physical_size = 0;
  PyObject *__pyx_v_fullscreen = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_mode (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_virtual_size,&__pyx_n_s_physical_size,&__pyx_n_s_fullscreen,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_virtual_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_physical_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, 1); __PYX_ERR(0, 169, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fullscreen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, 2); __PYX_ERR(0, 169, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_mode") < 0)) __PYX_ERR(0, 169, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_virtual_size = values[0];
    __pyx_v_physical_size = values[1];
    __pyx_v_fullscreen = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 169, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4set_mode(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_virtual_size, __pyx_v_physical_size, __pyx_v_fullscreen);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4set_mode(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_virtual_size, PyObject *__pyx_v_physical_size, PyObject *__pyx_v_fullscreen) {
  char *__pyx_v_egl_error;
  PyObject *__pyx_v_main_window = NULL;
  PyObject *__pyx_v_vwidth = NULL;
  PyObject *__pyx_v_vheight = NULL;
  PyObject *__pyx_v_pwidth = NULL;
  PyObject *__pyx_v_pheight = NULL;
  PyObject *__pyx_v_virtual_ar = NULL;
  PyObject *__pyx_v_window_args = NULL;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_v_old_surface = NULL;
  PyObject *__pyx_v_maximized = NULL;
  PyObject *__pyx_v_visible_w = NULL;
  PyObject *__pyx_v_visible_h = NULL;
  PyObject *__pyx_v_bounds = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_head_full_w = NULL;
  PyObject *__pyx_v_head_w = NULL;
  PyObject *__pyx_v_head_h = NULL;
  PyObject *__pyx_v_bound_w = NULL;
  PyObject *__pyx_v_bound_h = NULL;
  PyObject *__pyx_v_target_framerate = NULL;
  PyObject *__pyx_v_refresh_rate = NULL;
  PyObject *__pyx_v_sync_frames = NULL;
  PyObject *__pyx_v_opengl = NULL;
  PyObject *__pyx_v_resizable = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_view_width = NULL;
  PyObject *__pyx_v_view_height = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_physical_ar = NULL;
  PyObject *__pyx_v_ratio = NULL;
  PyObject *__pyx_v_px_padding = NULL;
  PyObject *__pyx_v_py_padding = NULL;
  PyObject *__pyx_v_x_padding = NULL;
  PyObject *__pyx_v_y_padding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  long __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("set_mode", 0);
  __Pyx_INCREF(__pyx_v_fullscreen);

  /* "renpy/gl/gldraw.pyx":180
 *         cdef char *egl_error
 * 
 *         if not renpy.config.gl_enable:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("GL Disabled.")
 *             return False
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_gl_enable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":181
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":182
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self.did_init:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":180
 *         cdef char *egl_error
 * 
 *         if not renpy.config.gl_enable:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("GL Disabled.")
 *             return False
 */
  }

  /* "renpy/gl/gldraw.pyx":184
 *             return False
 * 
 *         if self.did_init:             # <<<<<<<<<<<<<<
 *             self.kill_textures()
 * 
 */
  __pyx_t_4 = (__pyx_v_self->did_init != 0);
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":185
 * 
 *         if self.did_init:
 *             self.kill_textures()             # <<<<<<<<<<<<<<
 * 
 *         if renpy.android:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kill_textures); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":184
 *             return False
 * 
 *         if self.did_init:             # <<<<<<<<<<<<<<
 *             self.kill_textures()
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":187
 *             self.kill_textures()
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             fullscreen = False
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_android); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":188
 * 
 *         if renpy.android:
 *             fullscreen = False             # <<<<<<<<<<<<<<
 * 
 *         # Refresh fullscreen status (e.g. user pressed Esc. in browser)
 */
    __Pyx_INCREF(Py_False);
    __Pyx_DECREF_SET(__pyx_v_fullscreen, Py_False);

    /* "renpy/gl/gldraw.pyx":187
 *             self.kill_textures()
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             fullscreen = False
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":191
 * 
 *         # Refresh fullscreen status (e.g. user pressed Esc. in browser)
 *         main_window = pygame.display.get_window()             # <<<<<<<<<<<<<<
 *         self.old_fullscreen = main_window is not None and bool(main_window.get_window_flags() & (pygame.WINDOW_FULLSCREEN_DESKTOP|pygame.WINDOW_FULLSCREEN))
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_main_window = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":192
 *         # Refresh fullscreen status (e.g. user pressed Esc. in browser)
 *         main_window = pygame.display.get_window()
 *         self.old_fullscreen = main_window is not None and bool(main_window.get_window_flags() & (pygame.WINDOW_FULLSCREEN_DESKTOP|pygame.WINDOW_FULLSCREEN))             # <<<<<<<<<<<<<<
 * 
 *         if fullscreen != self.old_fullscreen:
 */
  __pyx_t_4 = (__pyx_v_main_window != Py_None);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_main_window, __pyx_n_s_get_window_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_WINDOW_FULLSCREEN_DESKTOP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_WINDOW_FULLSCREEN); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Or(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_And(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyBool_FromLong((!(!__pyx_t_4))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_2 = __pyx_t_7;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_L6_bool_binop_done:;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->old_fullscreen);
  __Pyx_DECREF(__pyx_v_self->old_fullscreen);
  __pyx_v_self->old_fullscreen = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":194
 *         self.old_fullscreen = main_window is not None and bool(main_window.get_window_flags() & (pygame.WINDOW_FULLSCREEN_DESKTOP|pygame.WINDOW_FULLSCREEN))
 * 
 *         if fullscreen != self.old_fullscreen:             # <<<<<<<<<<<<<<
 * 
 *             self.did_init = False
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_fullscreen, __pyx_v_self->old_fullscreen, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":196
 *         if fullscreen != self.old_fullscreen:
 * 
 *             self.did_init = False             # <<<<<<<<<<<<<<
 * 
 *             if renpy.windows and (self.old_fullscreen is not None):
 */
    __pyx_v_self->did_init = 0;

    /* "renpy/gl/gldraw.pyx":198
 *             self.did_init = False
 * 
 *             if renpy.windows and (self.old_fullscreen is not None):             # <<<<<<<<<<<<<<
 *                 renpy.display.interface.kill_textures_and_surfaces()
 *                 pygame.display.quit()
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_windows); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 198, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_3 = (__pyx_v_self->old_fullscreen != Py_None);
    __pyx_t_8 = (__pyx_t_3 != 0);
    __pyx_t_4 = __pyx_t_8;
    __pyx_L10_bool_binop_done:;
    if (__pyx_t_4) {

      /* "renpy/gl/gldraw.pyx":199
 * 
 *             if renpy.windows and (self.old_fullscreen is not None):
 *                 renpy.display.interface.kill_textures_and_surfaces()             # <<<<<<<<<<<<<<
 *                 pygame.display.quit()
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_kill_textures_and_surfaces); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "renpy/gl/gldraw.pyx":200
 *             if renpy.windows and (self.old_fullscreen is not None):
 *                 renpy.display.interface.kill_textures_and_surfaces()
 *                 pygame.display.quit()             # <<<<<<<<<<<<<<
 * 
 *             pygame.display.init()
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_quit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 200, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 200, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "renpy/gl/gldraw.pyx":198
 *             self.did_init = False
 * 
 *             if renpy.windows and (self.old_fullscreen is not None):             # <<<<<<<<<<<<<<
 *                 renpy.display.interface.kill_textures_and_surfaces()
 *                 pygame.display.quit()
 */
    }

    /* "renpy/gl/gldraw.pyx":202
 *                 pygame.display.quit()
 * 
 *             pygame.display.init()             # <<<<<<<<<<<<<<
 * 
 *             if self.display_info is None:
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":204
 *             pygame.display.init()
 * 
 *             if self.display_info is None:             # <<<<<<<<<<<<<<
 *                 self.display_info = renpy.display.get_info()
 * 
 */
    __pyx_t_4 = (__pyx_v_self->display_info == Py_None);
    __pyx_t_8 = (__pyx_t_4 != 0);
    if (__pyx_t_8) {

      /* "renpy/gl/gldraw.pyx":205
 * 
 *             if self.display_info is None:
 *                 self.display_info = renpy.display.get_info()             # <<<<<<<<<<<<<<
 * 
 *             self.old_fullscreen = fullscreen
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_v_self->display_info);
      __Pyx_DECREF(__pyx_v_self->display_info);
      __pyx_v_self->display_info = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "renpy/gl/gldraw.pyx":204
 *             pygame.display.init()
 * 
 *             if self.display_info is None:             # <<<<<<<<<<<<<<
 *                 self.display_info = renpy.display.get_info()
 * 
 */
    }

    /* "renpy/gl/gldraw.pyx":207
 *                 self.display_info = renpy.display.get_info()
 * 
 *             self.old_fullscreen = fullscreen             # <<<<<<<<<<<<<<
 * 
 *             renpy.display.interface.post_init()
 */
    __Pyx_INCREF(__pyx_v_fullscreen);
    __Pyx_GIVEREF(__pyx_v_fullscreen);
    __Pyx_GOTREF(__pyx_v_self->old_fullscreen);
    __Pyx_DECREF(__pyx_v_self->old_fullscreen);
    __pyx_v_self->old_fullscreen = __pyx_v_fullscreen;

    /* "renpy/gl/gldraw.pyx":209
 *             self.old_fullscreen = fullscreen
 * 
 *             renpy.display.interface.post_init()             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("")
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_interface); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_post_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":194
 *         self.old_fullscreen = main_window is not None and bool(main_window.get_window_flags() & (pygame.WINDOW_FULLSCREEN_DESKTOP|pygame.WINDOW_FULLSCREEN))
 * 
 *         if fullscreen != self.old_fullscreen:             # <<<<<<<<<<<<<<
 * 
 *             self.did_init = False
 */
  }

  /* "renpy/gl/gldraw.pyx":211
 *             renpy.display.interface.post_init()
 * 
 *         renpy.display.log.write("")             # <<<<<<<<<<<<<<
 * 
 *         self.virtual_size = virtual_size
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":213
 *         renpy.display.log.write("")
 * 
 *         self.virtual_size = virtual_size             # <<<<<<<<<<<<<<
 * 
 *         vwidth, vheight = virtual_size
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_virtual_size))||((__pyx_v_virtual_size) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_virtual_size)->tp_name), 0))) __PYX_ERR(0, 213, __pyx_L1_error)
  __pyx_t_7 = __pyx_v_virtual_size;
  __Pyx_INCREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(__pyx_v_self->virtual_size);
  __Pyx_DECREF(__pyx_v_self->virtual_size);
  __pyx_v_self->virtual_size = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":215
 *         self.virtual_size = virtual_size
 * 
 *         vwidth, vheight = virtual_size             # <<<<<<<<<<<<<<
 *         pwidth, pheight = physical_size
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_virtual_size))) || (PyList_CheckExact(__pyx_v_virtual_size))) {
    PyObject* sequence = __pyx_v_virtual_size;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 215, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_v_virtual_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L13_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L13_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_5), 2) < 0) __PYX_ERR(0, 215, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L14_unpacking_done;
    __pyx_L13_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 215, __pyx_L1_error)
    __pyx_L14_unpacking_done:;
  }
  __pyx_v_vwidth = __pyx_t_7;
  __pyx_t_7 = 0;
  __pyx_v_vheight = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":216
 * 
 *         vwidth, vheight = virtual_size
 *         pwidth, pheight = physical_size             # <<<<<<<<<<<<<<
 * 
 *         if pwidth is None:
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_physical_size))) || (PyList_CheckExact(__pyx_v_physical_size))) {
    PyObject* sequence = __pyx_v_physical_size;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 216, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_v_physical_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_5), 2) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L16_unpacking_done;
    __pyx_L15_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 216, __pyx_L1_error)
    __pyx_L16_unpacking_done:;
  }
  __pyx_v_pwidth = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_pheight = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":218
 *         pwidth, pheight = physical_size
 * 
 *         if pwidth is None:             # <<<<<<<<<<<<<<
 *             pwidth = vwidth
 *             pheight = vheight
 */
  __pyx_t_8 = (__pyx_v_pwidth == Py_None);
  __pyx_t_4 = (__pyx_t_8 != 0);
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":219
 * 
 *         if pwidth is None:
 *             pwidth = vwidth             # <<<<<<<<<<<<<<
 *             pheight = vheight
 * 
 */
    __Pyx_INCREF(__pyx_v_vwidth);
    __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_v_vwidth);

    /* "renpy/gl/gldraw.pyx":220
 *         if pwidth is None:
 *             pwidth = vwidth
 *             pheight = vheight             # <<<<<<<<<<<<<<
 * 
 *         virtual_ar = 1.0 * vwidth / vheight
 */
    __Pyx_INCREF(__pyx_v_vheight);
    __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_v_vheight);

    /* "renpy/gl/gldraw.pyx":218
 *         pwidth, pheight = physical_size
 * 
 *         if pwidth is None:             # <<<<<<<<<<<<<<
 *             pwidth = vwidth
 *             pheight = vheight
 */
  }

  /* "renpy/gl/gldraw.pyx":222
 *             pheight = vheight
 * 
 *         virtual_ar = 1.0 * vwidth / vheight             # <<<<<<<<<<<<<<
 * 
 *         pwidth *= self.dpi_scale
 */
  __pyx_t_7 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_vwidth); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_vheight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_virtual_ar = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":224
 *         virtual_ar = 1.0 * vwidth / vheight
 * 
 *         pwidth *= self.dpi_scale             # <<<<<<<<<<<<<<
 *         pheight *= self.dpi_scale
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->dpi_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyNumber_InPlaceMultiply(__pyx_v_pwidth, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":225
 * 
 *         pwidth *= self.dpi_scale
 *         pheight *= self.dpi_scale             # <<<<<<<<<<<<<<
 * 
 *         window_args = { }
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->dpi_scale); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_pheight, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":227
 *         pheight *= self.dpi_scale
 * 
 *         window_args = { }             # <<<<<<<<<<<<<<
 * 
 *         info = renpy.display.get_info()
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_window_args = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":229
 *         window_args = { }
 * 
 *         info = renpy.display.get_info()             # <<<<<<<<<<<<<<
 * 
 *         old_surface = pygame.display.get_surface()
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_info = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":231
 *         info = renpy.display.get_info()
 * 
 *         old_surface = pygame.display.get_surface()             # <<<<<<<<<<<<<<
 *         if old_surface is not None:
 *             maximized = old_surface.get_flags() & pygame.WINDOW_MAXIMIZED
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_surface); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_old_surface = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":232
 * 
 *         old_surface = pygame.display.get_surface()
 *         if old_surface is not None:             # <<<<<<<<<<<<<<
 *             maximized = old_surface.get_flags() & pygame.WINDOW_MAXIMIZED
 *         else:
 */
  __pyx_t_4 = (__pyx_v_old_surface != Py_None);
  __pyx_t_8 = (__pyx_t_4 != 0);
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":233
 *         old_surface = pygame.display.get_surface()
 *         if old_surface is not None:
 *             maximized = old_surface.get_flags() & pygame.WINDOW_MAXIMIZED             # <<<<<<<<<<<<<<
 *         else:
 *             maximized = False
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_old_surface, __pyx_n_s_get_flags); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_WINDOW_MAXIMIZED); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_And(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_maximized = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":232
 * 
 *         old_surface = pygame.display.get_surface()
 *         if old_surface is not None:             # <<<<<<<<<<<<<<
 *             maximized = old_surface.get_flags() & pygame.WINDOW_MAXIMIZED
 *         else:
 */
    goto __pyx_L18;
  }

  /* "renpy/gl/gldraw.pyx":235
 *             maximized = old_surface.get_flags() & pygame.WINDOW_MAXIMIZED
 *         else:
 *             maximized = False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_INCREF(Py_False);
    __pyx_v_maximized = Py_False;
  }
  __pyx_L18:;

  /* "renpy/gl/gldraw.pyx":238
 * 
 * 
 *         visible_w = info.current_w             # <<<<<<<<<<<<<<
 *         visible_h = info.current_h
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_current_w); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_visible_w = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":239
 * 
 *         visible_w = info.current_w
 *         visible_h = info.current_h             # <<<<<<<<<<<<<<
 * 
 *         if renpy.windows and renpy.windows <= (6, 1):
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_current_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_visible_h = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":241
 *         visible_h = info.current_h
 * 
 *         if renpy.windows and renpy.windows <= (6, 1):             # <<<<<<<<<<<<<<
 *             visible_h -= 102
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_windows); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_8 = __pyx_t_4;
    goto __pyx_L20_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_windows); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_tuple__5, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = __pyx_t_4;
  __pyx_L20_bool_binop_done:;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":242
 * 
 *         if renpy.windows and renpy.windows <= (6, 1):
 *             visible_h -= 102             # <<<<<<<<<<<<<<
 * 
 *         bounds = pygame.display.get_display_bounds(0)
 */
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_visible_h, __pyx_int_102, 0x66, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_visible_h, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":241
 *         visible_h = info.current_h
 * 
 *         if renpy.windows and renpy.windows <= (6, 1):             # <<<<<<<<<<<<<<
 *             visible_h -= 102
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":244
 *             visible_h -= 102
 * 
 *         bounds = pygame.display.get_display_bounds(0)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("primary display bounds: %r", bounds)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get_display_bounds); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_bounds = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":246
 *         bounds = pygame.display.get_display_bounds(0)
 * 
 *         renpy.display.log.write("primary display bounds: %r", bounds)             # <<<<<<<<<<<<<<
 * 
 *         head_full_w = bounds[2]
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_primary_display_bounds_r, __pyx_v_bounds};
    __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_primary_display_bounds_r, __pyx_v_bounds};
    __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_primary_display_bounds_r);
    __Pyx_GIVEREF(__pyx_kp_s_primary_display_bounds_r);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_kp_s_primary_display_bounds_r);
    __Pyx_INCREF(__pyx_v_bounds);
    __Pyx_GIVEREF(__pyx_v_bounds);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_v_bounds);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":248
 *         renpy.display.log.write("primary display bounds: %r", bounds)
 * 
 *         head_full_w = bounds[2]             # <<<<<<<<<<<<<<
 *         head_w = bounds[2] - 102
 *         head_h = bounds[3] - 102
 */
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_bounds, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_head_full_w = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":249
 * 
 *         head_full_w = bounds[2]
 *         head_w = bounds[2] - 102             # <<<<<<<<<<<<<<
 *         head_h = bounds[3] - 102
 * 
 */
  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_bounds, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_7, __pyx_int_102, 0x66, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_head_w = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":250
 *         head_full_w = bounds[2]
 *         head_w = bounds[2] - 102
 *         head_h = bounds[3] - 102             # <<<<<<<<<<<<<<
 * 
 *         # Figure out the default window size.
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_bounds, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_102, 0x66, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_head_h = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":253
 * 
 *         # Figure out the default window size.
 *         bound_w = min(vwidth, visible_w, head_w)             # <<<<<<<<<<<<<<
 *         bound_h = min(vwidth, visible_h, head_h)
 * 
 */
  __Pyx_INCREF(__pyx_v_visible_w);
  __pyx_t_7 = __pyx_v_visible_w;
  __Pyx_INCREF(__pyx_v_head_w);
  __pyx_t_2 = __pyx_v_head_w;
  __Pyx_INCREF(__pyx_v_vwidth);
  __pyx_t_1 = __pyx_v_vwidth;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 253, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = __pyx_t_2;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_bound_w = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":254
 *         # Figure out the default window size.
 *         bound_w = min(vwidth, visible_w, head_w)
 *         bound_h = min(vwidth, visible_h, head_h)             # <<<<<<<<<<<<<<
 * 
 *         if (not renpy.mobile) and (not maximized):
 */
  __Pyx_INCREF(__pyx_v_visible_h);
  __pyx_t_7 = __pyx_v_visible_h;
  __Pyx_INCREF(__pyx_v_head_h);
  __pyx_t_5 = __pyx_v_head_h;
  __Pyx_INCREF(__pyx_v_vwidth);
  __pyx_t_2 = __pyx_v_vwidth;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_bound_h = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":256
 *         bound_h = min(vwidth, visible_h, head_h)
 * 
 *         if (not renpy.mobile) and (not maximized):             # <<<<<<<<<<<<<<
 * 
 *             pwidth = min(visible_w, pwidth)
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_mobile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_4) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_8 = __pyx_t_3;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_maximized); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 256, __pyx_L1_error)
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  __pyx_t_8 = __pyx_t_4;
  __pyx_L23_bool_binop_done:;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":258
 *         if (not renpy.mobile) and (not maximized):
 * 
 *             pwidth = min(visible_w, pwidth)             # <<<<<<<<<<<<<<
 *             pheight = min(visible_h, pheight)
 * 
 */
    __Pyx_INCREF(__pyx_v_pwidth);
    __pyx_t_1 = __pyx_v_pwidth;
    __Pyx_INCREF(__pyx_v_visible_w);
    __pyx_t_7 = __pyx_v_visible_w;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_8) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = __pyx_t_7;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":259
 * 
 *             pwidth = min(visible_w, pwidth)
 *             pheight = min(visible_h, pheight)             # <<<<<<<<<<<<<<
 * 
 *             # The first time through.
 */
    __Pyx_INCREF(__pyx_v_pheight);
    __pyx_t_1 = __pyx_v_pheight;
    __Pyx_INCREF(__pyx_v_visible_h);
    __pyx_t_5 = __pyx_v_visible_h;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_8) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_7 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":262
 * 
 *             # The first time through.
 *             if not self.did_init:             # <<<<<<<<<<<<<<
 *                 pwidth = min(pwidth, head_w)
 *                 pheight = min(pheight, head_h)
 */
    __pyx_t_8 = ((!(__pyx_v_self->did_init != 0)) != 0);
    if (__pyx_t_8) {

      /* "renpy/gl/gldraw.pyx":263
 *             # The first time through.
 *             if not self.did_init:
 *                 pwidth = min(pwidth, head_w)             # <<<<<<<<<<<<<<
 *                 pheight = min(pheight, head_h)
 * 
 */
      __Pyx_INCREF(__pyx_v_head_w);
      __pyx_t_1 = __pyx_v_head_w;
      __Pyx_INCREF(__pyx_v_pwidth);
      __pyx_t_7 = __pyx_v_pwidth;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_8) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1;
      } else {
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = __pyx_t_7;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":264
 *             if not self.did_init:
 *                 pwidth = min(pwidth, head_w)
 *                 pheight = min(pheight, head_h)             # <<<<<<<<<<<<<<
 * 
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)
 */
      __Pyx_INCREF(__pyx_v_head_h);
      __pyx_t_1 = __pyx_v_head_h;
      __Pyx_INCREF(__pyx_v_pheight);
      __pyx_t_5 = __pyx_v_pheight;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 264, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_8) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = __pyx_t_1;
      } else {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = __pyx_t_5;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":266
 *                 pheight = min(pheight, head_h)
 * 
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)             # <<<<<<<<<<<<<<
 * 
 *         pwidth = int(round(pwidth))
 */
      __Pyx_INCREF(__pyx_v_pwidth);
      __pyx_t_1 = __pyx_v_pwidth;
      __pyx_t_7 = PyNumber_Multiply(__pyx_v_pheight, __pyx_v_virtual_ar); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_8) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1;
      } else {
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_5 = __pyx_t_7;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_v_pheight);
      __pyx_t_5 = __pyx_v_pheight;
      __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_v_pwidth, __pyx_v_virtual_ar); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 266, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_8) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_2 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_2 = __pyx_t_7;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_2;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/gl/gldraw.pyx":262
 * 
 *             # The first time through.
 *             if not self.did_init:             # <<<<<<<<<<<<<<
 *                 pwidth = min(pwidth, head_w)
 *                 pheight = min(pheight, head_h)
 */
    }

    /* "renpy/gl/gldraw.pyx":256
 *         bound_h = min(vwidth, visible_h, head_h)
 * 
 *         if (not renpy.mobile) and (not maximized):             # <<<<<<<<<<<<<<
 * 
 *             pwidth = min(visible_w, pwidth)
 */
  }

  /* "renpy/gl/gldraw.pyx":268
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)
 * 
 *         pwidth = int(round(pwidth))             # <<<<<<<<<<<<<<
 *         pheight = int(round(pheight))
 * 
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_pwidth);
  __Pyx_GIVEREF(__pyx_v_pwidth);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pwidth);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":269
 * 
 *         pwidth = int(round(pwidth))
 *         pheight = int(round(pheight))             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(pwidth, 256)
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_v_pheight);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pheight);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":271
 *         pheight = int(round(pheight))
 * 
 *         pwidth = max(pwidth, 256)             # <<<<<<<<<<<<<<
 *         pheight = max(pheight, 256)
 * 
 */
  __pyx_t_11 = 0x100;
  __Pyx_INCREF(__pyx_v_pwidth);
  __pyx_t_5 = __pyx_v_pwidth;
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {
    __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":272
 * 
 *         pwidth = max(pwidth, 256)
 *         pheight = max(pheight, 256)             # <<<<<<<<<<<<<<
 * 
 *         # Handle swap control.
 */
  __pyx_t_11 = 0x100;
  __Pyx_INCREF(__pyx_v_pheight);
  __pyx_t_5 = __pyx_v_pheight;
  __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":275
 * 
 *         # Handle swap control.
 *         target_framerate = renpy.game.preferences.gl_framerate             # <<<<<<<<<<<<<<
 *         refresh_rate = info.refresh_rate
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_game); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_preferences); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_gl_framerate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_target_framerate = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":276
 *         # Handle swap control.
 *         target_framerate = renpy.game.preferences.gl_framerate
 *         refresh_rate = info.refresh_rate             # <<<<<<<<<<<<<<
 * 
 *         if not refresh_rate:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_refresh_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_refresh_rate = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":278
 *         refresh_rate = info.refresh_rate
 * 
 *         if not refresh_rate:             # <<<<<<<<<<<<<<
 *             refresh_rate = 60
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_refresh_rate); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 278, __pyx_L1_error)
  __pyx_t_4 = ((!__pyx_t_8) != 0);
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":279
 * 
 *         if not refresh_rate:
 *             refresh_rate = 60             # <<<<<<<<<<<<<<
 * 
 *         if target_framerate is None:
 */
    __Pyx_INCREF(__pyx_int_60);
    __Pyx_DECREF_SET(__pyx_v_refresh_rate, __pyx_int_60);

    /* "renpy/gl/gldraw.pyx":278
 *         refresh_rate = info.refresh_rate
 * 
 *         if not refresh_rate:             # <<<<<<<<<<<<<<
 *             refresh_rate = 60
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":281
 *             refresh_rate = 60
 * 
 *         if target_framerate is None:             # <<<<<<<<<<<<<<
 *             sync_frames = 1
 *         else:
 */
  __pyx_t_4 = (__pyx_v_target_framerate == Py_None);
  __pyx_t_8 = (__pyx_t_4 != 0);
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":282
 * 
 *         if target_framerate is None:
 *             sync_frames = 1             # <<<<<<<<<<<<<<
 *         else:
 *             sync_frames = int(round(1.0 * refresh_rate) / target_framerate)
 */
    __Pyx_INCREF(__pyx_int_1);
    __pyx_v_sync_frames = __pyx_int_1;

    /* "renpy/gl/gldraw.pyx":281
 *             refresh_rate = 60
 * 
 *         if target_framerate is None:             # <<<<<<<<<<<<<<
 *             sync_frames = 1
 *         else:
 */
    goto __pyx_L27;
  }

  /* "renpy/gl/gldraw.pyx":284
 *             sync_frames = 1
 *         else:
 *             sync_frames = int(round(1.0 * refresh_rate) / target_framerate)             # <<<<<<<<<<<<<<
 *             if sync_frames < 1:
 *                 sync_frames = 1
 */
  /*else*/ {
    __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_refresh_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_target_framerate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_sync_frames = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":285
 *         else:
 *             sync_frames = int(round(1.0 * refresh_rate) / target_framerate)
 *             if sync_frames < 1:             # <<<<<<<<<<<<<<
 *                 sync_frames = 1
 * 
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_sync_frames, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "renpy/gl/gldraw.pyx":286
 *             sync_frames = int(round(1.0 * refresh_rate) / target_framerate)
 *             if sync_frames < 1:
 *                 sync_frames = 1             # <<<<<<<<<<<<<<
 * 
 *         if renpy.game.preferences.gl_tearing:
 */
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_DECREF_SET(__pyx_v_sync_frames, __pyx_int_1);

      /* "renpy/gl/gldraw.pyx":285
 *         else:
 *             sync_frames = int(round(1.0 * refresh_rate) / target_framerate)
 *             if sync_frames < 1:             # <<<<<<<<<<<<<<
 *                 sync_frames = 1
 * 
 */
    }
  }
  __pyx_L27:;

  /* "renpy/gl/gldraw.pyx":288
 *                 sync_frames = 1
 * 
 *         if renpy.game.preferences.gl_tearing:             # <<<<<<<<<<<<<<
 *             sync_frames = -sync_frames
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_game); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_preferences); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_gl_tearing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":289
 * 
 *         if renpy.game.preferences.gl_tearing:
 *             sync_frames = -sync_frames             # <<<<<<<<<<<<<<
 * 
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", sync_frames))
 */
    __pyx_t_5 = PyNumber_Negative(__pyx_v_sync_frames); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_sync_frames, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":288
 *                 sync_frames = 1
 * 
 *         if renpy.game.preferences.gl_tearing:             # <<<<<<<<<<<<<<
 *             sync_frames = -sync_frames
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":291
 *             sync_frames = -sync_frames
 * 
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", sync_frames))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.interface.frame_duration = 1.0 * abs(vsync) / refresh_rate
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_environ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_RENPY_GL_VSYNC, __pyx_v_sync_frames};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_RENPY_GL_VSYNC, __pyx_v_sync_frames};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_RENPY_GL_VSYNC);
    __Pyx_GIVEREF(__pyx_n_s_RENPY_GL_VSYNC);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_n_s_RENPY_GL_VSYNC);
    __Pyx_INCREF(__pyx_v_sync_frames);
    __Pyx_GIVEREF(__pyx_v_sync_frames);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_v_sync_frames);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vsync, __pyx_t_1) < 0) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":293
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", sync_frames))
 * 
 *         renpy.display.interface.frame_duration = 1.0 * abs(vsync) / refresh_rate             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("swap interval: %r frames", vsync)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vsync); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_refresh_rate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_frame_duration, __pyx_t_5) < 0) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":295
 *         renpy.display.interface.frame_duration = 1.0 * abs(vsync) / refresh_rate
 * 
 *         renpy.display.log.write("swap interval: %r frames", vsync)             # <<<<<<<<<<<<<<
 * 
 *         # Set the display mode.
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_vsync); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_swap_interval_r_frames, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_kp_s_swap_interval_r_frames, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_swap_interval_r_frames);
    __Pyx_GIVEREF(__pyx_kp_s_swap_interval_r_frames);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_kp_s_swap_interval_r_frames);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":303
 *             resizable = pygame.RESIZABLE
 * 
 *         elif EGL:             # <<<<<<<<<<<<<<
 *             opengl = 0
 *             resizable = 0
 */
  __pyx_t_8 = (__pyx_v_5renpy_2gl_6gldraw_EGL != 0);
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":304
 * 
 *         elif EGL:
 *             opengl = 0             # <<<<<<<<<<<<<<
 *             resizable = 0
 * 
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_opengl = __pyx_int_0;

    /* "renpy/gl/gldraw.pyx":305
 *         elif EGL:
 *             opengl = 0
 *             resizable = 0             # <<<<<<<<<<<<<<
 * 
 *         elif renpy.android:
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_resizable = __pyx_int_0;

    /* "renpy/gl/gldraw.pyx":303
 *             resizable = pygame.RESIZABLE
 * 
 *         elif EGL:             # <<<<<<<<<<<<<<
 *             opengl = 0
 *             resizable = 0
 */
    goto __pyx_L30;
  }

  /* "renpy/gl/gldraw.pyx":307
 *             resizable = 0
 * 
 *         elif renpy.android:             # <<<<<<<<<<<<<<
 *             opengl = pygame.OPENGL
 *             resizable = 0
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_android); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 307, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":308
 * 
 *         elif renpy.android:
 *             opengl = pygame.OPENGL             # <<<<<<<<<<<<<<
 *             resizable = 0
 * 
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_OPENGL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_opengl = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":309
 *         elif renpy.android:
 *             opengl = pygame.OPENGL
 *             resizable = 0             # <<<<<<<<<<<<<<
 * 
 *             pwidth = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_resizable = __pyx_int_0;

    /* "renpy/gl/gldraw.pyx":311
 *             resizable = 0
 * 
 *             pwidth = 0             # <<<<<<<<<<<<<<
 *             pheight = 0
 * 
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_int_0);

    /* "renpy/gl/gldraw.pyx":312
 * 
 *             pwidth = 0
 *             pheight = 0             # <<<<<<<<<<<<<<
 * 
 *         elif renpy.ios:
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_int_0);

    /* "renpy/gl/gldraw.pyx":307
 *             resizable = 0
 * 
 *         elif renpy.android:             # <<<<<<<<<<<<<<
 *             opengl = pygame.OPENGL
 *             resizable = 0
 */
    goto __pyx_L30;
  }

  /* "renpy/gl/gldraw.pyx":314
 *             pheight = 0
 * 
 *         elif renpy.ios:             # <<<<<<<<<<<<<<
 *             opengl = pygame.OPENGL | pygame.WINDOW_ALLOW_HIGHDPI
 *             resizable = pygame.RESIZABLE
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ios); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":315
 * 
 *         elif renpy.ios:
 *             opengl = pygame.OPENGL | pygame.WINDOW_ALLOW_HIGHDPI             # <<<<<<<<<<<<<<
 *             resizable = pygame.RESIZABLE
 * 
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_OPENGL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_WINDOW_ALLOW_HIGHDPI); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Or(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_opengl = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":316
 *         elif renpy.ios:
 *             opengl = pygame.OPENGL | pygame.WINDOW_ALLOW_HIGHDPI
 *             resizable = pygame.RESIZABLE             # <<<<<<<<<<<<<<
 * 
 *             pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 2);
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_RESIZABLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_resizable = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":318
 *             resizable = pygame.RESIZABLE
 * 
 *             pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 2);             # <<<<<<<<<<<<<<
 *             pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 0);
 * 
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_gl_set_attribute); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_GL_CONTEXT_MAJOR_VERSION); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_5, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_5, __pyx_int_2};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_t_5);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_int_2);
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":319
 * 
 *             pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 2);
 *             pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 0);             # <<<<<<<<<<<<<<
 * 
 *             pwidth = 0
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_gl_set_attribute); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_GL_CONTEXT_MINOR_VERSION); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_int_0};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_int_0};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_t_5);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_int_0);
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":321
 *             pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 0);
 * 
 *             pwidth = 0             # <<<<<<<<<<<<<<
 *             pheight = 0
 * 
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_int_0);

    /* "renpy/gl/gldraw.pyx":322
 * 
 *             pwidth = 0
 *             pheight = 0             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_int_0);

    /* "renpy/gl/gldraw.pyx":314
 *             pheight = 0
 * 
 *         elif renpy.ios:             # <<<<<<<<<<<<<<
 *             opengl = pygame.OPENGL | pygame.WINDOW_ALLOW_HIGHDPI
 *             resizable = pygame.RESIZABLE
 */
    goto __pyx_L30;
  }

  /* "renpy/gl/gldraw.pyx":325
 * 
 *         else:
 *             opengl = pygame.OPENGL             # <<<<<<<<<<<<<<
 * 
 *             if self.dpi_scale == 1.0:
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_OPENGL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_opengl = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":327
 *             opengl = pygame.OPENGL
 * 
 *             if self.dpi_scale == 1.0:             # <<<<<<<<<<<<<<
 *                 opengl |= pygame.WINDOW_ALLOW_HIGHDPI
 * 
 */
    __pyx_t_8 = ((__pyx_v_self->dpi_scale == 1.0) != 0);
    if (__pyx_t_8) {

      /* "renpy/gl/gldraw.pyx":328
 * 
 *             if self.dpi_scale == 1.0:
 *                 opengl |= pygame.WINDOW_ALLOW_HIGHDPI             # <<<<<<<<<<<<<<
 * 
 *             if renpy.config.gl_resize:
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_WINDOW_ALLOW_HIGHDPI); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_InPlaceOr(__pyx_v_opengl, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_opengl, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/gl/gldraw.pyx":327
 *             opengl = pygame.OPENGL
 * 
 *             if self.dpi_scale == 1.0:             # <<<<<<<<<<<<<<
 *                 opengl |= pygame.WINDOW_ALLOW_HIGHDPI
 * 
 */
    }

    /* "renpy/gl/gldraw.pyx":330
 *                 opengl |= pygame.WINDOW_ALLOW_HIGHDPI
 * 
 *             if renpy.config.gl_resize:             # <<<<<<<<<<<<<<
 *                 resizable = pygame.RESIZABLE
 *             else:
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_config); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_gl_resize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_8) {

      /* "renpy/gl/gldraw.pyx":331
 * 
 *             if renpy.config.gl_resize:
 *                 resizable = pygame.RESIZABLE             # <<<<<<<<<<<<<<
 *             else:
 *                 resizable = 0
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_RESIZABLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_resizable = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":330
 *                 opengl |= pygame.WINDOW_ALLOW_HIGHDPI
 * 
 *             if renpy.config.gl_resize:             # <<<<<<<<<<<<<<
 *                 resizable = pygame.RESIZABLE
 *             else:
 */
      goto __pyx_L32;
    }

    /* "renpy/gl/gldraw.pyx":333
 *                 resizable = pygame.RESIZABLE
 *             else:
 *                 resizable = 0             # <<<<<<<<<<<<<<
 * 
 *         if opengl:
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_int_0);
      __pyx_v_resizable = __pyx_int_0;
    }
    __pyx_L32:;
  }
  __pyx_L30:;

  /* "renpy/gl/gldraw.pyx":335
 *                 resizable = 0
 * 
 *         if opengl:             # <<<<<<<<<<<<<<
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_opengl); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 335, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":336
 * 
 *         if opengl:
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)             # <<<<<<<<<<<<<<
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 * 
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_gl_set_attribute); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_GL_SWAP_CONTROL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vsync); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_1};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 336, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_1};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 336, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_10, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_10, __pyx_t_1);
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":337
 *         if opengl:
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)             # <<<<<<<<<<<<<<
 * 
 *         self.window = None
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_gl_set_attribute); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_GL_ALPHA_SIZE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_1, __pyx_int_8};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_1, __pyx_int_8};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_t_1);
      __Pyx_INCREF(__pyx_int_8);
      __Pyx_GIVEREF(__pyx_int_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_int_8);
      __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":335
 *                 resizable = 0
 * 
 *         if opengl:             # <<<<<<<<<<<<<<
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 */
  }

  /* "renpy/gl/gldraw.pyx":339
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 * 
 *         self.window = None             # <<<<<<<<<<<<<<
 * 
 *         if (self.window is None) and fullscreen:
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->window);
  __Pyx_DECREF(__pyx_v_self->window);
  __pyx_v_self->window = Py_None;

  /* "renpy/gl/gldraw.pyx":341
 *         self.window = None
 * 
 *         if (self.window is None) and fullscreen:             # <<<<<<<<<<<<<<
 *             try:
 *                 renpy.display.log.write("Fullscreen mode.")
 */
  __pyx_t_4 = (__pyx_v_self->window == Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_8 = __pyx_t_3;
    goto __pyx_L35_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_fullscreen); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 341, __pyx_L1_error)
  __pyx_t_8 = __pyx_t_3;
  __pyx_L35_bool_binop_done:;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":342
 * 
 *         if (self.window is None) and fullscreen:
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      /*try:*/ {

        /* "renpy/gl/gldraw.pyx":343
 *         if (self.window is None) and fullscreen:
 *             try:
 *                 renpy.display.log.write("Fullscreen mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 *             except pygame.error as e:
 */
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 343, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_display); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 343, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 343, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "renpy/gl/gldraw.pyx":344
 *             try:
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 *             except pygame.error as e:
 *                 renpy.display.log.write("Opening in fullscreen failed: %r", e)
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_set_mode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_WINDOW_FULLSCREEN_DESKTOP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Or(__pyx_t_1, __pyx_v_resizable); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Or(__pyx_t_5, __pyx_v_opengl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_DOUBLEBUF); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Or(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 344, __pyx_L37_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_tuple__8, __pyx_t_5};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 344, __pyx_L37_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_tuple__8, __pyx_t_5};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 344, __pyx_L37_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L37_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_INCREF(__pyx_tuple__8);
          __Pyx_GIVEREF(__pyx_tuple__8);
          PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_tuple__8);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 344, __pyx_L37_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GIVEREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_v_self->window);
        __Pyx_DECREF(__pyx_v_self->window);
        __pyx_v_self->window = __pyx_t_6;
        __pyx_t_6 = 0;

        /* "renpy/gl/gldraw.pyx":342
 * 
 *         if (self.window is None) and fullscreen:
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 */
      }
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L42_try_end;
      __pyx_L37_error:;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":345
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 *             except pygame.error as e:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Opening in fullscreen failed: %r", e)
 *                 self.window = None
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L39_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L39_except_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_10) {
        __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 345, __pyx_L39_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_v_e = __pyx_t_6;

        /* "renpy/gl/gldraw.pyx":346
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 *             except pygame.error as e:
 *                 renpy.display.log.write("Opening in fullscreen failed: %r", e)             # <<<<<<<<<<<<<<
 *                 self.window = None
 * 
 */
        __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L39_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L39_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L39_except_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L39_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_kp_s_Opening_in_fullscreen_failed_r, __pyx_v_e};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L39_except_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_kp_s_Opening_in_fullscreen_failed_r, __pyx_v_e};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L39_except_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 346, __pyx_L39_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Opening_in_fullscreen_failed_r);
          __Pyx_GIVEREF(__pyx_kp_s_Opening_in_fullscreen_failed_r);
          PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_10, __pyx_kp_s_Opening_in_fullscreen_failed_r);
          __Pyx_INCREF(__pyx_v_e);
          __Pyx_GIVEREF(__pyx_v_e);
          PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_10, __pyx_v_e);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L39_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/gl/gldraw.pyx":347
 *             except pygame.error as e:
 *                 renpy.display.log.write("Opening in fullscreen failed: %r", e)
 *                 self.window = None             # <<<<<<<<<<<<<<
 * 
 *         if self.window is None:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->window);
        __Pyx_DECREF(__pyx_v_self->window);
        __pyx_v_self->window = Py_None;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L38_exception_handled;
      }
      goto __pyx_L39_except_error;
      __pyx_L39_except_error:;

      /* "renpy/gl/gldraw.pyx":342
 * 
 *         if (self.window is None) and fullscreen:
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 */
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      goto __pyx_L1_error;
      __pyx_L38_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __pyx_L42_try_end:;
    }

    /* "renpy/gl/gldraw.pyx":341
 *         self.window = None
 * 
 *         if (self.window is None) and fullscreen:             # <<<<<<<<<<<<<<
 *             try:
 *                 renpy.display.log.write("Fullscreen mode.")
 */
  }

  /* "renpy/gl/gldraw.pyx":349
 *                 self.window = None
 * 
 *         if self.window is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 renpy.display.log.write("Windowed mode.")
 */
  __pyx_t_8 = (__pyx_v_self->window == Py_None);
  __pyx_t_3 = (__pyx_t_8 != 0);
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":350
 * 
 *         if self.window is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Windowed mode.")
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      /*try:*/ {

        /* "renpy/gl/gldraw.pyx":351
 *         if self.window is None:
 *             try:
 *                 renpy.display.log.write("Windowed mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)
 * 
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "renpy/gl/gldraw.pyx":352
 *             try:
 *                 renpy.display.log.write("Windowed mode.")
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)             # <<<<<<<<<<<<<<
 * 
 *             except pygame.error, e:
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_set_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_pwidth);
        __Pyx_GIVEREF(__pyx_v_pwidth);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_pwidth);
        __Pyx_INCREF(__pyx_v_pheight);
        __Pyx_GIVEREF(__pyx_v_pheight);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_pheight);
        __pyx_t_7 = PyNumber_Or(__pyx_v_resizable, __pyx_v_opengl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_DOUBLEBUF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Or(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
        __pyx_t_6 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_window_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_v_self->window);
        __Pyx_DECREF(__pyx_v_self->window);
        __pyx_v_self->window = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "renpy/gl/gldraw.pyx":350
 * 
 *         if self.window is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Windowed mode.")
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)
 */
      }
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L51_try_end;
      __pyx_L46_error:;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/gl/gldraw.pyx":354
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)
 * 
 *             except pygame.error, e:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Could not get pygame screen: %r", e)
 *                 return False
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 354, __pyx_L48_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L48_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_10) {
        __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 354, __pyx_L48_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_5);

        /* "renpy/gl/gldraw.pyx":355
 * 
 *             except pygame.error, e:
 *                 renpy.display.log.write("Could not get pygame screen: %r", e)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 355, __pyx_L48_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_display); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 355, __pyx_L48_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 355, __pyx_L48_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_write); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 355, __pyx_L48_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Could_not_get_pygame_screen_r, __pyx_v_e};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L48_except_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Could_not_get_pygame_screen_r, __pyx_v_e};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L48_except_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 355, __pyx_L48_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_7) {
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_s_Could_not_get_pygame_screen_r);
          __Pyx_GIVEREF(__pyx_kp_s_Could_not_get_pygame_screen_r);
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_10, __pyx_kp_s_Could_not_get_pygame_screen_r);
          __Pyx_INCREF(__pyx_v_e);
          __Pyx_GIVEREF(__pyx_v_e);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_10, __pyx_v_e);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L48_except_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "renpy/gl/gldraw.pyx":356
 *             except pygame.error, e:
 *                 renpy.display.log.write("Could not get pygame screen: %r", e)
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Use EGL to get the OpenGL ES 2 context, if necessary.
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L49_except_return;
      }
      goto __pyx_L48_except_error;
      __pyx_L48_except_error:;

      /* "renpy/gl/gldraw.pyx":350
 * 
 *         if self.window is None:
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Windowed mode.")
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)
 */
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      goto __pyx_L1_error;
      __pyx_L49_except_return:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      goto __pyx_L0;
      __pyx_L51_try_end:;
    }

    /* "renpy/gl/gldraw.pyx":349
 *                 self.window = None
 * 
 *         if self.window is None:             # <<<<<<<<<<<<<<
 *             try:
 *                 renpy.display.log.write("Windowed mode.")
 */
  }

  /* "renpy/gl/gldraw.pyx":359
 * 
 *         # Use EGL to get the OpenGL ES 2 context, if necessary.
 *         if EGL:             # <<<<<<<<<<<<<<
 * 
 *             # This ensures the display is shown.
 */
  __pyx_t_3 = (__pyx_v_5renpy_2gl_6gldraw_EGL != 0);
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":362
 * 
 *             # This ensures the display is shown.
 *             pygame.display.flip()             # <<<<<<<<<<<<<<
 * 
 *             egl_error = egl_init(PyWindow_AsWindow(None), vsync)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_flip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":364
 *             pygame.display.flip()
 * 
 *             egl_error = egl_init(PyWindow_AsWindow(None), vsync)             # <<<<<<<<<<<<<<
 * 
 *             if egl_error is not NULL:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vsync); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 364, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_egl_error = egl_init(PyWindow_AsWindow(Py_None), __pyx_t_10);

    /* "renpy/gl/gldraw.pyx":366
 *             egl_error = egl_init(PyWindow_AsWindow(None), vsync)
 * 
 *             if egl_error is not NULL:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)
 *                 return False
 */
    __pyx_t_3 = ((__pyx_v_egl_error != NULL) != 0);
    if (__pyx_t_3) {

      /* "renpy/gl/gldraw.pyx":367
 * 
 *             if egl_error is not NULL:
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_egl_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Initializing_EGL_s, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 367, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":368
 *             if egl_error is not NULL:
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Get the size of the created screen.
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":366
 *             egl_error = egl_init(PyWindow_AsWindow(None), vsync)
 * 
 *             if egl_error is not NULL:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)
 *                 return False
 */
    }

    /* "renpy/gl/gldraw.pyx":359
 * 
 *         # Use EGL to get the OpenGL ES 2 context, if necessary.
 *         if EGL:             # <<<<<<<<<<<<<<
 * 
 *             # This ensures the display is shown.
 */
  }

  /* "renpy/gl/gldraw.pyx":371
 * 
 *         # Get the size of the created screen.
 *         pwidth, pheight = self.window.get_size()             # <<<<<<<<<<<<<<
 * 
 *         self.physical_size = (pwidth, pheight)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->window, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_16) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 371, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_16 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_16);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L56_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_16 = __pyx_t_9(__pyx_t_6); if (unlikely(!__pyx_t_16)) goto __pyx_L56_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_16);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_6), 2) < 0) __PYX_ERR(0, 371, __pyx_L1_error)
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L57_unpacking_done;
    __pyx_L56_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 371, __pyx_L1_error)
    __pyx_L57_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_16);
  __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":373
 *         pwidth, pheight = self.window.get_size()
 * 
 *         self.physical_size = (pwidth, pheight)             # <<<<<<<<<<<<<<
 *         self.drawable_size = pygame.display.get_drawable_size()
 * 
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_pwidth);
  __Pyx_GIVEREF(__pyx_v_pwidth);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pwidth);
  __Pyx_INCREF(__pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_v_pheight);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(__pyx_v_self->physical_size);
  __pyx_v_self->physical_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":374
 * 
 *         self.physical_size = (pwidth, pheight)
 *         self.drawable_size = pygame.display.get_drawable_size()             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Screen sizes: virtual=%r physical=%r drawable=%r" % (self.virtual_size, self.physical_size, self.drawable_size))
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_drawable_size); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->drawable_size);
  __Pyx_DECREF(__pyx_v_self->drawable_size);
  __pyx_v_self->drawable_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":376
 *         self.drawable_size = pygame.display.get_drawable_size()
 * 
 *         renpy.display.log.write("Screen sizes: virtual=%r physical=%r drawable=%r" % (self.virtual_size, self.physical_size, self.drawable_size))             # <<<<<<<<<<<<<<
 * 
 *         if renpy.config.adjust_view_size is not None:
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_INCREF(__pyx_v_self->virtual_size);
  __Pyx_GIVEREF(__pyx_v_self->virtual_size);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_self->virtual_size);
  __Pyx_INCREF(__pyx_v_self->physical_size);
  __Pyx_GIVEREF(__pyx_v_self->physical_size);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_self->physical_size);
  __Pyx_INCREF(__pyx_v_self->drawable_size);
  __Pyx_GIVEREF(__pyx_v_self->drawable_size);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_self->drawable_size);
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Screen_sizes_virtual_r_physical, __pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_16) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16); __pyx_t_16 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":378
 *         renpy.display.log.write("Screen sizes: virtual=%r physical=%r drawable=%r" % (self.virtual_size, self.physical_size, self.drawable_size))
 * 
 *         if renpy.config.adjust_view_size is not None:             # <<<<<<<<<<<<<<
 *             view_width, view_height = renpy.config.adjust_view_size(pwidth, pheight)
 *         else:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_adjust_view_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (__pyx_t_3 != 0);
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":379
 * 
 *         if renpy.config.adjust_view_size is not None:
 *             view_width, view_height = renpy.config.adjust_view_size(pwidth, pheight)             # <<<<<<<<<<<<<<
 *         else:
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_config); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_adjust_view_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_pwidth, __pyx_v_pheight};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_pwidth, __pyx_v_pheight};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_pwidth);
      __Pyx_GIVEREF(__pyx_v_pwidth);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_v_pwidth);
      __Pyx_INCREF(__pyx_v_pheight);
      __Pyx_GIVEREF(__pyx_v_pheight);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_v_pheight);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 379, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L59_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L59_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_5), 2) < 0) __PYX_ERR(0, 379, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L60_unpacking_done;
      __pyx_L59_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 379, __pyx_L1_error)
      __pyx_L60_unpacking_done:;
    }
    __pyx_v_view_width = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_view_height = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":378
 *         renpy.display.log.write("Screen sizes: virtual=%r physical=%r drawable=%r" % (self.virtual_size, self.physical_size, self.drawable_size))
 * 
 *         if renpy.config.adjust_view_size is not None:             # <<<<<<<<<<<<<<
 *             view_width, view_height = renpy.config.adjust_view_size(pwidth, pheight)
 *         else:
 */
    goto __pyx_L58;
  }

  /* "renpy/gl/gldraw.pyx":384
 *             # Figure out the virtual box, which includes padding around
 *             # the borders.
 *             physical_ar = 1.0 * pwidth / pheight             # <<<<<<<<<<<<<<
 * 
 *             ratio = min(1.0 * pwidth / vwidth, 1.0 * pheight / vheight)
 */
  /*else*/ {
    __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_pwidth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_pheight); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_physical_ar = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":386
 *             physical_ar = 1.0 * pwidth / pheight
 * 
 *             ratio = min(1.0 * pwidth / vwidth, 1.0 * pheight / vheight)             # <<<<<<<<<<<<<<
 * 
 *             view_width = max(int(vwidth * ratio), 1)
 */
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_pheight); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_vheight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_pwidth); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_vwidth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 386, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 386, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_6 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = __pyx_t_2;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_ratio = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":388
 *             ratio = min(1.0 * pwidth / vwidth, 1.0 * pheight / vheight)
 * 
 *             view_width = max(int(vwidth * ratio), 1)             # <<<<<<<<<<<<<<
 *             view_height = max(int(vheight * ratio), 1)
 * 
 */
    __pyx_t_11 = 1;
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_vwidth, __pyx_v_ratio); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_1 = __pyx_t_6;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __pyx_t_1;
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_view_width = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":389
 * 
 *             view_width = max(int(vwidth * ratio), 1)
 *             view_height = max(int(vheight * ratio), 1)             # <<<<<<<<<<<<<<
 * 
 *         px_padding = pwidth - view_width
 */
    __pyx_t_11 = 1;
    __pyx_t_6 = PyNumber_Multiply(__pyx_v_vheight, __pyx_v_ratio); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 389, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_6 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_view_height = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L58:;

  /* "renpy/gl/gldraw.pyx":391
 *             view_height = max(int(vheight * ratio), 1)
 * 
 *         px_padding = pwidth - view_width             # <<<<<<<<<<<<<<
 *         py_padding = pheight - view_height
 * 
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_pwidth, __pyx_v_view_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_px_padding = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":392
 * 
 *         px_padding = pwidth - view_width
 *         py_padding = pheight - view_height             # <<<<<<<<<<<<<<
 * 
 *         x_padding = px_padding * vwidth / view_width
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_pheight, __pyx_v_view_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_py_padding = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":394
 *         py_padding = pheight - view_height
 * 
 *         x_padding = px_padding * vwidth / view_width             # <<<<<<<<<<<<<<
 *         y_padding = py_padding * vheight / view_height
 * 
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_px_padding, __pyx_v_vwidth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_view_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_x_padding = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":395
 * 
 *         x_padding = px_padding * vwidth / view_width
 *         y_padding = py_padding * vheight / view_height             # <<<<<<<<<<<<<<
 * 
 *         # The position of the physical screen, in virtual pixels
 */
  __pyx_t_6 = PyNumber_Multiply(__pyx_v_py_padding, __pyx_v_vheight); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_view_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_y_padding = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":402
 *         # screen.
 *         self.virtual_box = (
 *             -x_padding / 2.0,             # <<<<<<<<<<<<<<
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 */
  __pyx_t_1 = PyNumber_Negative(__pyx_v_x_padding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":403
 *         self.virtual_box = (
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,             # <<<<<<<<<<<<<<
 *              vwidth + x_padding,
 *              vheight + y_padding)
 */
  __pyx_t_1 = PyNumber_Negative(__pyx_v_y_padding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_2_0, 2.0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":404
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,
 *              vwidth + x_padding,             # <<<<<<<<<<<<<<
 *              vheight + y_padding)
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_vwidth, __pyx_v_x_padding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "renpy/gl/gldraw.pyx":405
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 *              vheight + y_padding)             # <<<<<<<<<<<<<<
 * 
 *         # The location of the virtual screen on the physical screen, in
 */
  __pyx_t_5 = PyNumber_Add(__pyx_v_vheight, __pyx_v_y_padding); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "renpy/gl/gldraw.pyx":402
 *         # screen.
 *         self.virtual_box = (
 *             -x_padding / 2.0,             # <<<<<<<<<<<<<<
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 */
  __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_5);
  __pyx_t_6 = 0;
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":401
 *         # the virtual screen, the corners are often off the virtual
 *         # screen.
 *         self.virtual_box = (             # <<<<<<<<<<<<<<
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,
 */
  __Pyx_GIVEREF(__pyx_t_16);
  __Pyx_GOTREF(__pyx_v_self->virtual_box);
  __Pyx_DECREF(__pyx_v_self->virtual_box);
  __pyx_v_self->virtual_box = ((PyObject*)__pyx_t_16);
  __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":411
 *         # enough for screenshots.)
 *         self.physical_box = (
 *             int(px_padding / 2),             # <<<<<<<<<<<<<<
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),
 */
  __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_v_px_padding, __pyx_int_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":412
 *         self.physical_box = (
 *             int(px_padding / 2),
 *             int(py_padding / 2),             # <<<<<<<<<<<<<<
 *             pwidth - int(px_padding),
 *             pheight - int(py_padding),
 */
  __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_v_py_padding, __pyx_int_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":413
 *             int(px_padding / 2),
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),             # <<<<<<<<<<<<<<
 *             pheight - int(py_padding),
 *             )
 */
  __pyx_t_16 = __Pyx_PyNumber_Int(__pyx_v_px_padding); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_pwidth, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":414
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),
 *             pheight - int(py_padding),             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __pyx_t_16 = __Pyx_PyNumber_Int(__pyx_v_py_padding); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = PyNumber_Subtract(__pyx_v_pheight, __pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":411
 *         # enough for screenshots.)
 *         self.physical_box = (
 *             int(px_padding / 2),             # <<<<<<<<<<<<<<
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),
 */
  __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":410
 *         # physical pixels. (May not be 100% accurate, but it's good
 *         # enough for screenshots.)
 *         self.physical_box = (             # <<<<<<<<<<<<<<
 *             int(px_padding / 2),
 *             int(py_padding / 2),
 */
  __Pyx_GIVEREF(__pyx_t_16);
  __Pyx_GOTREF(__pyx_v_self->physical_box);
  __Pyx_DECREF(__pyx_v_self->physical_box);
  __pyx_v_self->physical_box = ((PyObject*)__pyx_t_16);
  __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":418
 * 
 *         # Scale from the rtt size to the virtual size.
 *         if renpy.config.use_drawable_resolution:             # <<<<<<<<<<<<<<
 *             self.draw_per_virt = (1.0 * self.drawable_size[0] / pwidth) * (1.0 * view_width / vwidth)
 *         else:
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_config); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_use_drawable_resolution); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":419
 *         # Scale from the rtt size to the virtual size.
 *         if renpy.config.use_drawable_resolution:
 *             self.draw_per_virt = (1.0 * self.drawable_size[0] / pwidth) * (1.0 * view_width / vwidth)             # <<<<<<<<<<<<<<
 *         else:
 *             self.draw_per_virt = 1.0
 */
    if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 419, __pyx_L1_error)
    }
    __pyx_t_16 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_pwidth); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_view_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_vwidth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_self->draw_per_virt);
    __Pyx_DECREF(__pyx_v_self->draw_per_virt);
    __pyx_v_self->draw_per_virt = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":418
 * 
 *         # Scale from the rtt size to the virtual size.
 *         if renpy.config.use_drawable_resolution:             # <<<<<<<<<<<<<<
 *             self.draw_per_virt = (1.0 * self.drawable_size[0] / pwidth) * (1.0 * view_width / vwidth)
 *         else:
 */
    goto __pyx_L61;
  }

  /* "renpy/gl/gldraw.pyx":421
 *             self.draw_per_virt = (1.0 * self.drawable_size[0] / pwidth) * (1.0 * view_width / vwidth)
 *         else:
 *             self.draw_per_virt = 1.0             # <<<<<<<<<<<<<<
 * 
 *         self.virt_to_draw = Matrix2D(self.draw_per_virt, 0, 0, self.draw_per_virt)
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_float_1_0);
    __Pyx_GIVEREF(__pyx_float_1_0);
    __Pyx_GOTREF(__pyx_v_self->draw_per_virt);
    __Pyx_DECREF(__pyx_v_self->draw_per_virt);
    __pyx_v_self->draw_per_virt = __pyx_float_1_0;
  }
  __pyx_L61:;

  /* "renpy/gl/gldraw.pyx":423
 *             self.draw_per_virt = 1.0
 * 
 *         self.virt_to_draw = Matrix2D(self.draw_per_virt, 0, 0, self.draw_per_virt)             # <<<<<<<<<<<<<<
 *         self.draw_to_virt = Matrix2D(1.0 / self.draw_per_virt, 0, 0, 1.0 / self.draw_per_virt)
 * 
 */
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_self->draw_per_virt);
  __Pyx_GIVEREF(__pyx_v_self->draw_per_virt);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self->draw_per_virt);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_0);
  __Pyx_INCREF(__pyx_v_self->draw_per_virt);
  __Pyx_GIVEREF(__pyx_v_self->draw_per_virt);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_self->draw_per_virt);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->virt_to_draw);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->virt_to_draw));
  __pyx_v_self->virt_to_draw = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":424
 * 
 *         self.virt_to_draw = Matrix2D(self.draw_per_virt, 0, 0, self.draw_per_virt)
 *         self.draw_to_virt = Matrix2D(1.0 / self.draw_per_virt, 0, 0, 1.0 / self.draw_per_virt)             # <<<<<<<<<<<<<<
 * 
 *         if not self.did_init:
 */
  __pyx_t_2 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_v_self->draw_per_virt, 1.0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_v_self->draw_per_virt, 1.0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_6);
  __pyx_t_2 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D), __pyx_t_16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_GOTREF(__pyx_v_self->draw_to_virt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->draw_to_virt));
  __pyx_v_self->draw_to_virt = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":426
 *         self.draw_to_virt = Matrix2D(1.0 / self.draw_per_virt, 0, 0, 1.0 / self.draw_per_virt)
 * 
 *         if not self.did_init:             # <<<<<<<<<<<<<<
 *             if not self.init():
 *                 return False
 */
  __pyx_t_8 = ((!(__pyx_v_self->did_init != 0)) != 0);
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":427
 * 
 *         if not self.did_init:
 *             if not self.init():             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 427, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_3 = ((!__pyx_t_8) != 0);
    if (__pyx_t_3) {

      /* "renpy/gl/gldraw.pyx":428
 *         if not self.did_init:
 *             if not self.init():
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         if "RENPY_FAIL_" + self.info["renderer"].upper() in os.environ:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":427
 * 
 *         if not self.did_init:
 *             if not self.init():             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    }

    /* "renpy/gl/gldraw.pyx":426
 *         self.draw_to_virt = Matrix2D(1.0 / self.draw_per_virt, 0, 0, 1.0 / self.draw_per_virt)
 * 
 *         if not self.did_init:             # <<<<<<<<<<<<<<
 *             if not self.init():
 *                 return False
 */
  }

  /* "renpy/gl/gldraw.pyx":430
 *                 return False
 * 
 *         if "RENPY_FAIL_" + self.info["renderer"].upper() in os.environ:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  if (unlikely(__pyx_v_self->info == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 430, __pyx_L1_error)
  }
  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_self->info, __pyx_n_s_renderer); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_16) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_n_s_RENPY_FAIL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_environ); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_16, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_8 = (__pyx_t_3 != 0);
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":431
 * 
 *         if "RENPY_FAIL_" + self.info["renderer"].upper() in os.environ:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         self.did_init = True
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":430
 *                 return False
 * 
 *         if "RENPY_FAIL_" + self.info["renderer"].upper() in os.environ:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":433
 *             return False
 * 
 *         self.did_init = True             # <<<<<<<<<<<<<<
 * 
 *         # Set some default settings.
 */
  __pyx_v_self->did_init = 1;

  /* "renpy/gl/gldraw.pyx":436
 * 
 *         # Set some default settings.
 *         glEnable(GL_BLEND)             # <<<<<<<<<<<<<<
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
 * 
 */
  __pyx_t_10 = __pyx_f_5renpy_2gl_2gl_glEnable(GL_BLEND); if (unlikely(__pyx_t_10 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 436, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":437
 *         # Set some default settings.
 *         glEnable(GL_BLEND)
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)             # <<<<<<<<<<<<<<
 * 
 *         # Prepare a mouse display.
 */
  __pyx_t_10 = __pyx_f_5renpy_2gl_2gl_glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); if (unlikely(__pyx_t_10 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":440
 * 
 *         # Prepare a mouse display.
 *         self.mouse_old_visible = None             # <<<<<<<<<<<<<<
 * 
 *         self.environ.init()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->mouse_old_visible);
  __Pyx_DECREF(__pyx_v_self->mouse_old_visible);
  __pyx_v_self->mouse_old_visible = Py_None;

  /* "renpy/gl/gldraw.pyx":442
 *         self.mouse_old_visible = None
 * 
 *         self.environ.init()             # <<<<<<<<<<<<<<
 *         self.rtt.init()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 442, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":443
 * 
 *         self.environ.init()
 *         self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         if self.window.get_flags() & pygame.WINDOW_MAXIMIZED:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 443, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

  /* "renpy/gl/gldraw.pyx":445
 *         self.rtt.init()
 * 
 *         if self.window.get_flags() & pygame.WINDOW_MAXIMIZED:             # <<<<<<<<<<<<<<
 *             self.info["max_window_size"] = self.window.get_size()
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->window, __pyx_n_s_get_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 445, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_WINDOW_MAXIMIZED); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_And(__pyx_t_16, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":446
 * 
 *         if self.window.get_flags() & pygame.WINDOW_MAXIMIZED:
 *             self.info["max_window_size"] = self.window.get_size()             # <<<<<<<<<<<<<<
 *         else:
 *             self.info["max_window_size"] = (
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->window, __pyx_n_s_get_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_16) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v_self->info == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 446, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_max_window_size, __pyx_t_2) < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":445
 *         self.rtt.init()
 * 
 *         if self.window.get_flags() & pygame.WINDOW_MAXIMIZED:             # <<<<<<<<<<<<<<
 *             self.info["max_window_size"] = self.window.get_size()
 *         else:
 */
    goto __pyx_L65;
  }

  /* "renpy/gl/gldraw.pyx":449
 *         else:
 *             self.info["max_window_size"] = (
 *                 int(round(min(bound_h * virtual_ar, bound_w))),             # <<<<<<<<<<<<<<
 *                 int(round(min(bound_w / virtual_ar, bound_h))),
 *                 )
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_bound_w);
    __pyx_t_2 = __pyx_v_bound_w;
    __pyx_t_6 = PyNumber_Multiply(__pyx_v_bound_h, __pyx_v_virtual_ar); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_16 = __pyx_t_2;
    } else {
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_16 = __pyx_t_6;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_16);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

    /* "renpy/gl/gldraw.pyx":450
 *             self.info["max_window_size"] = (
 *                 int(round(min(bound_h * virtual_ar, bound_w))),
 *                 int(round(min(bound_w / virtual_ar, bound_h))),             # <<<<<<<<<<<<<<
 *                 )
 * 
 */
    __Pyx_INCREF(__pyx_v_bound_h);
    __pyx_t_16 = __pyx_v_bound_h;
    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_bound_w, __pyx_v_virtual_ar); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_16, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {
      __Pyx_INCREF(__pyx_t_16);
      __pyx_t_1 = __pyx_t_16;
    } else {
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_1 = __pyx_t_6;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":449
 *         else:
 *             self.info["max_window_size"] = (
 *                 int(round(min(bound_h * virtual_ar, bound_w))),             # <<<<<<<<<<<<<<
 *                 int(round(min(bound_w / virtual_ar, bound_h))),
 *                 )
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_16);
    __pyx_t_2 = 0;
    __pyx_t_16 = 0;

    /* "renpy/gl/gldraw.pyx":448
 *             self.info["max_window_size"] = self.window.get_size()
 *         else:
 *             self.info["max_window_size"] = (             # <<<<<<<<<<<<<<
 *                 int(round(min(bound_h * virtual_ar, bound_w))),
 *                 int(round(min(bound_w / virtual_ar, bound_h))),
 */
    if (unlikely(__pyx_v_self->info == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 448, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_max_window_size, __pyx_t_1) < 0)) __PYX_ERR(0, 448, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L65:;

  /* "renpy/gl/gldraw.pyx":453
 *                 )
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def quit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":169
 * 
 * 
 *     def set_mode(self, virtual_size, physical_size, fullscreen):             # <<<<<<<<<<<<<<
 *         """
 *         This changes the video mode. It also initializes OpenGL, if it
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_main_window);
  __Pyx_XDECREF(__pyx_v_vwidth);
  __Pyx_XDECREF(__pyx_v_vheight);
  __Pyx_XDECREF(__pyx_v_pwidth);
  __Pyx_XDECREF(__pyx_v_pheight);
  __Pyx_XDECREF(__pyx_v_virtual_ar);
  __Pyx_XDECREF(__pyx_v_window_args);
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_v_old_surface);
  __Pyx_XDECREF(__pyx_v_maximized);
  __Pyx_XDECREF(__pyx_v_visible_w);
  __Pyx_XDECREF(__pyx_v_visible_h);
  __Pyx_XDECREF(__pyx_v_bounds);
  __Pyx_XDECREF(__pyx_v_head_full_w);
  __Pyx_XDECREF(__pyx_v_head_w);
  __Pyx_XDECREF(__pyx_v_head_h);
  __Pyx_XDECREF(__pyx_v_bound_w);
  __Pyx_XDECREF(__pyx_v_bound_h);
  __Pyx_XDECREF(__pyx_v_target_framerate);
  __Pyx_XDECREF(__pyx_v_refresh_rate);
  __Pyx_XDECREF(__pyx_v_sync_frames);
  __Pyx_XDECREF(__pyx_v_opengl);
  __Pyx_XDECREF(__pyx_v_resizable);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_view_width);
  __Pyx_XDECREF(__pyx_v_view_height);
  __Pyx_XDECREF(__pyx_v_physical_ar);
  __Pyx_XDECREF(__pyx_v_ratio);
  __Pyx_XDECREF(__pyx_v_px_padding);
  __Pyx_XDECREF(__pyx_v_py_padding);
  __Pyx_XDECREF(__pyx_v_x_padding);
  __Pyx_XDECREF(__pyx_v_y_padding);
  __Pyx_XDECREF(__pyx_v_fullscreen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":455
 *         return True
 * 
 *     def quit(self):             # <<<<<<<<<<<<<<
 *         """
 *         This shuts down the module and all use of the GL context.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_7quit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_6quit[] = "\n        This shuts down the module and all use of the GL context.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_7quit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quit (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_6quit(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_6quit(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("quit", 0);

  /* "renpy/gl/gldraw.pyx":460
 *         """
 * 
 *         self.kill_textures()             # <<<<<<<<<<<<<<
 * 
 *         if self.rtt:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kill_textures); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":462
 *         self.kill_textures()
 * 
 *         if self.rtt:             # <<<<<<<<<<<<<<
 *             self.rtt.deinit()
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->rtt); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 462, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":463
 * 
 *         if self.rtt:
 *             self.rtt.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if self.environ:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s_deinit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":462
 *         self.kill_textures()
 * 
 *         if self.rtt:             # <<<<<<<<<<<<<<
 *             self.rtt.deinit()
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":465
 *             self.rtt.deinit()
 * 
 *         if self.environ:             # <<<<<<<<<<<<<<
 *             self.environ.deinit()
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->environ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 465, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":466
 * 
 *         if self.environ:
 *             self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if not self.old_fullscreen:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_deinit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":465
 *             self.rtt.deinit()
 * 
 *         if self.environ:             # <<<<<<<<<<<<<<
 *             self.environ.deinit()
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":468
 *             self.environ.deinit()
 * 
 *         if not self.old_fullscreen:             # <<<<<<<<<<<<<<
 *             renpy.display.gl_size = self.physical_size
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->old_fullscreen); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 468, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "renpy/gl/gldraw.pyx":469
 * 
 *         if not self.old_fullscreen:
 *             renpy.display.gl_size = self.physical_size             # <<<<<<<<<<<<<<
 * 
 *         gltexture.dealloc_textures()
 */
    __pyx_t_1 = __pyx_v_self->physical_size;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_3, __pyx_n_s_gl_size, __pyx_t_1) < 0) __PYX_ERR(0, 469, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":468
 *             self.environ.deinit()
 * 
 *         if not self.old_fullscreen:             # <<<<<<<<<<<<<<
 *             renpy.display.gl_size = self.physical_size
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":471
 *             renpy.display.gl_size = self.physical_size
 * 
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *         self.old_fullscreen = None
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dealloc_textures); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":473
 *         gltexture.dealloc_textures()
 * 
 *         self.old_fullscreen = None             # <<<<<<<<<<<<<<
 * 
 *     def init(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->old_fullscreen);
  __Pyx_DECREF(__pyx_v_self->old_fullscreen);
  __pyx_v_self->old_fullscreen = Py_None;

  /* "renpy/gl/gldraw.pyx":455
 *         return True
 * 
 *     def quit(self):             # <<<<<<<<<<<<<<
 *         """
 *         This shuts down the module and all use of the GL context.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.quit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":475
 *         self.old_fullscreen = None
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_9init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_8init[] = "\n        This does the first-time initialization of OpenGL, deciding\n        which subsystems to use.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_9init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8init(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":536
 *             renpy.display.log.write("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4init_1use_subsystem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_4init_use_subsystem[] = "\n            Decides if we should used a particular subsystem, based on\n            environment variables and/or extensions. If the `envvar`\n            environment variable exists, this will return true iff\n            its value is `envval`. Otherwise, this will return true if\n            all of the required extensions are present, and false\n            otherwise.\n            ";
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_4init_1use_subsystem = {"use_subsystem", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4init_1use_subsystem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_4init_use_subsystem};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4init_1use_subsystem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_module = 0;
  PyObject *__pyx_v_envvar = 0;
  PyObject *__pyx_v_envval = 0;
  PyObject *__pyx_v_req_ext = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("use_subsystem (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 3) {
    __pyx_v_req_ext = PyTuple_GetSlice(__pyx_args, 3, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_req_ext)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_req_ext);
  } else {
    __pyx_v_req_ext = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_module,&__pyx_n_s_envvar,&__pyx_n_s_envval,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_module)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_envvar)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("use_subsystem", 0, 3, 3, 1); __PYX_ERR(0, 536, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_envval)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("use_subsystem", 0, 3, 3, 2); __PYX_ERR(0, 536, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 3) ? pos_args : 3;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "use_subsystem") < 0)) __PYX_ERR(0, 536, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_module = values[0];
    __pyx_v_envvar = values[1];
    __pyx_v_envval = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("use_subsystem", 0, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 536, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_req_ext); __pyx_v_req_ext = 0;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init.use_subsystem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4init_use_subsystem(__pyx_self, __pyx_v_module, __pyx_v_envvar, __pyx_v_envval, __pyx_v_req_ext);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_req_ext);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_envvar, PyObject *__pyx_v_envval, PyObject *__pyx_v_req_ext) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *__pyx_cur_scope;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *__pyx_outer_scope;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  __Pyx_RefNannySetupContext("use_subsystem", 0);
  __pyx_outer_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "renpy/gl/gldraw.pyx":546
 *             """
 * 
 *             if module is None:             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_t_1 = (__pyx_v_module == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":547
 * 
 *             if module is None:
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             value = os.environ.get(envvar, "")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":546
 *             """
 * 
 *             if module is None:             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":549
 *                 return False
 * 
 *             value = os.environ.get(envvar, "")             # <<<<<<<<<<<<<<
 *             if value:
 *                 if value == envval:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_environ); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_envvar, __pyx_kp_s__3};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_envvar, __pyx_kp_s__3};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_envvar);
    __Pyx_GIVEREF(__pyx_v_envvar);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_envvar);
    __Pyx_INCREF(__pyx_kp_s__3);
    __Pyx_GIVEREF(__pyx_kp_s__3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_kp_s__3);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_value = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":550
 * 
 *             value = os.environ.get(envvar, "")
 *             if value:             # <<<<<<<<<<<<<<
 *                 if value == envval:
 *                     return True
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 550, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":551
 *             value = os.environ.get(envvar, "")
 *             if value:
 *                 if value == envval:             # <<<<<<<<<<<<<<
 *                     return True
 *                 else:
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, __pyx_v_envval, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 551, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "renpy/gl/gldraw.pyx":552
 *             if value:
 *                 if value == envval:
 *                     return True             # <<<<<<<<<<<<<<
 *                 else:
 *                     return False
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":551
 *             value = os.environ.get(envvar, "")
 *             if value:
 *                 if value == envval:             # <<<<<<<<<<<<<<
 *                     return True
 *                 else:
 */
    }

    /* "renpy/gl/gldraw.pyx":554
 *                     return True
 *                 else:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *             for i in req_ext:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;
    }

    /* "renpy/gl/gldraw.pyx":550
 * 
 *             value = os.environ.get(envvar, "")
 *             if value:             # <<<<<<<<<<<<<<
 *                 if value == envval:
 *                     return True
 */
  }

  /* "renpy/gl/gldraw.pyx":556
 *                     return False
 * 
 *             for i in req_ext:             # <<<<<<<<<<<<<<
 *                 if i not in extensions:
 *                     return False
 */
  __pyx_t_3 = __pyx_v_req_ext; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 556, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":557
 * 
 *             for i in req_ext:
 *                 if i not in extensions:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_extensions)) { __Pyx_RaiseClosureNameError("extensions"); __PYX_ERR(0, 557, __pyx_L1_error) }
    __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_i, __pyx_cur_scope->__pyx_v_extensions, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 557, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":558
 *             for i in req_ext:
 *                 if i not in extensions:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *             return True
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":557
 * 
 *             for i in req_ext:
 *                 if i not in extensions:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
    }

    /* "renpy/gl/gldraw.pyx":556
 *                     return False
 * 
 *             for i in req_ext:             # <<<<<<<<<<<<<<
 *                 if i not in extensions:
 *                     return False
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":560
 *                     return False
 * 
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # Count the number of texture units.
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":536
 *             renpy.display.log.write("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init.use_subsystem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":475
 *         self.old_fullscreen = None
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8init(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *__pyx_cur_scope;
  GLenum __pyx_v_err;
  char *__pyx_v_renderer;
  char *__pyx_v_version;
  int __pyx_v_allow_shader;
  int __pyx_v_allow_fixed;
  char *__pyx_v_extensions_string;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_use_subsystem = 0;
  GLint __pyx_v_texture_units;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_use_fbo = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  GLchar *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("init", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct__init, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 475, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "renpy/gl/gldraw.pyx":481
 *         """
 * 
 *         if not EGL:             # <<<<<<<<<<<<<<
 * 
 *             # Init glew.
 */
  __pyx_t_1 = ((!(__pyx_v_5renpy_2gl_6gldraw_EGL != 0)) != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":484
 * 
 *             # Init glew.
 *             err = glewInit()             # <<<<<<<<<<<<<<
 * 
 *             if err != GLEW_OK:
 */
    __pyx_v_err = glewInit();

    /* "renpy/gl/gldraw.pyx":486
 *             err = glewInit()
 * 
 *             if err != GLEW_OK:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Glew init failed: %s" % <char *> glewGetErrorString(err))
 *                 return False
 */
    __pyx_t_1 = ((__pyx_v_err != GLEW_OK) != 0);
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":487
 * 
 *             if err != GLEW_OK:
 *                 renpy.display.log.write("Glew init failed: %s" % <char *> glewGetErrorString(err))             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyBytes_FromString(((char *)glewGetErrorString(__pyx_v_err))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Glew_init_failed_s, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 487, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":488
 *             if err != GLEW_OK:
 *                 renpy.display.log.write("Glew init failed: %s" % <char *> glewGetErrorString(err))
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Log the GL version.
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":486
 *             err = glewInit()
 * 
 *             if err != GLEW_OK:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Glew init failed: %s" % <char *> glewGetErrorString(err))
 *                 return False
 */
    }

    /* "renpy/gl/gldraw.pyx":481
 *         """
 * 
 *         if not EGL:             # <<<<<<<<<<<<<<
 * 
 *             # Init glew.
 */
  }

  /* "renpy/gl/gldraw.pyx":491
 * 
 *         # Log the GL version.
 *         renderer = <char *> glGetString(GL_RENDERER)             # <<<<<<<<<<<<<<
 *         version = <char *> glGetString(GL_VERSION)
 * 
 */
  __pyx_t_7 = __pyx_f_5renpy_2gl_2gl_glGetString(GL_RENDERER); if (unlikely(__pyx_t_7 == ((GLchar *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error)
  __pyx_v_renderer = ((char *)__pyx_t_7);

  /* "renpy/gl/gldraw.pyx":492
 *         # Log the GL version.
 *         renderer = <char *> glGetString(GL_RENDERER)
 *         version = <char *> glGetString(GL_VERSION)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 */
  __pyx_t_7 = __pyx_f_5renpy_2gl_2gl_glGetString(GL_VERSION); if (unlikely(__pyx_t_7 == ((GLchar *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L1_error)
  __pyx_v_version = ((char *)__pyx_t_7);

  /* "renpy/gl/gldraw.pyx":494
 *         version = <char *> glGetString(GL_VERSION)
 * 
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Renderer: %r", renderer)
 *         renpy.display.log.write("Version: %r", version)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __pyx_f_5renpy_2gl_2gl_glGetString(GL_VENDOR); if (unlikely(__pyx_t_7 == ((GLchar *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 494, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBytes_FromString(((char *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Vendor_r, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Vendor_r, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Vendor_r);
    __Pyx_GIVEREF(__pyx_kp_s_Vendor_r);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_kp_s_Vendor_r);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":495
 * 
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 *         renpy.display.log.write("Renderer: %r", renderer)             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Version: %r", version)
 *         renpy.display.log.write("Display Info: %s", self.display_info)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_renderer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Renderer_r, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Renderer_r, __pyx_t_6};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Renderer_r);
    __Pyx_GIVEREF(__pyx_kp_s_Renderer_r);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_kp_s_Renderer_r);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":496
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 *         renpy.display.log.write("Renderer: %r", renderer)
 *         renpy.display.log.write("Version: %r", version)             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Display Info: %s", self.display_info)
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_Version_r, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_Version_r, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Version_r);
    __Pyx_GIVEREF(__pyx_kp_s_Version_r);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_s_Version_r);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":497
 *         renpy.display.log.write("Renderer: %r", renderer)
 *         renpy.display.log.write("Version: %r", version)
 *         renpy.display.log.write("Display Info: %s", self.display_info)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Display_Info_s, __pyx_v_self->display_info};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Display_Info_s, __pyx_v_self->display_info};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Display_Info_s);
    __Pyx_GIVEREF(__pyx_kp_s_Display_Info_s);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_kp_s_Display_Info_s);
    __Pyx_INCREF(__pyx_v_self->display_info);
    __Pyx_GIVEREF(__pyx_v_self->display_info);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_v_self->display_info);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":500
 * 
 * 
 *         allow_shader = True             # <<<<<<<<<<<<<<
 *         allow_fixed = self.allow_fixed
 * 
 */
  __pyx_v_allow_shader = 1;

  /* "renpy/gl/gldraw.pyx":501
 * 
 *         allow_shader = True
 *         allow_fixed = self.allow_fixed             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader:
 */
  __pyx_t_1 = __pyx_v_self->allow_fixed;
  __pyx_v_allow_fixed = __pyx_t_1;

  /* "renpy/gl/gldraw.pyx":503
 *         allow_fixed = self.allow_fixed
 * 
 *         if not allow_shader:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 */
  __pyx_t_1 = ((!(__pyx_v_allow_shader != 0)) != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":504
 * 
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")             # <<<<<<<<<<<<<<
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":503
 *         allow_fixed = self.allow_fixed
 * 
 *         if not allow_shader:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 */
  }

  /* "renpy/gl/gldraw.pyx":505
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 * 
 */
  __pyx_t_1 = ((!(__pyx_v_allow_fixed != 0)) != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":506
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader and not allow_fixed:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":505
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":508
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 * 
 *         if not allow_shader and not allow_fixed:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("GL is totally blacklisted.")
 *             return False
 */
  __pyx_t_9 = ((!(__pyx_v_allow_shader != 0)) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_9 = ((!(__pyx_v_allow_fixed != 0)) != 0);
  __pyx_t_1 = __pyx_t_9;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":509
 * 
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":510
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if EGL:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":508
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 * 
 *         if not allow_shader and not allow_fixed:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("GL is totally blacklisted.")
 *             return False
 */
  }

  /* "renpy/gl/gldraw.pyx":512
 *             return False
 * 
 *         if EGL:             # <<<<<<<<<<<<<<
 *             gltexture.use_gles()
 * 
 */
  __pyx_t_1 = (__pyx_v_5renpy_2gl_6gldraw_EGL != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":513
 * 
 *         if EGL:
 *             gltexture.use_gles()             # <<<<<<<<<<<<<<
 * 
 *         elif renpy.android or renpy.ios:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_use_gles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":512
 *             return False
 * 
 *         if EGL:             # <<<<<<<<<<<<<<
 *             gltexture.use_gles()
 * 
 */
    goto __pyx_L10;
  }

  /* "renpy/gl/gldraw.pyx":515
 *             gltexture.use_gles()
 * 
 *         elif renpy.android or renpy.ios:             # <<<<<<<<<<<<<<
 *             self.redraw_period = 1.0
 *             gltexture.use_gles()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_android); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ios); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_9;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":516
 * 
 *         elif renpy.android or renpy.ios:
 *             self.redraw_period = 1.0             # <<<<<<<<<<<<<<
 *             gltexture.use_gles()
 * 
 */
    __pyx_v_self->redraw_period = 1.0;

    /* "renpy/gl/gldraw.pyx":517
 *         elif renpy.android or renpy.ios:
 *             self.redraw_period = 1.0
 *             gltexture.use_gles()             # <<<<<<<<<<<<<<
 * 
 *         elif renpy.emscripten:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_use_gles); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 517, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":515
 *             gltexture.use_gles()
 * 
 *         elif renpy.android or renpy.ios:             # <<<<<<<<<<<<<<
 *             self.redraw_period = 1.0
 *             gltexture.use_gles()
 */
    goto __pyx_L10;
  }

  /* "renpy/gl/gldraw.pyx":519
 *             gltexture.use_gles()
 * 
 *         elif renpy.emscripten:             # <<<<<<<<<<<<<<
 *             # give back control to browser regularly
 *             self.redraw_period = 0.1
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_emscripten); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":521
 *         elif renpy.emscripten:
 *             # give back control to browser regularly
 *             self.redraw_period = 0.1             # <<<<<<<<<<<<<<
 *             # WebGL is GLES
 *             gltexture.use_gles()
 */
    __pyx_v_self->redraw_period = 0.1;

    /* "renpy/gl/gldraw.pyx":523
 *             self.redraw_period = 0.1
 *             # WebGL is GLES
 *             gltexture.use_gles()             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_use_gles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":519
 *             gltexture.use_gles()
 * 
 *         elif renpy.emscripten:             # <<<<<<<<<<<<<<
 *             # give back control to browser regularly
 *             self.redraw_period = 0.1
 */
    goto __pyx_L10;
  }

  /* "renpy/gl/gldraw.pyx":526
 * 
 *         else:
 *             gltexture.use_gl()             # <<<<<<<<<<<<<<
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_use_gl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L10:;

  /* "renpy/gl/gldraw.pyx":528
 *             gltexture.use_gl()
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)             # <<<<<<<<<<<<<<
 *         extensions = set(extensions_string.split(" "))
 * 
 */
  __pyx_t_7 = __pyx_f_5renpy_2gl_2gl_glGetString(GL_EXTENSIONS); if (unlikely(__pyx_t_7 == ((GLchar *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 528, __pyx_L1_error)
  __pyx_v_extensions_string = ((char *)__pyx_t_7);

  /* "renpy/gl/gldraw.pyx":529
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Extensions:")
 */
  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_extensions_string); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySet_New(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_extensions = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":531
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.display.log.write("Extensions:")             # <<<<<<<<<<<<<<
 * 
 *         for i in sorted(extensions):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":533
 *         renpy.display.log.write("Extensions:")
 * 
 *         for i in sorted(extensions):             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("    %s", i)
 * 
 */
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_extensions;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_10 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 533, __pyx_L1_error)
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 533, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_2); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 533, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":534
 * 
 *         for i in sorted(extensions):
 *             renpy.display.log.write("    %s", i)             # <<<<<<<<<<<<<<
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_s, __pyx_v_i};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_s, __pyx_v_i};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_s);
      __Pyx_GIVEREF(__pyx_kp_s_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_kp_s_s);
      __Pyx_INCREF(__pyx_v_i);
      __Pyx_GIVEREF(__pyx_v_i);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_i);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":533
 *         renpy.display.log.write("Extensions:")
 * 
 *         for i in sorted(extensions):             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("    %s", i)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":536
 *             renpy.display.log.write("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_4init_1use_subsystem, 0, __pyx_n_s_init_locals_use_subsystem, ((PyObject*)__pyx_cur_scope), __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_use_subsystem = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":563
 * 
 *         # Count the number of texture units.
 *         cdef GLint texture_units = 0             # <<<<<<<<<<<<<<
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)
 * 
 */
  __pyx_v_texture_units = 0;

  /* "renpy/gl/gldraw.pyx":564
 *         # Count the number of texture units.
 *         cdef GLint texture_units = 0
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Number of texture units: %d", texture_units)
 */
  __pyx_t_8 = __pyx_f_5renpy_2gl_2gl_glGetIntegerv(GL_MAX_TEXTURE_UNITS, (&__pyx_v_texture_units)); if (unlikely(__pyx_t_8 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 564, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":566
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)
 * 
 *         renpy.display.log.write("Number of texture units: %d", texture_units)             # <<<<<<<<<<<<<<
 * 
 *         # Pick a texture environment subsystem.
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_GLint(__pyx_v_texture_units); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_Number_of_texture_units_d, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_kp_s_Number_of_texture_units_d, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_Number_of_texture_units_d);
    __Pyx_GIVEREF(__pyx_kp_s_Number_of_texture_units_d);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_s_Number_of_texture_units_d);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":570
 *         # Pick a texture environment subsystem.
 * 
 *         if EGL or renpy.android or renpy.ios or renpy.emscripten or (allow_shader and use_subsystem(             # <<<<<<<<<<<<<<
 *             glenviron_shader,
 *             "RENPY_GL_ENVIRON",
 */
  __pyx_t_9 = (__pyx_v_5renpy_2gl_6gldraw_EGL != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_android); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ios); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_emscripten); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_allow_shader != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L16_bool_binop_done;
  }

  /* "renpy/gl/gldraw.pyx":571
 * 
 *         if EGL or renpy.android or renpy.ios or renpy.emscripten or (allow_shader and use_subsystem(
 *             glenviron_shader,             # <<<<<<<<<<<<<<
 *             "RENPY_GL_ENVIRON",
 *             "shader",
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_shader); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "renpy/gl/gldraw.pyx":570
 *         # Pick a texture environment subsystem.
 * 
 *         if EGL or renpy.android or renpy.ios or renpy.emscripten or (allow_shader and use_subsystem(             # <<<<<<<<<<<<<<
 *             glenviron_shader,
 *             "RENPY_GL_ENVIRON",
 */
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_n_s_RENPY_GL_ENVIRON);
  __Pyx_GIVEREF(__pyx_n_s_RENPY_GL_ENVIRON);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_RENPY_GL_ENVIRON);
  __Pyx_INCREF(__pyx_n_s_shader);
  __Pyx_GIVEREF(__pyx_n_s_shader);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_shader);
  __Pyx_INCREF(__pyx_n_s_GL_ARB_vertex_shader);
  __Pyx_GIVEREF(__pyx_n_s_GL_ARB_vertex_shader);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_GL_ARB_vertex_shader);
  __Pyx_INCREF(__pyx_n_s_GL_ARB_fragment_shader);
  __Pyx_GIVEREF(__pyx_n_s_GL_ARB_fragment_shader);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_GL_ARB_fragment_shader);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_use_subsystem, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __pyx_t_9;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":577
 *             "GL_ARB_fragment_shader")):
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      /*try:*/ {

        /* "renpy/gl/gldraw.pyx":578
 * 
 *             try:
 *                 renpy.display.log.write("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/gl/gldraw.pyx":579
 *             try:
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "shader"
 *                 self.environ.init()
 */
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_shader); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ShaderEnviron); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 579, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L22_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L22_error)
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) __PYX_ERR(0, 579, __pyx_L22_error)
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_v_self->environ);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
        __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_5);
        __pyx_t_5 = 0;

        /* "renpy/gl/gldraw.pyx":580
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
        if (unlikely(__pyx_v_self->info == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 580, __pyx_L22_error)
        }
        if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_environ, __pyx_n_s_shader) < 0)) __PYX_ERR(0, 580, __pyx_L22_error)

        /* "renpy/gl/gldraw.pyx":581
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             except Exception, e:
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L22_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L22_error)
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/gl/gldraw.pyx":577
 *             "GL_ARB_fragment_shader")):
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 */
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L27_try_end;
      __pyx_L22_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/gl/gldraw.pyx":583
 *                 self.environ.init()
 * 
 *             except Exception, e:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Initializing shader environment failed:")
 *                 renpy.display.log.exception()
 */
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_8) {
        __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(0, 583, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_e = __pyx_t_4;

        /* "renpy/gl/gldraw.pyx":584
 * 
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.display.log.exception()
 *                 self.environ = None
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 584, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 584, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "renpy/gl/gldraw.pyx":585
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")
 *                 renpy.display.log.exception()             # <<<<<<<<<<<<<<
 *                 self.environ = None
 * 
 */
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 585, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_display); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 585, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 585, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_exception); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 585, __pyx_L24_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_15);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_15, function);
          }
        }
        if (__pyx_t_6) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L24_except_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else {
          __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L24_except_error)
        }
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "renpy/gl/gldraw.pyx":586
 *                 renpy.display.log.write("Initializing shader environment failed:")
 *                 renpy.display.log.exception()
 *                 self.environ = None             # <<<<<<<<<<<<<<
 * 
 *         if self.environ is None:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->environ);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
        __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L23_exception_handled;
      }
      goto __pyx_L24_except_error;
      __pyx_L24_except_error:;

      /* "renpy/gl/gldraw.pyx":577
 *             "GL_ARB_fragment_shader")):
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 */
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      goto __pyx_L1_error;
      __pyx_L23_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_L27_try_end:;
    }

    /* "renpy/gl/gldraw.pyx":570
 *         # Pick a texture environment subsystem.
 * 
 *         if EGL or renpy.android or renpy.ios or renpy.emscripten or (allow_shader and use_subsystem(             # <<<<<<<<<<<<<<
 *             glenviron_shader,
 *             "RENPY_GL_ENVIRON",
 */
  }

  /* "renpy/gl/gldraw.pyx":588
 *                 self.environ = None
 * 
 *         if self.environ is None:             # <<<<<<<<<<<<<<
 * 
 *             if allow_fixed and use_subsystem(
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->environ) == Py_None);
  __pyx_t_9 = (__pyx_t_1 != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":590
 *         if self.environ is None:
 * 
 *             if allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_1 = (__pyx_v_allow_fixed != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_9 = __pyx_t_1;
      goto __pyx_L32_bool_binop_done;
    }

    /* "renpy/gl/gldraw.pyx":591
 * 
 *             if allow_fixed and use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_fixed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "renpy/gl/gldraw.pyx":590
 *         if self.environ is None:
 * 
 *             if allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_RENPY_GL_ENVIRON);
    __Pyx_GIVEREF(__pyx_n_s_RENPY_GL_ENVIRON);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_RENPY_GL_ENVIRON);
    __Pyx_INCREF(__pyx_n_s_fixed);
    __Pyx_GIVEREF(__pyx_n_s_fixed);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_n_s_fixed);
    __Pyx_INCREF(__pyx_n_s_GL_ARB_texture_env_crossbar);
    __Pyx_GIVEREF(__pyx_n_s_GL_ARB_texture_env_crossbar);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_n_s_GL_ARB_texture_env_crossbar);
    __Pyx_INCREF(__pyx_n_s_GL_ARB_texture_env_combine);
    __Pyx_GIVEREF(__pyx_n_s_GL_ARB_texture_env_combine);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_n_s_GL_ARB_texture_env_combine);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_use_subsystem, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 590, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __pyx_t_1;
    __pyx_L32_bool_binop_done:;
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":597
 *                 "GL_ARB_texture_env_combine"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":598
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_fixed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_FixedFunctionEnviron); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->environ);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
      __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":599
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (unlikely(__pyx_v_self->info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 599, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_environ, __pyx_n_s_fixed) < 0)) __PYX_ERR(0, 599, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":600
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             elif allow_fixed and use_subsystem(
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":590
 *         if self.environ is None:
 * 
 *             if allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
      goto __pyx_L31;
    }

    /* "renpy/gl/gldraw.pyx":602
 *                 self.environ.init()
 * 
 *             elif allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_1 = (__pyx_v_allow_fixed != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_9 = __pyx_t_1;
      goto __pyx_L34_bool_binop_done;
    }

    /* "renpy/gl/gldraw.pyx":603
 * 
 *             elif allow_fixed and use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_fixed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "renpy/gl/gldraw.pyx":602
 *                 self.environ.init()
 * 
 *             elif allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_RENPY_GL_ENVIRON);
    __Pyx_GIVEREF(__pyx_n_s_RENPY_GL_ENVIRON);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_RENPY_GL_ENVIRON);
    __Pyx_INCREF(__pyx_n_s_fixed);
    __Pyx_GIVEREF(__pyx_n_s_fixed);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_n_s_fixed);
    __Pyx_INCREF(__pyx_n_s_GL_NV_texture_env_combine4);
    __Pyx_GIVEREF(__pyx_n_s_GL_NV_texture_env_combine4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_n_s_GL_NV_texture_env_combine4);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_use_subsystem, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 602, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __pyx_t_1;
    __pyx_L34_bool_binop_done:;
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":608
 *                 "GL_NV_texture_env_combine4"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":609
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_fixed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_FixedFunctionEnviron); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) __PYX_ERR(0, 609, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->environ);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
      __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":610
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (unlikely(__pyx_v_self->info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 610, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_environ, __pyx_n_s_fixed) < 0)) __PYX_ERR(0, 610, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":611
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             elif use_subsystem(
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":602
 *                 self.environ.init()
 * 
 *             elif allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
      goto __pyx_L31;
    }

    /* "renpy/gl/gldraw.pyx":614
 * 
 *             elif use_subsystem(
 *                 glenviron_limited,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "limited",
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_limited); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "renpy/gl/gldraw.pyx":613
 *                 self.environ.init()
 * 
 *             elif use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_limited,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_RENPY_GL_ENVIRON);
    __Pyx_GIVEREF(__pyx_n_s_RENPY_GL_ENVIRON);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_RENPY_GL_ENVIRON);
    __Pyx_INCREF(__pyx_n_s_limited);
    __Pyx_GIVEREF(__pyx_n_s_limited);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_n_s_limited);
    __Pyx_INCREF(__pyx_n_s_RENPY_bogus_extension);
    __Pyx_GIVEREF(__pyx_n_s_RENPY_bogus_extension);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_n_s_RENPY_bogus_extension);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_use_subsystem, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 613, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":619
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.display.log.write("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":620
 * 
 *                 renpy.display.log.write("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "limited"
 *                 self.environ.init()
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_glenviron_limited); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_LimitedEnviron); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) __PYX_ERR(0, 620, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->environ);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
      __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":621
 *                 renpy.display.log.write("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (unlikely(__pyx_v_self->info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 621, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_environ, __pyx_n_s_limited) < 0)) __PYX_ERR(0, 621, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":622
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":613
 *                 self.environ.init()
 * 
 *             elif use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_limited,
 *                 "RENPY_GL_ENVIRON",
 */
      goto __pyx_L31;
    }

    /* "renpy/gl/gldraw.pyx":625
 * 
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":626
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Pick a Render-to-texture method.
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;
    }
    __pyx_L31:;

    /* "renpy/gl/gldraw.pyx":588
 *                 self.environ = None
 * 
 *         if self.environ is None:             # <<<<<<<<<<<<<<
 * 
 *             if allow_fixed and use_subsystem(
 */
  }

  /* "renpy/gl/gldraw.pyx":629
 * 
 *         # Pick a Render-to-texture method.
 *         use_fbo = renpy.ios or renpy.android or renpy.emscripten or EGL or use_subsystem(             # <<<<<<<<<<<<<<
 *                 glrtt_fbo,
 *                 "RENPY_GL_RTT",
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ios); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 629, __pyx_L1_error)
  if (!__pyx_t_9) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L36_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_android); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 629, __pyx_L1_error)
  if (!__pyx_t_9) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L36_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_emscripten); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 629, __pyx_L1_error)
  if (!__pyx_t_9) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L36_bool_binop_done;
  }
  if (!__pyx_v_5renpy_2gl_6gldraw_EGL) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_5renpy_2gl_6gldraw_EGL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L36_bool_binop_done;
  }

  /* "renpy/gl/gldraw.pyx":630
 *         # Pick a Render-to-texture method.
 *         use_fbo = renpy.ios or renpy.android or renpy.emscripten or EGL or use_subsystem(
 *                 glrtt_fbo,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_RTT",
 *                 "fbo",
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_glrtt_fbo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "renpy/gl/gldraw.pyx":629
 * 
 *         # Pick a Render-to-texture method.
 *         use_fbo = renpy.ios or renpy.android or renpy.emscripten or EGL or use_subsystem(             # <<<<<<<<<<<<<<
 *                 glrtt_fbo,
 *                 "RENPY_GL_RTT",
 */
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_RENPY_GL_RTT);
  __Pyx_GIVEREF(__pyx_n_s_RENPY_GL_RTT);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_RENPY_GL_RTT);
  __Pyx_INCREF(__pyx_n_s_fbo);
  __Pyx_GIVEREF(__pyx_n_s_fbo);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_n_s_fbo);
  __Pyx_INCREF(__pyx_n_s_GL_ARB_framebuffer_object);
  __Pyx_GIVEREF(__pyx_n_s_GL_ARB_framebuffer_object);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_n_s_GL_ARB_framebuffer_object);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_use_subsystem, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_L36_bool_binop_done:;
  __pyx_v_use_fbo = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":635
 *                 "GL_ARB_framebuffer_object")
 * 
 *         if use_fbo:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_use_fbo); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 635, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":636
 * 
 *         if use_fbo:
 *             renpy.display.log.write("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":637
 *         if use_fbo:
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()             # <<<<<<<<<<<<<<
 *             self.info["rtt"] = "fbo"
 *             self.rtt.init()
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_glrtt_fbo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_FboRtt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->rtt);
    __Pyx_DECREF(__pyx_v_self->rtt);
    __pyx_v_self->rtt = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":638
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"             # <<<<<<<<<<<<<<
 *             self.rtt.init()
 * 
 */
    if (unlikely(__pyx_v_self->info == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 638, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_rtt, __pyx_n_s_fbo) < 0)) __PYX_ERR(0, 638, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":639
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 *             self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         elif glrtt_copy:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s_init); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":635
 *                 "GL_ARB_framebuffer_object")
 * 
 *         if use_fbo:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()
 */
    goto __pyx_L41;
  }

  /* "renpy/gl/gldraw.pyx":641
 *             self.rtt.init()
 * 
 *         elif glrtt_copy:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_glrtt_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":642
 * 
 *         elif glrtt_copy:
 *             renpy.display.log.write("Using copy RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":643
 *         elif glrtt_copy:
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()             # <<<<<<<<<<<<<<
 *             self.info["rtt"] = "copy"
 *             self.rtt.init()
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_glrtt_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_CopyRtt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->rtt);
    __Pyx_DECREF(__pyx_v_self->rtt);
    __pyx_v_self->rtt = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":644
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"             # <<<<<<<<<<<<<<
 *             self.rtt.init()
 * 
 */
    if (unlikely(__pyx_v_self->info == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 644, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->info, __pyx_n_s_rtt, __pyx_n_s_copy) < 0)) __PYX_ERR(0, 644, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":645
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 *             self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":641
 *             self.rtt.init()
 * 
 *         elif glrtt_copy:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 */
    goto __pyx_L41;
  }

  /* "renpy/gl/gldraw.pyx":648
 * 
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":649
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }
  __pyx_L41:;

  /* "renpy/gl/gldraw.pyx":652
 * 
 * 
 *         renpy.display.log.write("Using {0} renderer.".format(self.info["renderer"]))             # <<<<<<<<<<<<<<
 * 
 *         # Figure out the sizes of texture that render properly.
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Using_0_renderer, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_v_self->info == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 652, __pyx_L1_error)
  }
  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_self->info, __pyx_n_s_renderer); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_15};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_15};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 652, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":655
 * 
 *         # Figure out the sizes of texture that render properly.
 *         if not self.did_texture_test:             # <<<<<<<<<<<<<<
 *             rv = gltexture.test_texture_sizes(self.environ, self)
 *         else:
 */
  __pyx_t_9 = ((!(__pyx_v_self->did_texture_test != 0)) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":656
 *         # Figure out the sizes of texture that render properly.
 *         if not self.did_texture_test:
 *             rv = gltexture.test_texture_sizes(self.environ, self)             # <<<<<<<<<<<<<<
 *         else:
 *             rv = True
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_test_texture_sizes); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self->environ), ((PyObject *)__pyx_v_self)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self->environ), ((PyObject *)__pyx_v_self)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_self->environ));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self->environ));
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, ((PyObject *)__pyx_v_self->environ));
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, ((PyObject *)__pyx_v_self));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_rv = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":655
 * 
 *         # Figure out the sizes of texture that render properly.
 *         if not self.did_texture_test:             # <<<<<<<<<<<<<<
 *             rv = gltexture.test_texture_sizes(self.environ, self)
 *         else:
 */
    goto __pyx_L42;
  }

  /* "renpy/gl/gldraw.pyx":658
 *             rv = gltexture.test_texture_sizes(self.environ, self)
 *         else:
 *             rv = True             # <<<<<<<<<<<<<<
 * 
 *         self.rtt.deinit()
 */
  /*else*/ {
    __Pyx_INCREF(Py_True);
    __pyx_v_rv = Py_True;
  }
  __pyx_L42:;

  /* "renpy/gl/gldraw.pyx":660
 *             rv = True
 * 
 *         self.rtt.deinit()             # <<<<<<<<<<<<<<
 *         self.environ.deinit()
 * 
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s_deinit); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":661
 * 
 *         self.rtt.deinit()
 *         self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if not rv:
 */
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s_deinit); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":663
 *         self.environ.deinit()
 * 
 *         if not rv:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_rv); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
  __pyx_t_1 = ((!__pyx_t_9) != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":664
 * 
 *         if not rv:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         self.did_texture_test = True
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":663
 *         self.environ.deinit()
 * 
 *         if not rv:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":666
 *             return False
 * 
 *         self.did_texture_test = True             # <<<<<<<<<<<<<<
 * 
 *         # Do additional setup needed.
 */
  __pyx_v_self->did_texture_test = 1;

  /* "renpy/gl/gldraw.pyx":669
 * 
 *         # Do additional setup needed.
 *         renpy.display.pgrender.set_rgba_masks()             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pgrender); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_set_rgba_masks); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_16) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 669, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":671
 *         renpy.display.pgrender.set_rgba_masks()
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":475
 *         self.old_fullscreen = None
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_use_subsystem);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_use_fbo);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":674
 * 
 * 
 *     def can_block(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if we can block to wait for input, False if the screen
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11can_block(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_10can_block[] = "\n        Returns True if we can block to wait for input, False if the screen\n        needs to be immediately redrawn.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11can_block(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("can_block (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_10can_block(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_10can_block(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_powersave = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("can_block", 0);

  /* "renpy/gl/gldraw.pyx":680
 *         """
 * 
 *         powersave = renpy.game.preferences.gl_powersave             # <<<<<<<<<<<<<<
 * 
 *         if not powersave:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_game); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_preferences); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_gl_powersave); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_powersave = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":682
 *         powersave = renpy.game.preferences.gl_powersave
 * 
 *         if not powersave:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_powersave); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 682, __pyx_L1_error)
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":683
 * 
 *         if not powersave:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         return not self.fast_redraw_frames
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":682
 *         powersave = renpy.game.preferences.gl_powersave
 * 
 *         if not powersave:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":685
 *             return False
 * 
 *         return not self.fast_redraw_frames             # <<<<<<<<<<<<<<
 * 
 *     def should_redraw(self, needs_redraw, first_pass, can_block):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((!(__pyx_v_self->fast_redraw_frames != 0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":674
 * 
 * 
 *     def can_block(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns True if we can block to wait for input, False if the screen
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.can_block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_powersave);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":687
 *         return not self.fast_redraw_frames
 * 
 *     def should_redraw(self, needs_redraw, first_pass, can_block):             # <<<<<<<<<<<<<<
 *         """
 *         Redraw whenever the screen needs it, but at least once every
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13should_redraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_12should_redraw[] = "\n        Redraw whenever the screen needs it, but at least once every\n        .2 seconds. We rely on VSYNC to slow down our maximum\n        draw speed.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13should_redraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_needs_redraw = 0;
  PyObject *__pyx_v_first_pass = 0;
  PyObject *__pyx_v_can_block = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("should_redraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_needs_redraw,&__pyx_n_s_first_pass,&__pyx_n_s_can_block,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_needs_redraw)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_first_pass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("should_redraw", 1, 3, 3, 1); __PYX_ERR(0, 687, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_can_block)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("should_redraw", 1, 3, 3, 2); __PYX_ERR(0, 687, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "should_redraw") < 0)) __PYX_ERR(0, 687, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_needs_redraw = values[0];
    __pyx_v_first_pass = values[1];
    __pyx_v_can_block = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("should_redraw", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 687, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.should_redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12should_redraw(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_needs_redraw, __pyx_v_first_pass, __pyx_v_can_block);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12should_redraw(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_needs_redraw, PyObject *__pyx_v_first_pass, PyObject *__pyx_v_can_block) {
  int __pyx_v_rv;
  PyObject *__pyx_v_mx = NULL;
  PyObject *__pyx_v_my = NULL;
  PyObject *__pyx_v_tex = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  __Pyx_RefNannySetupContext("should_redraw", 0);

  /* "renpy/gl/gldraw.pyx":694
 *         """
 * 
 *         rv = False             # <<<<<<<<<<<<<<
 * 
 *         if needs_redraw:
 */
  __pyx_v_rv = 0;

  /* "renpy/gl/gldraw.pyx":696
 *         rv = False
 * 
 *         if needs_redraw:             # <<<<<<<<<<<<<<
 *             rv = True
 *         elif first_pass:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_needs_redraw); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 696, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":697
 * 
 *         if needs_redraw:
 *             rv = True             # <<<<<<<<<<<<<<
 *         elif first_pass:
 *             rv = True
 */
    __pyx_v_rv = 1;

    /* "renpy/gl/gldraw.pyx":696
 *         rv = False
 * 
 *         if needs_redraw:             # <<<<<<<<<<<<<<
 *             rv = True
 *         elif first_pass:
 */
    goto __pyx_L3;
  }

  /* "renpy/gl/gldraw.pyx":698
 *         if needs_redraw:
 *             rv = True
 *         elif first_pass:             # <<<<<<<<<<<<<<
 *             rv = True
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_first_pass); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 698, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":699
 *             rv = True
 *         elif first_pass:
 *             rv = True             # <<<<<<<<<<<<<<
 *         else:
 *             # Redraw if the mouse moves.
 */
    __pyx_v_rv = 1;

    /* "renpy/gl/gldraw.pyx":698
 *         if needs_redraw:
 *             rv = True
 *         elif first_pass:             # <<<<<<<<<<<<<<
 *             rv = True
 *         else:
 */
    goto __pyx_L3;
  }

  /* "renpy/gl/gldraw.pyx":702
 *         else:
 *             # Redraw if the mouse moves.
 *             mx, my, tex = self.mouse_info             # <<<<<<<<<<<<<<
 * 
 *             if tex and (mx, my) != pygame.mouse.get_pos():
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_self->mouse_info;
    __Pyx_INCREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 702, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 702, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_mx = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_my = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_tex = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":704
 *             mx, my, tex = self.mouse_info
 * 
 *             if tex and (mx, my) != pygame.mouse.get_pos():             # <<<<<<<<<<<<<<
 *                 rv = True
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_tex); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
    if (__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_mx);
    __Pyx_GIVEREF(__pyx_v_mx);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mx);
    __Pyx_INCREF(__pyx_v_my);
    __Pyx_GIVEREF(__pyx_v_my);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_my);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_mouse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 704, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 704, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":705
 * 
 *             if tex and (mx, my) != pygame.mouse.get_pos():
 *                 rv = True             # <<<<<<<<<<<<<<
 * 
 *         # Handle fast redraw.
 */
      __pyx_v_rv = 1;

      /* "renpy/gl/gldraw.pyx":704
 *             mx, my, tex = self.mouse_info
 * 
 *             if tex and (mx, my) != pygame.mouse.get_pos():             # <<<<<<<<<<<<<<
 *                 rv = True
 * 
 */
    }
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":708
 * 
 *         # Handle fast redraw.
 *         if rv:             # <<<<<<<<<<<<<<
 *             self.fast_redraw_frames = renpy.config.fast_redraw_frames
 *         elif self.fast_redraw_frames > 0:
 */
  __pyx_t_1 = (__pyx_v_rv != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":709
 *         # Handle fast redraw.
 *         if rv:
 *             self.fast_redraw_frames = renpy.config.fast_redraw_frames             # <<<<<<<<<<<<<<
 *         elif self.fast_redraw_frames > 0:
 *             self.fast_redraw_frames -= 1
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_config); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_fast_redraw_frames); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 709, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_self->fast_redraw_frames = __pyx_t_9;

    /* "renpy/gl/gldraw.pyx":708
 * 
 *         # Handle fast redraw.
 *         if rv:             # <<<<<<<<<<<<<<
 *             self.fast_redraw_frames = renpy.config.fast_redraw_frames
 *         elif self.fast_redraw_frames > 0:
 */
    goto __pyx_L9;
  }

  /* "renpy/gl/gldraw.pyx":710
 *         if rv:
 *             self.fast_redraw_frames = renpy.config.fast_redraw_frames
 *         elif self.fast_redraw_frames > 0:             # <<<<<<<<<<<<<<
 *             self.fast_redraw_frames -= 1
 *             rv = True
 */
  __pyx_t_1 = ((__pyx_v_self->fast_redraw_frames > 0) != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":711
 *             self.fast_redraw_frames = renpy.config.fast_redraw_frames
 *         elif self.fast_redraw_frames > 0:
 *             self.fast_redraw_frames -= 1             # <<<<<<<<<<<<<<
 *             rv = True
 * 
 */
    __pyx_v_self->fast_redraw_frames = (__pyx_v_self->fast_redraw_frames - 1);

    /* "renpy/gl/gldraw.pyx":712
 *         elif self.fast_redraw_frames > 0:
 *             self.fast_redraw_frames -= 1
 *             rv = True             # <<<<<<<<<<<<<<
 * 
 *         if time.time() > self.last_redraw_time + self.redraw_period:
 */
    __pyx_v_rv = 1;

    /* "renpy/gl/gldraw.pyx":710
 *         if rv:
 *             self.fast_redraw_frames = renpy.config.fast_redraw_frames
 *         elif self.fast_redraw_frames > 0:             # <<<<<<<<<<<<<<
 *             self.fast_redraw_frames -= 1
 *             rv = True
 */
  }
  __pyx_L9:;

  /* "renpy/gl/gldraw.pyx":714
 *             rv = True
 * 
 *         if time.time() > self.last_redraw_time + self.redraw_period:             # <<<<<<<<<<<<<<
 *             rv = True
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->last_redraw_time + __pyx_v_self->redraw_period)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":715
 * 
 *         if time.time() > self.last_redraw_time + self.redraw_period:
 *             rv = True             # <<<<<<<<<<<<<<
 * 
 *         # Store the redraw time.
 */
    __pyx_v_rv = 1;

    /* "renpy/gl/gldraw.pyx":714
 *             rv = True
 * 
 *         if time.time() > self.last_redraw_time + self.redraw_period:             # <<<<<<<<<<<<<<
 *             rv = True
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":718
 * 
 *         # Store the redraw time.
 *         if rv or (not can_block):             # <<<<<<<<<<<<<<
 *             self.last_redraw_time = time.time()
 *             return True
 */
  __pyx_t_8 = (__pyx_v_rv != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_can_block); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 718, __pyx_L1_error)
  __pyx_t_10 = ((!__pyx_t_8) != 0);
  __pyx_t_1 = __pyx_t_10;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":719
 *         # Store the redraw time.
 *         if rv or (not can_block):
 *             self.last_redraw_time = time.time()             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_self->last_redraw_time = __pyx_t_11;

    /* "renpy/gl/gldraw.pyx":720
 *         if rv or (not can_block):
 *             self.last_redraw_time = time.time()
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":718
 * 
 *         # Store the redraw time.
 *         if rv or (not can_block):             # <<<<<<<<<<<<<<
 *             self.last_redraw_time = time.time()
 *             return True
 */
  }

  /* "renpy/gl/gldraw.pyx":722
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def mutated_surface(self, surf):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "renpy/gl/gldraw.pyx":687
 *         return not self.fast_redraw_frames
 * 
 *     def should_redraw(self, needs_redraw, first_pass, can_block):             # <<<<<<<<<<<<<<
 *         """
 *         Redraw whenever the screen needs it, but at least once every
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.should_redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":724
 *             return False
 * 
 *     def mutated_surface(self, surf):             # <<<<<<<<<<<<<<
 *         if surf in self.texture_cache:
 *             del self.texture_cache[surf]
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mutated_surface (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_14mutated_surface(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_surf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_14mutated_surface(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("mutated_surface", 0);

  /* "renpy/gl/gldraw.pyx":725
 * 
 *     def mutated_surface(self, surf):
 *         if surf in self.texture_cache:             # <<<<<<<<<<<<<<
 *             del self.texture_cache[surf]
 * 
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_surf, __pyx_v_self->texture_cache, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 725, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":726
 *     def mutated_surface(self, surf):
 *         if surf in self.texture_cache:
 *             del self.texture_cache[surf]             # <<<<<<<<<<<<<<
 * 
 *     def load_texture(self, surf, transient=False):
 */
    if (unlikely(PyObject_DelItem(__pyx_v_self->texture_cache, __pyx_v_surf) < 0)) __PYX_ERR(0, 726, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":725
 * 
 *     def mutated_surface(self, surf):
 *         if surf in self.texture_cache:             # <<<<<<<<<<<<<<
 *             del self.texture_cache[surf]
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":724
 *             return False
 * 
 *     def mutated_surface(self, surf):             # <<<<<<<<<<<<<<
 *         if surf in self.texture_cache:
 *             del self.texture_cache[surf]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.mutated_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":728
 *             del self.texture_cache[surf]
 * 
 *     def load_texture(self, surf, transient=False):             # <<<<<<<<<<<<<<
 *         """
 *         Loads a texture into memory.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_16load_texture[] = "\n        Loads a texture into memory.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surf = 0;
  PyObject *__pyx_v_transient = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load_texture (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surf,&__pyx_n_s_transient,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_surf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transient);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load_texture") < 0)) __PYX_ERR(0, 728, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surf = values[0];
    __pyx_v_transient = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load_texture", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 728, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.load_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_16load_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surf, __pyx_v_transient);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_16load_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf, PyObject *__pyx_v_transient) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("load_texture", 0);

  /* "renpy/gl/gldraw.pyx":735
 *         # Turn a surface into a texture grid.
 * 
 *         rv = self.texture_cache.get(surf, None)             # <<<<<<<<<<<<<<
 * 
 *         if rv is None:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->texture_cache, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_surf, Py_None};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_surf, Py_None};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_surf);
    __Pyx_GIVEREF(__pyx_v_surf);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_surf);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":737
 *         rv = self.texture_cache.get(surf, None)
 * 
 *         if rv is None:             # <<<<<<<<<<<<<<
 *             rv = gltexture.texture_grid_from_surface(surf, transient)
 *             self.texture_cache[surf] = rv
 */
  __pyx_t_6 = (__pyx_v_rv == Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "renpy/gl/gldraw.pyx":738
 * 
 *         if rv is None:
 *             rv = gltexture.texture_grid_from_surface(surf, transient)             # <<<<<<<<<<<<<<
 *             self.texture_cache[surf] = rv
 *             self.ready_texture_queue.add(rv)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_texture_grid_from_surface); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 738, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_surf, __pyx_v_transient};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_surf, __pyx_v_transient};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_surf);
      __Pyx_GIVEREF(__pyx_v_surf);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_surf);
      __Pyx_INCREF(__pyx_v_transient);
      __Pyx_GIVEREF(__pyx_v_transient);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_transient);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":739
 *         if rv is None:
 *             rv = gltexture.texture_grid_from_surface(surf, transient)
 *             self.texture_cache[surf] = rv             # <<<<<<<<<<<<<<
 *             self.ready_texture_queue.add(rv)
 * 
 */
    if (unlikely(PyObject_SetItem(__pyx_v_self->texture_cache, __pyx_v_surf, __pyx_v_rv) < 0)) __PYX_ERR(0, 739, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":740
 *             rv = gltexture.texture_grid_from_surface(surf, transient)
 *             self.texture_cache[surf] = rv
 *             self.ready_texture_queue.add(rv)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->ready_texture_queue, __pyx_n_s_add); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rv};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rv};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_rv);
        __Pyx_GIVEREF(__pyx_v_rv);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_rv);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":737
 *         rv = self.texture_cache.get(surf, None)
 * 
 *         if rv is None:             # <<<<<<<<<<<<<<
 *             rv = gltexture.texture_grid_from_surface(surf, transient)
 *             self.texture_cache[surf] = rv
 */
  }

  /* "renpy/gl/gldraw.pyx":742
 *             self.ready_texture_queue.add(rv)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def ready_one_texture(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":728
 *             del self.texture_cache[surf]
 * 
 *     def load_texture(self, surf, transient=False):             # <<<<<<<<<<<<<<
 *         """
 *         Loads a texture into memory.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.load_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":744
 *         return rv
 * 
 *     def ready_one_texture(self):             # <<<<<<<<<<<<<<
 *         """
 *         Call from the main thread to make a single texture ready.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_19ready_one_texture(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_18ready_one_texture[] = "\n        Call from the main thread to make a single texture ready.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_19ready_one_texture(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ready_one_texture (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18ready_one_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18ready_one_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_tex = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("ready_one_texture", 0);

  /* "renpy/gl/gldraw.pyx":749
 *         """
 * 
 *         while True:             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
  while (1) {

    /* "renpy/gl/gldraw.pyx":751
 *         while True:
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 tex = self.ready_texture_queue.pop()
 *             except KeyError:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      /*try:*/ {

        /* "renpy/gl/gldraw.pyx":752
 * 
 *             try:
 *                 tex = self.ready_texture_queue.pop()             # <<<<<<<<<<<<<<
 *             except KeyError:
 *                 return False
 */
        __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_self->ready_texture_queue); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_tex, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "renpy/gl/gldraw.pyx":751
 *         while True:
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 tex = self.ready_texture_queue.pop()
 *             except KeyError:
 */
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L12_try_end;
      __pyx_L5_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":753
 *             try:
 *                 tex = self.ready_texture_queue.pop()
 *             except KeyError:             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
      if (__pyx_t_5) {
        __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.ready_one_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 753, __pyx_L7_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_7);

        /* "renpy/gl/gldraw.pyx":754
 *                 tex = self.ready_texture_queue.pop()
 *             except KeyError:
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             if not tex.ready:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L8_except_return;
      }
      goto __pyx_L7_except_error;
      __pyx_L7_except_error:;

      /* "renpy/gl/gldraw.pyx":751
 *         while True:
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 tex = self.ready_texture_queue.pop()
 *             except KeyError:
 */
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L1_error;
      __pyx_L8_except_return:;
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L0;
      __pyx_L12_try_end:;
    }

    /* "renpy/gl/gldraw.pyx":756
 *                 return False
 * 
 *             if not tex.ready:             # <<<<<<<<<<<<<<
 *                 tex.make_ready(False)
 *                 return True
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_tex, __pyx_n_s_ready); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":757
 * 
 *             if not tex.ready:
 *                 tex.make_ready(False)             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_tex, __pyx_n_s_make_ready); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":758
 *             if not tex.ready:
 *                 tex.make_ready(False)
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         return False
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":756
 *                 return False
 * 
 *             if not tex.ready:             # <<<<<<<<<<<<<<
 *                 tex.make_ready(False)
 *                 return True
 */
    }
  }

  /* "renpy/gl/gldraw.pyx":760
 *                 return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def solid_texture(self, w, h, color):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":744
 *         return rv
 * 
 *     def ready_one_texture(self):             # <<<<<<<<<<<<<<
 *         """
 *         Call from the main thread to make a single texture ready.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.ready_one_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":762
 *         return False
 * 
 *     def solid_texture(self, w, h, color):             # <<<<<<<<<<<<<<
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)
 *         surf.fill(color)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_21solid_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_21solid_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solid_texture (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_h,&__pyx_n_s_color,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, 1); __PYX_ERR(0, 762, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, 2); __PYX_ERR(0, 762, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solid_texture") < 0)) __PYX_ERR(0, 762, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_w = values[0];
    __pyx_v_h = values[1];
    __pyx_v_color = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 762, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.solid_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_20solid_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_w, __pyx_v_h, __pyx_v_color);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_20solid_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_h, PyObject *__pyx_v_color) {
  PyObject *__pyx_v_surf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("solid_texture", 0);

  /* "renpy/gl/gldraw.pyx":763
 * 
 *     def solid_texture(self, w, h, color):
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)             # <<<<<<<<<<<<<<
 *         surf.fill(color)
 *         surf = surf.subsurface((2, 2, w, h))
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pgrender); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_w, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_h, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, Py_True};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, Py_True};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_5);
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, Py_True);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_surf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":764
 *     def solid_texture(self, w, h, color):
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)
 *         surf.fill(color)             # <<<<<<<<<<<<<<
 *         surf = surf.subsurface((2, 2, w, h))
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_fill); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_color); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_color};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_color};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_color);
      __Pyx_GIVEREF(__pyx_v_color);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_color);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":765
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)
 *         surf.fill(color)
 *         surf = surf.subsurface((2, 2, w, h))             # <<<<<<<<<<<<<<
 * 
 *         return self.load_texture(surf)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_2);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_2);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_h);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_surf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":767
 *         surf = surf.subsurface((2, 2, w, h))
 * 
 *         return self.load_texture(surf)             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_surf};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_surf};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_surf);
      __Pyx_GIVEREF(__pyx_v_surf);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_surf);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":762
 *         return False
 * 
 *     def solid_texture(self, w, h, color):             # <<<<<<<<<<<<<<
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)
 *         surf.fill(color)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.solid_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":770
 * 
 *     # private
 *     def clip_mode_screen(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does two things. First, it shuts down clipping, and clears
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23clip_mode_screen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_22clip_mode_screen[] = "\n        This does two things. First, it shuts down clipping, and clears\n        the cache so it will be reset by the next call to set_clip. Then\n        it flags that we are in the screen clip mode, which control how\n        coordinates are mapped to the scissor box.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23clip_mode_screen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clip_mode_screen (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_22clip_mode_screen(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_22clip_mode_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clip_mode_screen", 0);

  /* "renpy/gl/gldraw.pyx":778
 *         """
 * 
 *         self.clip_cache = None             # <<<<<<<<<<<<<<
 *         self.clip_rtt_box = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->clip_cache);
  __Pyx_DECREF(__pyx_v_self->clip_cache);
  __pyx_v_self->clip_cache = ((PyObject*)Py_None);

  /* "renpy/gl/gldraw.pyx":779
 * 
 *         self.clip_cache = None
 *         self.clip_rtt_box = None             # <<<<<<<<<<<<<<
 * 
 *         self.environ.unset_clip(self)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(__pyx_v_self->clip_rtt_box);
  __pyx_v_self->clip_rtt_box = ((PyObject*)Py_None);

  /* "renpy/gl/gldraw.pyx":781
 *         self.clip_rtt_box = None
 * 
 *         self.environ.unset_clip(self)             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->unset_clip(__pyx_v_self->environ, __pyx_v_self);

  /* "renpy/gl/gldraw.pyx":770
 * 
 *     # private
 *     def clip_mode_screen(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does two things. First, it shuts down clipping, and clears
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":784
 * 
 *     # private
 *     def clip_mode_rtt(self, x, y, w, h):             # <<<<<<<<<<<<<<
 *         """
 *         The same thing, except the screen is projected in RTT mode.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_25clip_mode_rtt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_24clip_mode_rtt[] = "\n        The same thing, except the screen is projected in RTT mode.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_25clip_mode_rtt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clip_mode_rtt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, 1); __PYX_ERR(0, 784, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, 2); __PYX_ERR(0, 784, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, 3); __PYX_ERR(0, 784, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "clip_mode_rtt") < 0)) __PYX_ERR(0, 784, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 784, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.clip_mode_rtt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_24clip_mode_rtt(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_24clip_mode_rtt(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("clip_mode_rtt", 0);

  /* "renpy/gl/gldraw.pyx":789
 *         """
 * 
 *         self.clip_cache = None             # <<<<<<<<<<<<<<
 *         self.clip_rtt_box = (x, y, w, h)
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->clip_cache);
  __Pyx_DECREF(__pyx_v_self->clip_cache);
  __pyx_v_self->clip_cache = ((PyObject*)Py_None);

  /* "renpy/gl/gldraw.pyx":790
 * 
 *         self.clip_cache = None
 *         self.clip_rtt_box = (x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *         self.environ.unset_clip(self)
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(__pyx_v_self->clip_rtt_box);
  __pyx_v_self->clip_rtt_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":792
 *         self.clip_rtt_box = (x, y, w, h)
 * 
 *         self.environ.unset_clip(self)             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->unset_clip(__pyx_v_self->environ, __pyx_v_self);

  /* "renpy/gl/gldraw.pyx":784
 * 
 *     # private
 *     def clip_mode_rtt(self, x, y, w, h):             # <<<<<<<<<<<<<<
 *         """
 *         The same thing, except the screen is projected in RTT mode.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.clip_mode_rtt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":795
 * 
 *     # private
 *     cpdef set_clip(GLDraw self, tuple clip):             # <<<<<<<<<<<<<<
 * 
 *         if self.clip_cache == clip:
 */

static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_f_5renpy_2gl_6gldraw_6GLDraw_set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("set_clip", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_clip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27set_clip)) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_clip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_clip};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_clip};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 795, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_INCREF(__pyx_v_clip);
          __Pyx_GIVEREF(__pyx_v_clip);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_clip);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/gl/gldraw.pyx":797
 *     cpdef set_clip(GLDraw self, tuple clip):
 * 
 *         if self.clip_cache == clip:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->clip_cache, __pyx_v_clip, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 797, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "renpy/gl/gldraw.pyx":798
 * 
 *         if self.clip_cache == clip:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.clip_cache = clip
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":797
 *     cpdef set_clip(GLDraw self, tuple clip):
 * 
 *         if self.clip_cache == clip:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":800
 *             return
 * 
 *         self.clip_cache = clip             # <<<<<<<<<<<<<<
 * 
 *         self.environ.set_clip(clip, self)
 */
  __Pyx_INCREF(__pyx_v_clip);
  __Pyx_GIVEREF(__pyx_v_clip);
  __Pyx_GOTREF(__pyx_v_self->clip_cache);
  __Pyx_DECREF(__pyx_v_self->clip_cache);
  __pyx_v_self->clip_cache = __pyx_v_clip;

  /* "renpy/gl/gldraw.pyx":802
 *         self.clip_cache = clip
 * 
 *         self.environ.set_clip(clip, self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->set_clip(__pyx_v_self->environ, __pyx_v_clip, __pyx_v_self);

  /* "renpy/gl/gldraw.pyx":795
 * 
 *     # private
 *     cpdef set_clip(GLDraw self, tuple clip):             # <<<<<<<<<<<<<<
 * 
 *         if self.clip_cache == clip:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_clip (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_clip), (&PyTuple_Type), 1, "clip", 1))) __PYX_ERR(0, 795, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_26set_clip(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject*)__pyx_v_clip));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_26set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_clip", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5renpy_2gl_6gldraw_6GLDraw_set_clip(__pyx_v_self, __pyx_v_clip, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":805
 * 
 * 
 *     def draw_screen(self, surftree, fullscreen_video, flip=True):             # <<<<<<<<<<<<<<
 *         """
 *         Draws the screen.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_28draw_screen[] = "\n        Draws the screen.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surftree = 0;
  CYTHON_UNUSED PyObject *__pyx_v_fullscreen_video = 0;
  PyObject *__pyx_v_flip = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_screen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surftree,&__pyx_n_s_fullscreen_video,&__pyx_n_s_flip,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_surftree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fullscreen_video)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_screen", 0, 2, 3, 1); __PYX_ERR(0, 805, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flip);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_screen") < 0)) __PYX_ERR(0, 805, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surftree = values[0];
    __pyx_v_fullscreen_video = values[1];
    __pyx_v_flip = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_screen", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 805, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_screen(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, __pyx_v_fullscreen_video, __pyx_v_flip);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, CYTHON_UNUSED PyObject *__pyx_v_fullscreen_video, PyObject *__pyx_v_flip) {
  PyObject *__pyx_v_reverse = NULL;
  PyObject *__pyx_v_xmul = NULL;
  PyObject *__pyx_v_ymul = NULL;
  PyObject *__pyx_v_xsize = NULL;
  PyObject *__pyx_v_ysize = NULL;
  PyObject *__pyx_v_clear_r = NULL;
  PyObject *__pyx_v_clear_g = NULL;
  PyObject *__pyx_v_clear_b = NULL;
  PyObject *__pyx_v_clip = NULL;
  PyObject *__pyx_v_surf = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_end = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  double __pyx_t_9;
  double __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  GLclampf __pyx_t_14;
  GLclampf __pyx_t_15;
  GLclampf __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  int __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  __Pyx_RefNannySetupContext("draw_screen", 0);
  __Pyx_INCREF(__pyx_v_flip);

  /* "renpy/gl/gldraw.pyx":810
 *         """
 * 
 *         renpy.plog(1, "start draw_screen")             # <<<<<<<<<<<<<<
 * 
 *         if renpy.config.use_drawable_resolution:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_plog); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":812
 *         renpy.plog(1, "start draw_screen")
 * 
 *         if renpy.config.use_drawable_resolution:             # <<<<<<<<<<<<<<
 *             reverse = self.virt_to_draw
 *         else:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_use_drawable_resolution); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":813
 * 
 *         if renpy.config.use_drawable_resolution:
 *             reverse = self.virt_to_draw             # <<<<<<<<<<<<<<
 *         else:
 *             reverse = IDENTITY
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_self->virt_to_draw);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_reverse = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":812
 *         renpy.plog(1, "start draw_screen")
 * 
 *         if renpy.config.use_drawable_resolution:             # <<<<<<<<<<<<<<
 *             reverse = self.virt_to_draw
 *         else:
 */
    goto __pyx_L3;
  }

  /* "renpy/gl/gldraw.pyx":815
 *             reverse = self.virt_to_draw
 *         else:
 *             reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         surftree.is_opaque()
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
    __pyx_v_reverse = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":817
 *             reverse = IDENTITY
 * 
 *         surftree.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         self.draw_render_textures(surftree, 0)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surftree, __pyx_n_s_is_opaque); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":819
 *         surftree.is_opaque()
 * 
 *         self.draw_render_textures(surftree, 0)             # <<<<<<<<<<<<<<
 * 
 *         xmul = 1.0 * self.drawable_size[0] / self.physical_size[0]
 */
  __pyx_t_5 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_render_textures(__pyx_v_self, __pyx_v_surftree, 0, 0); if (unlikely(__pyx_t_5 == ((int)1))) __PYX_ERR(0, 819, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":821
 *         self.draw_render_textures(surftree, 0)
 * 
 *         xmul = 1.0 * self.drawable_size[0] / self.physical_size[0]             # <<<<<<<<<<<<<<
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]
 * 
 */
  if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 821, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_self->physical_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 821, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_xmul = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":822
 * 
 *         xmul = 1.0 * self.drawable_size[0] / self.physical_size[0]
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]             # <<<<<<<<<<<<<<
 * 
 *         if reverse != IDENTITY:
 */
  if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 822, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_self->physical_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 822, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_ymul = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":824
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]
 * 
 *         if reverse != IDENTITY:             # <<<<<<<<<<<<<<
 *             xsize = xmul * self.physical_box[2]
 *             ysize = ymul * self.physical_box[3]
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_reverse, __pyx_v_5renpy_2gl_6gldraw_IDENTITY, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":825
 * 
 *         if reverse != IDENTITY:
 *             xsize = xmul * self.physical_box[2]             # <<<<<<<<<<<<<<
 *             ysize = ymul * self.physical_box[3]
 *         else:
 */
    if (unlikely(__pyx_v_self->physical_box == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 825, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_box, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_xmul, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 825, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_xsize = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":826
 *         if reverse != IDENTITY:
 *             xsize = xmul * self.physical_box[2]
 *             ysize = ymul * self.physical_box[3]             # <<<<<<<<<<<<<<
 *         else:
 *             xsize = self.virtual_size[0]
 */
    if (unlikely(__pyx_v_self->physical_box == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 826, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_box, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_ymul, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_ysize = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":824
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]
 * 
 *         if reverse != IDENTITY:             # <<<<<<<<<<<<<<
 *             xsize = xmul * self.physical_box[2]
 *             ysize = ymul * self.physical_box[3]
 */
    goto __pyx_L4;
  }

  /* "renpy/gl/gldraw.pyx":828
 *             ysize = ymul * self.physical_box[3]
 *         else:
 *             xsize = self.virtual_size[0]             # <<<<<<<<<<<<<<
 *             ysize = self.virtual_size[1]
 * 
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->virtual_size == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 828, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->virtual_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_xsize = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":829
 *         else:
 *             xsize = self.virtual_size[0]
 *             ysize = self.virtual_size[1]             # <<<<<<<<<<<<<<
 * 
 *         self.environ.viewport(xmul * self.physical_box[0], ymul * self.physical_box[1], xmul * self.physical_box[2], ymul * self.physical_box[3])
 */
    if (unlikely(__pyx_v_self->virtual_size == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 829, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->virtual_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_ysize = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "renpy/gl/gldraw.pyx":831
 *             ysize = self.virtual_size[1]
 * 
 *         self.environ.viewport(xmul * self.physical_box[0], ymul * self.physical_box[1], xmul * self.physical_box[2], ymul * self.physical_box[3])             # <<<<<<<<<<<<<<
 *         self.environ.ortho(0, xsize, ysize, 0, -1.0, 1.0)
 * 
 */
  if (unlikely(__pyx_v_self->physical_box == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 831, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_box, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_xmul, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_self->physical_box == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 831, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_box, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyNumber_Multiply(__pyx_v_ymul, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_v_self->physical_box == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 831, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_box, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_xmul, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_self->physical_box == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 831, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_box, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyNumber_Multiply(__pyx_v_ymul, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->viewport(__pyx_v_self->environ, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8);

  /* "renpy/gl/gldraw.pyx":832
 * 
 *         self.environ.viewport(xmul * self.physical_box[0], ymul * self.physical_box[1], xmul * self.physical_box[2], ymul * self.physical_box[3])
 *         self.environ.ortho(0, xsize, ysize, 0, -1.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_screen()
 */
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_xsize); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L1_error)
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_ysize); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L1_error)
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->ortho(__pyx_v_self->environ, 0.0, __pyx_t_9, __pyx_t_10, 0.0, -1.0, 1.0);

  /* "renpy/gl/gldraw.pyx":834
 *         self.environ.ortho(0, xsize, ysize, 0, -1.0, 1.0)
 * 
 *         self.clip_mode_screen()             # <<<<<<<<<<<<<<
 * 
 *         clear_r, clear_g, clear_b = renpy.color.Color(renpy.config.gl_clear_color).rgb
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clip_mode_screen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":836
 *         self.clip_mode_screen()
 * 
 *         clear_r, clear_g, clear_b = renpy.color.Color(renpy.config.gl_clear_color).rgb             # <<<<<<<<<<<<<<
 *         glClearColor(clear_r, clear_g, clear_b, 1.0)
 *         glClear(GL_COLOR_BUFFER_BIT)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_color); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_config); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_gl_clear_color); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_11) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_1};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_1};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rgb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 836, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_13 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_12 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_12)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_12);
    index = 2; __pyx_t_1 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_11), 3) < 0) __PYX_ERR(0, 836, __pyx_L1_error)
    __pyx_t_13 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_13 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 836, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_clear_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_clear_g = __pyx_t_12;
  __pyx_t_12 = 0;
  __pyx_v_clear_b = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":837
 * 
 *         clear_r, clear_g, clear_b = renpy.color.Color(renpy.config.gl_clear_color).rgb
 *         glClearColor(clear_r, clear_g, clear_b, 1.0)             # <<<<<<<<<<<<<<
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 */
  __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_clear_r); if (unlikely((__pyx_t_14 == ((GLclampf)-1)) && PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L1_error)
  __pyx_t_15 = __pyx_PyFloat_AsFloat(__pyx_v_clear_g); if (unlikely((__pyx_t_15 == ((GLclampf)-1)) && PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L1_error)
  __pyx_t_16 = __pyx_PyFloat_AsFloat(__pyx_v_clear_b); if (unlikely((__pyx_t_16 == ((GLclampf)-1)) && PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L1_error)
  __pyx_t_8 = __pyx_f_5renpy_2gl_2gl_glClearColor(__pyx_t_14, __pyx_t_15, __pyx_t_16, 1.0); if (unlikely(__pyx_t_8 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":838
 *         clear_r, clear_g, clear_b = renpy.color.Color(renpy.config.gl_clear_color).rgb
 *         glClearColor(clear_r, clear_g, clear_b, 1.0)
 *         glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *         self.default_clip = (0, 0, xsize, ysize)
 */
  __pyx_t_8 = __pyx_f_5renpy_2gl_2gl_glClear(GL_COLOR_BUFFER_BIT); if (unlikely(__pyx_t_8 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 838, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":840
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 *         self.default_clip = (0, 0, xsize, ysize)             # <<<<<<<<<<<<<<
 *         clip = self.default_clip
 * 
 */
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_v_xsize);
  __Pyx_GIVEREF(__pyx_v_xsize);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_xsize);
  __Pyx_INCREF(__pyx_v_ysize);
  __Pyx_GIVEREF(__pyx_v_ysize);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_ysize);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->default_clip);
  __Pyx_DECREF(__pyx_v_self->default_clip);
  __pyx_v_self->default_clip = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":841
 * 
 *         self.default_clip = (0, 0, xsize, ysize)
 *         clip = self.default_clip             # <<<<<<<<<<<<<<
 * 
 *         if renpy.display.video.fullscreen:
 */
  __pyx_t_4 = __pyx_v_self->default_clip;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_clip = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":843
 *         clip = self.default_clip
 * 
 *         if renpy.display.video.fullscreen:             # <<<<<<<<<<<<<<
 *             surf = renpy.display.video.render_movie("movie", self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_video); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_fullscreen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":844
 * 
 *         if renpy.display.video.fullscreen:
 *             surf = renpy.display.video.render_movie("movie", self.virtual_size[0], self.virtual_size[1])             # <<<<<<<<<<<<<<
 *             if surf is not None:
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_video); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_render_movie); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_self->virtual_size == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 844, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->virtual_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_v_self->virtual_size == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 844, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->virtual_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_n_s_movie, __pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_n_s_movie, __pyx_t_4, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_n_s_movie);
      __Pyx_GIVEREF(__pyx_n_s_movie);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_8, __pyx_n_s_movie);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_8, __pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_surf = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":845
 *         if renpy.display.video.fullscreen:
 *             surf = renpy.display.video.render_movie("movie", self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 *             else:
 */
    __pyx_t_3 = (__pyx_v_surf != Py_None);
    __pyx_t_18 = (__pyx_t_3 != 0);
    if (__pyx_t_18) {

      /* "renpy/gl/gldraw.pyx":846
 *             surf = renpy.display.video.render_movie("movie", self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)             # <<<<<<<<<<<<<<
 *             else:
 *                 flip = False
 */
      if (!(likely(((__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_reverse, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 846, __pyx_L1_error)
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_config); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_nearest_neighbor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 846, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_surf, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_v_reverse), __pyx_t_18, 0, 0); if (unlikely(__pyx_t_8 == ((int)1))) __PYX_ERR(0, 846, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":845
 *         if renpy.display.video.fullscreen:
 *             surf = renpy.display.video.render_movie("movie", self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 *             else:
 */
      goto __pyx_L8;
    }

    /* "renpy/gl/gldraw.pyx":848
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 *             else:
 *                 flip = False             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    /*else*/ {
      __Pyx_INCREF(Py_False);
      __Pyx_DECREF_SET(__pyx_v_flip, Py_False);
    }
    __pyx_L8:;

    /* "renpy/gl/gldraw.pyx":843
 *         clip = self.default_clip
 * 
 *         if renpy.display.video.fullscreen:             # <<<<<<<<<<<<<<
 *             surf = renpy.display.video.render_movie("movie", self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:
 */
    goto __pyx_L7;
  }

  /* "renpy/gl/gldraw.pyx":851
 * 
 *         else:
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)             # <<<<<<<<<<<<<<
 * 
 *         if flip:
 */
  /*else*/ {
    if (!(likely(((__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_reverse, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 851, __pyx_L1_error)
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_config); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_nearest_neighbor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_surftree, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_v_reverse), __pyx_t_18, 0, 0); if (unlikely(__pyx_t_8 == ((int)1))) __PYX_ERR(0, 851, __pyx_L1_error)
  }
  __pyx_L7:;

  /* "renpy/gl/gldraw.pyx":853
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 * 
 *         if flip:             # <<<<<<<<<<<<<<
 * 
 *             self.draw_mouse()
 */
  __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_flip); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 853, __pyx_L1_error)
  if (__pyx_t_18) {

    /* "renpy/gl/gldraw.pyx":855
 *         if flip:
 * 
 *             self.draw_mouse()             # <<<<<<<<<<<<<<
 * 
 *             start = time.time()
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw_mouse); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 855, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (__pyx_t_17) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":857
 *             self.draw_mouse()
 * 
 *             start = time.time()             # <<<<<<<<<<<<<<
 * 
 *             renpy.plog(1, "flip")
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_time); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_17);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_17, function);
      }
    }
    if (__pyx_t_12) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_v_start = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":859
 *             start = time.time()
 * 
 *             renpy.plog(1, "flip")             # <<<<<<<<<<<<<<
 * 
 *             if EGL:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_plog); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":861
 *             renpy.plog(1, "flip")
 * 
 *             if EGL:             # <<<<<<<<<<<<<<
 *                 egl_swap()
 *             else:
 */
    __pyx_t_18 = (__pyx_v_5renpy_2gl_6gldraw_EGL != 0);
    if (__pyx_t_18) {

      /* "renpy/gl/gldraw.pyx":862
 * 
 *             if EGL:
 *                 egl_swap()             # <<<<<<<<<<<<<<
 *             else:
 *                 pygame.display.flip()
 */
      egl_swap();

      /* "renpy/gl/gldraw.pyx":861
 *             renpy.plog(1, "flip")
 * 
 *             if EGL:             # <<<<<<<<<<<<<<
 *                 egl_swap()
 *             else:
 */
      goto __pyx_L10;
    }

    /* "renpy/gl/gldraw.pyx":864
 *                 egl_swap()
 *             else:
 *                 pygame.display.flip()             # <<<<<<<<<<<<<<
 * 
 *             end = time.time()
 */
    /*else*/ {
      __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_display); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_flip); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_17);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_17, function);
        }
      }
      if (__pyx_t_12) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L10:;

    /* "renpy/gl/gldraw.pyx":866
 *                 pygame.display.flip()
 * 
 *             end = time.time()             # <<<<<<<<<<<<<<
 * 
 *             if vsync:
 */
    __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 866, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_time); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 866, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_17 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (__pyx_t_17) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_end = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":868
 *             end = time.time()
 * 
 *             if vsync:             # <<<<<<<<<<<<<<
 * 
 *                 # When the window is covered, we can get into a state where no
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vsync); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 868, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_18) {

      /* "renpy/gl/gldraw.pyx":874
 *                 # sleep.
 * 
 *                 frame_times.append(end)             # <<<<<<<<<<<<<<
 * 
 *                 if len(frame_times) > 10:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_frame_times); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 874, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_19 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_end); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 874, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":876
 *                 frame_times.append(end)
 * 
 *                 if len(frame_times) > 10:             # <<<<<<<<<<<<<<
 *                     frame_times.pop(0)
 * 
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_frame_times); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_20 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 876, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_18 = ((__pyx_t_20 > 10) != 0);
      if (__pyx_t_18) {

        /* "renpy/gl/gldraw.pyx":877
 * 
 *                 if len(frame_times) > 10:
 *                     frame_times.pop(0)             # <<<<<<<<<<<<<<
 * 
 *                     # If we're running at over 1000 fps, vsync is broken.
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_frame_times); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = __Pyx_PyObject_PopIndex(__pyx_t_1, __pyx_int_0, 0, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 877, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "renpy/gl/gldraw.pyx":880
 * 
 *                     # If we're running at over 1000 fps, vsync is broken.
 *                     if (frame_times[-1] - frame_times[0] < .001 * 10):             # <<<<<<<<<<<<<<
 *                         time.sleep(1.0 / 120.0)
 *                         renpy.plog(1, "after broken vsync sleep")
 */
        __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_frame_times); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_12, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_frame_times); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_17 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyNumber_Subtract(__pyx_t_1, __pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = PyFloat_FromDouble((.001 * 10.0)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_12, __pyx_t_17, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 880, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_18) {

          /* "renpy/gl/gldraw.pyx":881
 *                     # If we're running at over 1000 fps, vsync is broken.
 *                     if (frame_times[-1] - frame_times[0] < .001 * 10):
 *                         time.sleep(1.0 / 120.0)             # <<<<<<<<<<<<<<
 *                         renpy.plog(1, "after broken vsync sleep")
 * 
 */
          __pyx_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_sleep); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_17 = PyFloat_FromDouble((1.0 / 120.0)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __pyx_t_2 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          if (!__pyx_t_2) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_12)) {
              PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_17};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
              PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_17};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            } else
            #endif
            {
              __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 881, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
              __Pyx_GIVEREF(__pyx_t_17);
              PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_17);
              __pyx_t_17 = 0;
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "renpy/gl/gldraw.pyx":882
 *                     if (frame_times[-1] - frame_times[0] < .001 * 10):
 *                         time.sleep(1.0 / 120.0)
 *                         renpy.plog(1, "after broken vsync sleep")             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_plog); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "renpy/gl/gldraw.pyx":880
 * 
 *                     # If we're running at over 1000 fps, vsync is broken.
 *                     if (frame_times[-1] - frame_times[0] < .001 * 10):             # <<<<<<<<<<<<<<
 *                         time.sleep(1.0 / 120.0)
 *                         renpy.plog(1, "after broken vsync sleep")
 */
        }

        /* "renpy/gl/gldraw.pyx":876
 *                 frame_times.append(end)
 * 
 *                 if len(frame_times) > 10:             # <<<<<<<<<<<<<<
 *                     frame_times.pop(0)
 * 
 */
      }

      /* "renpy/gl/gldraw.pyx":868
 *             end = time.time()
 * 
 *             if vsync:             # <<<<<<<<<<<<<<
 * 
 *                 # When the window is covered, we can get into a state where no
 */
    }

    /* "renpy/gl/gldraw.pyx":853
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 * 
 *         if flip:             # <<<<<<<<<<<<<<
 * 
 *             self.draw_mouse()
 */
  }

  /* "renpy/gl/gldraw.pyx":885
 * 
 * 
 *         gltexture.cleanup()             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned) except 1:
 */
  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_cleanup); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_12) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":805
 * 
 * 
 *     def draw_screen(self, surftree, fullscreen_video, flip=True):             # <<<<<<<<<<<<<<
 *         """
 *         Draws the screen.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_reverse);
  __Pyx_XDECREF(__pyx_v_xmul);
  __Pyx_XDECREF(__pyx_v_ymul);
  __Pyx_XDECREF(__pyx_v_xsize);
  __Pyx_XDECREF(__pyx_v_ysize);
  __Pyx_XDECREF(__pyx_v_clear_r);
  __Pyx_XDECREF(__pyx_v_clear_g);
  __Pyx_XDECREF(__pyx_v_clear_b);
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XDECREF(__pyx_v_flip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":887
 *         gltexture.cleanup()
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned) except 1:             # <<<<<<<<<<<<<<
 *         """
 *         This is responsible for rendering things to textures,
 */

static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned, int __pyx_skip_dispatch) {
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rend = 0;
  int __pyx_v_render_what;
  int __pyx_v_first;
  PyObject *__pyx_v_child = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_cxo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_cyo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_pc = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  __Pyx_RefNannySetupContext("draw_render_textures", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw_render_textures); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 887, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31draw_render_textures)) {
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_non_aligned); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_what, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_what, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_v_what);
        __Pyx_GIVEREF(__pyx_v_what);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_what);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/gl/gldraw.pyx":896
 *         cdef bint render_what
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_what, __pyx_ptype_5renpy_7display_6render_Render); 
  __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":897
 * 
 *         if not isinstance(what, render.Render):
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         rend = <render.Render> what
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":896
 *         cdef bint render_what
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":899
 *             return 0
 * 
 *         rend = <render.Render> what             # <<<<<<<<<<<<<<
 * 
 *         render_what = False
 */
  __pyx_t_1 = __pyx_v_what;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":901
 *         rend = <render.Render> what
 * 
 *         render_what = False             # <<<<<<<<<<<<<<
 * 
 *         if (rend.xclipping or rend.yclipping) and non_aligned:
 */
  __pyx_v_render_what = 0;

  /* "renpy/gl/gldraw.pyx":903
 *         render_what = False
 * 
 *         if (rend.xclipping or rend.yclipping) and non_aligned:             # <<<<<<<<<<<<<<
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:
 *                 render_what = True
 */
  __pyx_t_8 = (__pyx_v_rend->xclipping != 0);
  if (!__pyx_t_8) {
  } else {
    goto __pyx_L6_next_and;
  }
  __pyx_t_8 = (__pyx_v_rend->yclipping != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_9 = __pyx_t_8;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_L6_next_and:;
  __pyx_t_8 = (__pyx_v_non_aligned != 0);
  __pyx_t_9 = __pyx_t_8;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":904
 * 
 *         if (rend.xclipping or rend.yclipping) and non_aligned:
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:             # <<<<<<<<<<<<<<
 *                 render_what = True
 *                 non_aligned = False
 */
    __pyx_t_8 = ((__pyx_v_rend->forward->xdy != 0.0) != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_9 = __pyx_t_8;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_rend->forward->ydx != 0.0) != 0);
    __pyx_t_9 = __pyx_t_8;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":905
 *         if (rend.xclipping or rend.yclipping) and non_aligned:
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:
 *                 render_what = True             # <<<<<<<<<<<<<<
 *                 non_aligned = False
 * 
 */
      __pyx_v_render_what = 1;

      /* "renpy/gl/gldraw.pyx":906
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:
 *                 render_what = True
 *                 non_aligned = False             # <<<<<<<<<<<<<<
 * 
 *         first = True
 */
      __pyx_v_non_aligned = 0;

      /* "renpy/gl/gldraw.pyx":904
 * 
 *         if (rend.xclipping or rend.yclipping) and non_aligned:
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:             # <<<<<<<<<<<<<<
 *                 render_what = True
 *                 non_aligned = False
 */
    }

    /* "renpy/gl/gldraw.pyx":903
 *         render_what = False
 * 
 *         if (rend.xclipping or rend.yclipping) and non_aligned:             # <<<<<<<<<<<<<<
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:
 *                 render_what = True
 */
  }

  /* "renpy/gl/gldraw.pyx":908
 *                 non_aligned = False
 * 
 *         first = True             # <<<<<<<<<<<<<<
 * 
 *         if rend.forward:
 */
  __pyx_v_first = 1;

  /* "renpy/gl/gldraw.pyx":910
 *         first = True
 * 
 *         if rend.forward:             # <<<<<<<<<<<<<<
 *             non_aligned |= (rend.forward.xdy != 0)
 *             non_aligned |= (rend.forward.ydy != 0)
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_rend->forward)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 910, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":911
 * 
 *         if rend.forward:
 *             non_aligned |= (rend.forward.xdy != 0)             # <<<<<<<<<<<<<<
 *             non_aligned |= (rend.forward.ydy != 0)
 * 
 */
    __pyx_v_non_aligned = (__pyx_v_non_aligned | (__pyx_v_rend->forward->xdy != 0.0));

    /* "renpy/gl/gldraw.pyx":912
 *         if rend.forward:
 *             non_aligned |= (rend.forward.xdy != 0)
 *             non_aligned |= (rend.forward.ydy != 0)             # <<<<<<<<<<<<<<
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:
 */
    __pyx_v_non_aligned = (__pyx_v_non_aligned | (__pyx_v_rend->forward->ydy != 0.0));

    /* "renpy/gl/gldraw.pyx":910
 *         first = True
 * 
 *         if rend.forward:             # <<<<<<<<<<<<<<
 *             non_aligned |= (rend.forward.xdy != 0)
 *             non_aligned |= (rend.forward.ydy != 0)
 */
  }

  /* "renpy/gl/gldraw.pyx":914
 *             non_aligned |= (rend.forward.ydy != 0)
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:             # <<<<<<<<<<<<<<
 * 
 *             self.draw_render_textures(child, non_aligned)
 */
  if (unlikely(__pyx_v_rend->visible_children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 914, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_rend->visible_children; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0;
  for (;;) {
    if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 914, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 914, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_11);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_4,&__pyx_t_7,&__pyx_t_3,&__pyx_t_5,&__pyx_t_11};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 914, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_4,&__pyx_t_7,&__pyx_t_3,&__pyx_t_5,&__pyx_t_11};
      __pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_13(__pyx_t_12); if (unlikely(!item)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 5) < 0) __PYX_ERR(0, 914, __pyx_L1_error)
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 914, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cxo, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cyo, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "renpy/gl/gldraw.pyx":916
 *         for child, cxo, cyo, focus, main in rend.visible_children:
 * 
 *             self.draw_render_textures(child, non_aligned)             # <<<<<<<<<<<<<<
 * 
 *             if rend.operation == DISSOLVE:
 */
    __pyx_t_6 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_render_textures(__pyx_v_self, __pyx_v_child, __pyx_v_non_aligned, 0); if (unlikely(__pyx_t_6 == ((int)1))) __PYX_ERR(0, 916, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":918
 *             self.draw_render_textures(child, non_aligned)
 * 
 *             if rend.operation == DISSOLVE:             # <<<<<<<<<<<<<<
 *                 if not self.fast_dissolve:
 *                     child.render_to_texture(what.operation_alpha)
 */
    __pyx_t_9 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_DISSOLVE) != 0);
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":919
 * 
 *             if rend.operation == DISSOLVE:
 *                 if not self.fast_dissolve:             # <<<<<<<<<<<<<<
 *                     child.render_to_texture(what.operation_alpha)
 * 
 */
      __pyx_t_9 = ((!(__pyx_v_self->fast_dissolve != 0)) != 0);
      if (__pyx_t_9) {

        /* "renpy/gl/gldraw.pyx":920
 *             if rend.operation == DISSOLVE:
 *                 if not self.fast_dissolve:
 *                     child.render_to_texture(what.operation_alpha)             # <<<<<<<<<<<<<<
 * 
 *             elif rend.operation == IMAGEDISSOLVE:
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 920, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_alpha); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 920, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        if (!__pyx_t_3) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          {
            __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 920, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 920, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "renpy/gl/gldraw.pyx":919
 * 
 *             if rend.operation == DISSOLVE:
 *                 if not self.fast_dissolve:             # <<<<<<<<<<<<<<
 *                     child.render_to_texture(what.operation_alpha)
 * 
 */
      }

      /* "renpy/gl/gldraw.pyx":918
 *             self.draw_render_textures(child, non_aligned)
 * 
 *             if rend.operation == DISSOLVE:             # <<<<<<<<<<<<<<
 *                 if not self.fast_dissolve:
 *                     child.render_to_texture(what.operation_alpha)
 */
      goto __pyx_L16;
    }

    /* "renpy/gl/gldraw.pyx":922
 *                     child.render_to_texture(what.operation_alpha)
 * 
 *             elif rend.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 *                 child.render_to_texture(first or what.operation_alpha)
 *                 first = False
 */
    __pyx_t_9 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE) != 0);
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":923
 * 
 *             elif rend.operation == IMAGEDISSOLVE:
 *                 child.render_to_texture(first or what.operation_alpha)             # <<<<<<<<<<<<<<
 *                 first = False
 * 
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (!__pyx_v_first) {
      } else {
        __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_first); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_alpha); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = __pyx_t_5;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_L18_bool_binop_done:;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":924
 *             elif rend.operation == IMAGEDISSOLVE:
 *                 child.render_to_texture(first or what.operation_alpha)
 *                 first = False             # <<<<<<<<<<<<<<
 * 
 *             elif rend.operation == PIXELLATE:
 */
      __pyx_v_first = 0;

      /* "renpy/gl/gldraw.pyx":922
 *                     child.render_to_texture(what.operation_alpha)
 * 
 *             elif rend.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 *                 child.render_to_texture(first or what.operation_alpha)
 *                 first = False
 */
      goto __pyx_L16;
    }

    /* "renpy/gl/gldraw.pyx":926
 *                 first = False
 * 
 *             elif rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *                 p = rend.operation_parameter
 *                 pc = child
 */
    __pyx_t_9 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_PIXELLATE) != 0);
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":927
 * 
 *             elif rend.operation == PIXELLATE:
 *                 p = rend.operation_parameter             # <<<<<<<<<<<<<<
 *                 pc = child
 * 
 */
      __pyx_t_2 = __pyx_v_rend->operation_parameter;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":928
 *             elif rend.operation == PIXELLATE:
 *                 p = rend.operation_parameter
 *                 pc = child             # <<<<<<<<<<<<<<
 * 
 *                 while p > 1:
 */
      __Pyx_INCREF(__pyx_v_child);
      __Pyx_XDECREF_SET(__pyx_v_pc, __pyx_v_child);

      /* "renpy/gl/gldraw.pyx":930
 *                 pc = child
 * 
 *                 while p > 1:             # <<<<<<<<<<<<<<
 *                     p /= 2
 *                     pc = self.get_half(pc)
 */
      while (1) {
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error)
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 930, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (!__pyx_t_9) break;

        /* "renpy/gl/gldraw.pyx":931
 * 
 *                 while p > 1:
 *                     p /= 2             # <<<<<<<<<<<<<<
 *                     pc = self.get_half(pc)
 * 
 */
        __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_p, __pyx_int_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 931, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "renpy/gl/gldraw.pyx":932
 *                 while p > 1:
 *                     p /= 2
 *                     pc = self.get_half(pc)             # <<<<<<<<<<<<<<
 * 
 *             elif rend.operation == FLATTEN:
 */
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_half); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 932, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        if (!__pyx_t_3) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_pc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_pc};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_2);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_pc};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_2);
          } else
          #endif
          {
            __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 932, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_v_pc);
            __Pyx_GIVEREF(__pyx_v_pc);
            PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_pc);
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF_SET(__pyx_v_pc, __pyx_t_2);
        __pyx_t_2 = 0;
      }

      /* "renpy/gl/gldraw.pyx":926
 *                 first = False
 * 
 *             elif rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *                 p = rend.operation_parameter
 *                 pc = child
 */
      goto __pyx_L16;
    }

    /* "renpy/gl/gldraw.pyx":934
 *                     pc = self.get_half(pc)
 * 
 *             elif rend.operation == FLATTEN:             # <<<<<<<<<<<<<<
 *                 child.render_to_texture(True)
 * 
 */
    __pyx_t_9 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_FLATTEN) != 0);
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":935
 * 
 *             elif rend.operation == FLATTEN:
 *                 child.render_to_texture(True)             # <<<<<<<<<<<<<<
 * 
 *         if render_what:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "renpy/gl/gldraw.pyx":934
 *                     pc = self.get_half(pc)
 * 
 *             elif rend.operation == FLATTEN:             # <<<<<<<<<<<<<<
 *                 child.render_to_texture(True)
 * 
 */
    }
    __pyx_L16:;

    /* "renpy/gl/gldraw.pyx":914
 *             non_aligned |= (rend.forward.ydy != 0)
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:             # <<<<<<<<<<<<<<
 * 
 *             self.draw_render_textures(child, non_aligned)
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":937
 *                 child.render_to_texture(True)
 * 
 *         if render_what:             # <<<<<<<<<<<<<<
 *             what.render_to_texture(True)
 * 
 */
  __pyx_t_9 = (__pyx_v_render_what != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":938
 * 
 *         if render_what:
 *             what.render_to_texture(True)             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_transformed(
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "renpy/gl/gldraw.pyx":937
 *                 child.render_to_texture(True)
 * 
 *         if render_what:             # <<<<<<<<<<<<<<
 *             what.render_to_texture(True)
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":887
 *         gltexture.cleanup()
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned) except 1:             # <<<<<<<<<<<<<<
 *         """
 *         This is responsible for rendering things to textures,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rend);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_cxo);
  __Pyx_XDECREF(__pyx_v_cyo);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_30draw_render_textures[] = "\n        This is responsible for rendering things to textures,\n        as necessary.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  int __pyx_v_non_aligned;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_render_textures (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_what,&__pyx_n_s_non_aligned,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_non_aligned)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_render_textures", 1, 2, 2, 1); __PYX_ERR(0, 887, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_render_textures") < 0)) __PYX_ERR(0, 887, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_what = values[0];
    __pyx_v_non_aligned = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_non_aligned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_render_textures", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 887, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30draw_render_textures(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_non_aligned);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("draw_render_textures", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_render_textures(__pyx_v_self, __pyx_v_what, __pyx_v_non_aligned, 1); if (unlikely(__pyx_t_1 == ((int)1))) __PYX_ERR(0, 887, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":940
 *             what.render_to_texture(True)
 * 
 *     cpdef int draw_transformed(             # <<<<<<<<<<<<<<
 *         GLDraw self,
 *         object what,
 */

static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_reverse, int __pyx_v_nearest, int __pyx_v_subpixel, int __pyx_skip_dispatch) {
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rend = 0;
  double __pyx_v_cxo;
  double __pyx_v_cyo;
  double __pyx_v_tcxo;
  double __pyx_v_tcyo;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_child_reverse = 0;
  PyObject *__pyx_v_tex = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_pc = NULL;
  PyObject *__pyx_v_minx = NULL;
  PyObject *__pyx_v_miny = NULL;
  PyObject *__pyx_v_maxx = NULL;
  PyObject *__pyx_v_maxy = NULL;
  PyObject *__pyx_v_tw = NULL;
  PyObject *__pyx_v_th = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_cx = NULL;
  PyObject *__pyx_v_cy = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  double __pyx_t_15;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  __Pyx_RefNannySetupContext("draw_transformed", 0);
  __Pyx_INCREF(__pyx_v_clip);
  __Pyx_INCREF((PyObject *)__pyx_v_reverse);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw_transformed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33draw_transformed)) {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_over); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_nearest); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_subpixel); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_9 = __pyx_t_1; __pyx_t_10 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[10] = {__pyx_t_10, __pyx_v_what, __pyx_v_clip, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_reverse), __pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 9+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[10] = {__pyx_t_10, __pyx_v_what, __pyx_v_clip, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_reverse), __pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 9+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(9+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 940, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_INCREF(__pyx_v_what);
        __Pyx_GIVEREF(__pyx_v_what);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_what);
        __Pyx_INCREF(__pyx_v_clip);
        __Pyx_GIVEREF(__pyx_v_clip);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_clip);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_11, __pyx_t_6);
        __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_reverse));
        PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_11, ((PyObject *)__pyx_v_reverse));
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_12, 7+__pyx_t_11, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_12, 8+__pyx_t_11, __pyx_t_8);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_11;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/gl/gldraw.pyx":956
 *         cdef Matrix child_reverse
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, gltexture.TextureGrid):
 */
  __pyx_t_13 = __Pyx_TypeCheck(__pyx_v_what, __pyx_ptype_5renpy_7display_6render_Render); 
  __pyx_t_14 = ((!(__pyx_t_13 != 0)) != 0);
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":958
 *         if not isinstance(what, render.Render):
 * 
 *             if isinstance(what, gltexture.TextureGrid):             # <<<<<<<<<<<<<<
 * 
 *                 if (not subpixel) and reverse.is_unit_aligned():
 */
    __pyx_t_14 = __Pyx_TypeCheck(__pyx_v_what, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid); 
    __pyx_t_13 = (__pyx_t_14 != 0);
    if (__pyx_t_13) {

      /* "renpy/gl/gldraw.pyx":960
 *             if isinstance(what, gltexture.TextureGrid):
 * 
 *                 if (not subpixel) and reverse.is_unit_aligned():             # <<<<<<<<<<<<<<
 *                     xo = round(xo)
 *                     yo = round(yo)
 */
      __pyx_t_14 = ((!(__pyx_v_subpixel != 0)) != 0);
      if (__pyx_t_14) {
      } else {
        __pyx_t_13 = __pyx_t_14;
        goto __pyx_L6_bool_binop_done;
      }
      __pyx_t_14 = (((struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix *)__pyx_v_reverse->__pyx_vtab)->is_unit_aligned(__pyx_v_reverse, 0) != 0);
      __pyx_t_13 = __pyx_t_14;
      __pyx_L6_bool_binop_done:;
      if (__pyx_t_13) {

        /* "renpy/gl/gldraw.pyx":961
 * 
 *                 if (not subpixel) and reverse.is_unit_aligned():
 *                     xo = round(xo)             # <<<<<<<<<<<<<<
 *                     yo = round(yo)
 * 
 */
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_xo = __pyx_t_15;

        /* "renpy/gl/gldraw.pyx":962
 *                 if (not subpixel) and reverse.is_unit_aligned():
 *                     xo = round(xo)
 *                     yo = round(yo)             # <<<<<<<<<<<<<<
 * 
 *                 self.set_clip(clip)
 */
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_yo = __pyx_t_15;

        /* "renpy/gl/gldraw.pyx":960
 *             if isinstance(what, gltexture.TextureGrid):
 * 
 *                 if (not subpixel) and reverse.is_unit_aligned():             # <<<<<<<<<<<<<<
 *                     xo = round(xo)
 *                     yo = round(yo)
 */
      }

      /* "renpy/gl/gldraw.pyx":964
 *                     yo = round(yo)
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blit(
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":973
 *                     alpha,
 *                     over,
 *                     self.environ,             # <<<<<<<<<<<<<<
 *                     nearest)
 * 
 */
      __pyx_t_1 = ((PyObject *)__pyx_v_self->environ);
      __Pyx_INCREF(__pyx_t_1);

      /* "renpy/gl/gldraw.pyx":966
 *                 self.set_clip(clip)
 * 
 *                 gltexture.blit(             # <<<<<<<<<<<<<<
 *                     <gltexture.TextureGrid> what,
 *                     xo,
 */
      __pyx_t_2 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_v_what), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_1), __pyx_v_nearest, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":976
 *                     nearest)
 * 
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, pygame.Surface):
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":958
 *         if not isinstance(what, render.Render):
 * 
 *             if isinstance(what, gltexture.TextureGrid):             # <<<<<<<<<<<<<<
 * 
 *                 if (not subpixel) and reverse.is_unit_aligned():
 */
    }

    /* "renpy/gl/gldraw.pyx":978
 *                 return 0
 * 
 *             if isinstance(what, pygame.Surface):             # <<<<<<<<<<<<<<
 * 
 *                 tex = self.load_texture(what)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = PyObject_IsInstance(__pyx_v_what, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 978, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = (__pyx_t_13 != 0);
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":980
 *             if isinstance(what, pygame.Surface):
 * 
 *                 tex = self.load_texture(what)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse, nearest, subpixel)
 *                 return 0
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_load_texture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_what); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_what};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_what};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 980, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_INCREF(__pyx_v_what);
          __Pyx_GIVEREF(__pyx_v_what);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_what);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_tex = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":981
 * 
 *                 tex = self.load_texture(what)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse, nearest, subpixel)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      __pyx_t_11 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_tex, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, __pyx_v_nearest, __pyx_v_subpixel, 0); if (unlikely(__pyx_t_11 == ((int)1))) __PYX_ERR(0, 981, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":982
 *                 tex = self.load_texture(what)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse, nearest, subpixel)
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             raise Exception("Unknown drawing type. " + repr(what))
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":978
 *                 return 0
 * 
 *             if isinstance(what, pygame.Surface):             # <<<<<<<<<<<<<<
 * 
 *                 tex = self.load_texture(what)
 */
    }

    /* "renpy/gl/gldraw.pyx":984
 *                 return 0
 * 
 *             raise Exception("Unknown drawing type. " + repr(what))             # <<<<<<<<<<<<<<
 * 
 *         rend = what
 */
    __pyx_t_1 = PyObject_Repr(__pyx_v_what); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_Unknown_drawing_type, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 984, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":956
 *         cdef Matrix child_reverse
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, gltexture.TextureGrid):
 */
  }

  /* "renpy/gl/gldraw.pyx":986
 *             raise Exception("Unknown drawing type. " + repr(what))
 * 
 *         rend = what             # <<<<<<<<<<<<<<
 * 
 *         if rend.text_input:
 */
  if (!(likely(((__pyx_v_what) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_what, __pyx_ptype_5renpy_7display_6render_Render))))) __PYX_ERR(0, 986, __pyx_L1_error)
  __pyx_t_2 = __pyx_v_what;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":988
 *         rend = what
 * 
 *         if rend.text_input:             # <<<<<<<<<<<<<<
 *             renpy.display.interface.text_rect = rend.screen_rect(xo, yo, reverse)
 * 
 */
  __pyx_t_14 = (__pyx_v_rend->text_input != 0);
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":989
 * 
 *         if rend.text_input:
 *             renpy.display.interface.text_rect = rend.screen_rect(xo, yo, reverse)             # <<<<<<<<<<<<<<
 * 
 *         # Other draw modes.
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rend), __pyx_n_s_screen_rect); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_12, __pyx_t_9, ((PyObject *)__pyx_v_reverse)};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_12, __pyx_t_9, ((PyObject *)__pyx_v_reverse)};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_11, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_11, __pyx_t_9);
      __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_reverse));
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_11, ((PyObject *)__pyx_v_reverse));
      __pyx_t_12 = 0;
      __pyx_t_9 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_display); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_text_rect, __pyx_t_2) < 0) __PYX_ERR(0, 989, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":988
 *         rend = what
 * 
 *         if rend.text_input:             # <<<<<<<<<<<<<<
 *             renpy.display.interface.text_rect = rend.screen_rect(xo, yo, reverse)
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":993
 *         # Other draw modes.
 * 
 *         if rend.operation == DISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             if self.fast_dissolve:
 */
  __pyx_t_14 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_DISSOLVE) != 0);
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":995
 *         if rend.operation == DISSOLVE:
 * 
 *             if self.fast_dissolve:             # <<<<<<<<<<<<<<
 * 
 *                 # This is a fast version of dissolve that's used on
 */
    __pyx_t_14 = (__pyx_v_self->fast_dissolve != 0);
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":1001
 *                 # of dissolve on Ren'Py proper.
 * 
 *                 self.draw_transformed(rend.children[0][0], clip, xo, yo, alpha, over, reverse, nearest, subpixel)             # <<<<<<<<<<<<<<
 * 
 *                 self.draw_transformed(rend.children[1][0], clip, xo, yo, alpha * what.operation_complete, over, reverse, nearest, subpixel)
 */
      if (unlikely(__pyx_v_rend->children == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1001, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_t_2, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, __pyx_v_nearest, __pyx_v_subpixel, 0); if (unlikely(__pyx_t_11 == ((int)1))) __PYX_ERR(0, 1001, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":1003
 *                 self.draw_transformed(rend.children[0][0], clip, xo, yo, alpha, over, reverse, nearest, subpixel)
 * 
 *                 self.draw_transformed(rend.children[1][0], clip, xo, yo, alpha * what.operation_complete, over, reverse, nearest, subpixel)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      if (unlikely(__pyx_v_rend->children == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1003, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_complete); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyNumber_Multiply(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_11 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_t_1, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_t_15, __pyx_v_over, __pyx_v_reverse, __pyx_v_nearest, __pyx_v_subpixel, 0); if (unlikely(__pyx_t_11 == ((int)1))) __PYX_ERR(0, 1003, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":995
 *         if rend.operation == DISSOLVE:
 * 
 *             if self.fast_dissolve:             # <<<<<<<<<<<<<<
 * 
 *                 # This is a fast version of dissolve that's used on
 */
      goto __pyx_L11;
    }

    /* "renpy/gl/gldraw.pyx":1007
 *             else:
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blend(
 */
    /*else*/ {
      __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":1010
 * 
 *                 gltexture.blend(
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),
 *                     xo,
 */
      if (unlikely(__pyx_v_rend->children == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1010, __pyx_L1_error)
      }
      __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_alpha); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1010, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1010, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":1011
 *                 gltexture.blend(
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                     xo,
 *                     yo,
 */
      if (unlikely(__pyx_v_rend->children == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1011, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_alpha); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1011, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1011, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_12)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1011, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_7};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1011, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1011, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1011, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1011, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":1014
 *                     xo,
 *                     yo,
 *                     reverse * self.draw_to_virt,             # <<<<<<<<<<<<<<
 *                     alpha,
 *                     over,
 */
      __pyx_t_12 = PyNumber_Multiply(((PyObject *)__pyx_v_reverse), ((PyObject *)__pyx_v_self->draw_to_virt)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1014, __pyx_L1_error)

      /* "renpy/gl/gldraw.pyx":1018
 *                     over,
 *                     rend.operation_complete,
 *                     self.environ,             # <<<<<<<<<<<<<<
 *                     nearest)
 * 
 */
      __pyx_t_8 = ((PyObject *)__pyx_v_self->environ);
      __Pyx_INCREF(__pyx_t_8);

      /* "renpy/gl/gldraw.pyx":1009
 *                 self.set_clip(clip)
 * 
 *                 gltexture.blend(             # <<<<<<<<<<<<<<
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),
 */
      __pyx_t_7 = __pyx_f_5renpy_2gl_9gltexture_blend(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_1), ((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_9), __pyx_v_xo, __pyx_v_yo, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_12), __pyx_v_alpha, __pyx_v_over, __pyx_v_rend->operation_complete, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_8), __pyx_v_nearest, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __pyx_L11:;

    /* "renpy/gl/gldraw.pyx":1021
 *                     nearest)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         elif rend.operation == IMAGEDISSOLVE:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":993
 *         # Other draw modes.
 * 
 *         if rend.operation == DISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             if self.fast_dissolve:
 */
  }

  /* "renpy/gl/gldraw.pyx":1023
 *             return 0
 * 
 *         elif rend.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             self.set_clip(clip)
 */
  __pyx_t_14 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE) != 0);
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":1025
 *         elif rend.operation == IMAGEDISSOLVE:
 * 
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.imageblend(
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1025, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":1028
 * 
 *             gltexture.imageblend(
 *                 rend.children[0][0].render_to_texture(True),             # <<<<<<<<<<<<<<
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),
 */
    if (unlikely(__pyx_v_rend->children == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1028, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1028, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1029
 *             gltexture.imageblend(
 *                 rend.children[0][0].render_to_texture(True),
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),
 *                 xo,
 */
    if (unlikely(__pyx_v_rend->children == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1029, __pyx_L1_error)
    }
    __pyx_t_12 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_alpha); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1029, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_9};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1029, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_9};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1029, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1029, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1029, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1029, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1030
 *                 rend.children[0][0].render_to_texture(True),
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
    if (unlikely(__pyx_v_rend->children == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1030, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_operation_alpha); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1030, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_9};
        __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1030, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_9};
        __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1030, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1030, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1030, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1030, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1033
 *                 xo,
 *                 yo,
 *                 reverse * self.draw_to_virt,             # <<<<<<<<<<<<<<
 *                 alpha,
 *                 over,
 */
    __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_v_reverse), ((PyObject *)__pyx_v_self->draw_to_virt)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1033, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1037
 *                 over,
 *                 rend.operation_complete,
 *                 rend.operation_parameter,             # <<<<<<<<<<<<<<
 *                 self.environ,
 *                 nearest)
 */
    __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_rend->operation_parameter); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1037, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1038
 *                 rend.operation_complete,
 *                 rend.operation_parameter,
 *                 self.environ,             # <<<<<<<<<<<<<<
 *                 nearest)
 * 
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_self->environ);
    __Pyx_INCREF(__pyx_t_6);

    /* "renpy/gl/gldraw.pyx":1027
 *             self.set_clip(clip)
 * 
 *             gltexture.imageblend(             # <<<<<<<<<<<<<<
 *                 rend.children[0][0].render_to_texture(True),
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 */
    __pyx_t_9 = __pyx_f_5renpy_2gl_9gltexture_imageblend(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_8), ((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_7), ((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_12), __pyx_v_xo, __pyx_v_yo, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_2), __pyx_v_alpha, __pyx_v_over, __pyx_v_rend->operation_complete, __pyx_t_11, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_6), __pyx_v_nearest, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1027, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "renpy/gl/gldraw.pyx":1041
 *                 nearest)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1023
 *             return 0
 * 
 *         elif rend.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             self.set_clip(clip)
 */
  }

  /* "renpy/gl/gldraw.pyx":1044
 * 
 * 
 *         elif rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  __pyx_t_14 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_PIXELLATE) != 0);
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":1045
 * 
 *         elif rend.operation == PIXELLATE:
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             p = rend.operation_parameter
 */
    __pyx_t_9 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1045, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "renpy/gl/gldraw.pyx":1047
 *             self.set_clip(clip)
 * 
 *             p = rend.operation_parameter             # <<<<<<<<<<<<<<
 *             pc = rend.children[0][0]
 * 
 */
    __pyx_t_9 = __pyx_v_rend->operation_parameter;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_v_p = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "renpy/gl/gldraw.pyx":1048
 * 
 *             p = rend.operation_parameter
 *             pc = rend.children[0][0]             # <<<<<<<<<<<<<<
 * 
 *             while p > 1:
 */
    if (unlikely(__pyx_v_rend->children == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1048, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_pc = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":1050
 *             pc = rend.children[0][0]
 * 
 *             while p > 1:             # <<<<<<<<<<<<<<
 *                 p /= 2
 *                 pc = self.get_half(pc)
 */
    while (1) {
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1050, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1050, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!__pyx_t_14) break;

      /* "renpy/gl/gldraw.pyx":1051
 * 
 *             while p > 1:
 *                 p /= 2             # <<<<<<<<<<<<<<
 *                 pc = self.get_half(pc)
 * 
 */
      __pyx_t_6 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_p, __pyx_int_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":1052
 *             while p > 1:
 *                 p /= 2
 *                 pc = self.get_half(pc)             # <<<<<<<<<<<<<<
 * 
 *             reverse *= Matrix2D(1.0 * what.width / pc.width, 0, 0, 1.0 * what.height / pc.height)
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_half); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1052, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_pc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1052, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_pc};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1052, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_pc};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1052, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1052, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_pc);
          __Pyx_GIVEREF(__pyx_v_pc);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_pc);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1052, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF_SET(__pyx_v_pc, __pyx_t_6);
      __pyx_t_6 = 0;
    }

    /* "renpy/gl/gldraw.pyx":1054
 *                 pc = self.get_half(pc)
 * 
 *             reverse *= Matrix2D(1.0 * what.width / pc.width, 0, 0, 1.0 * what.height / pc.height)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.blit(
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pc, __pyx_n_s_width); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pc, __pyx_n_s_height); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2);
    __pyx_t_12 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_reverse), __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_reverse, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":1057
 * 
 *             gltexture.blit(
 *                 pc,             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
    if (!(likely(((__pyx_v_pc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pc, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1057, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1063
 *                 alpha,
 *                 over,
 *                 self.environ,             # <<<<<<<<<<<<<<
 *                 True)
 * 
 */
    __pyx_t_6 = ((PyObject *)__pyx_v_self->environ);
    __Pyx_INCREF(__pyx_t_6);

    /* "renpy/gl/gldraw.pyx":1056
 *             reverse *= Matrix2D(1.0 * what.width / pc.width, 0, 0, 1.0 * what.height / pc.height)
 * 
 *             gltexture.blit(             # <<<<<<<<<<<<<<
 *                 pc,
 *                 xo,
 */
    __pyx_t_2 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_v_pc), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_6), 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1066
 *                 True)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         elif rend.operation == FLATTEN:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1044
 * 
 * 
 *         elif rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1068
 *             return 0
 * 
 *         elif rend.operation == FLATTEN:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  __pyx_t_14 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_FLATTEN) != 0);
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":1069
 * 
 *         elif rend.operation == FLATTEN:
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.blit(
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1072
 * 
 *             gltexture.blit(
 *                 rend.children[0][0].render_to_texture(True),             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
    if (unlikely(__pyx_v_rend->children == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1072, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_rend->children, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1072, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1072, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1075
 *                 xo,
 *                 yo,
 *                 reverse * self.draw_to_virt,             # <<<<<<<<<<<<<<
 *                 alpha,
 *                 over,
 */
    __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_v_reverse), ((PyObject *)__pyx_v_self->draw_to_virt)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1075, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1078
 *                 alpha,
 *                 over,
 *                 self.environ,             # <<<<<<<<<<<<<<
 *                 nearest)
 * 
 */
    __pyx_t_12 = ((PyObject *)__pyx_v_self->environ);
    __Pyx_INCREF(__pyx_t_12);

    /* "renpy/gl/gldraw.pyx":1071
 *             self.set_clip(clip)
 * 
 *             gltexture.blit(             # <<<<<<<<<<<<<<
 *                 rend.children[0][0].render_to_texture(True),
 *                 xo,
 */
    __pyx_t_9 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_6), __pyx_v_xo, __pyx_v_yo, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_2), __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_12), __pyx_v_nearest, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1071, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "renpy/gl/gldraw.pyx":1081
 *                 nearest)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1068
 *             return 0
 * 
 *         elif rend.operation == FLATTEN:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1085
 * 
 *         # Compute clipping.
 *         if rend.xclipping or rend.yclipping:             # <<<<<<<<<<<<<<
 * 
 *             # Non-aligned clipping uses RTT.
 */
  __pyx_t_13 = (__pyx_v_rend->xclipping != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_14 = __pyx_t_13;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_13 = (__pyx_v_rend->yclipping != 0);
  __pyx_t_14 = __pyx_t_13;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":1088
 * 
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:             # <<<<<<<<<<<<<<
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse * self.draw_to_virt, nearest, subpixel)
 */
    __pyx_t_13 = ((__pyx_v_reverse->ydx != 0.0) != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_14 = __pyx_t_13;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_13 = ((__pyx_v_reverse->xdy != 0.0) != 0);
    __pyx_t_14 = __pyx_t_13;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":1089
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse * self.draw_to_virt, nearest, subpixel)
 *                 return 0
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_tex = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "renpy/gl/gldraw.pyx":1090
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse * self.draw_to_virt, nearest, subpixel)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      __pyx_t_12 = PyNumber_Multiply(((PyObject *)__pyx_v_reverse), ((PyObject *)__pyx_v_self->draw_to_virt)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1090, __pyx_L1_error)
      __pyx_t_11 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_tex, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_12), __pyx_v_nearest, __pyx_v_subpixel, 0); if (unlikely(__pyx_t_11 == ((int)1))) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "renpy/gl/gldraw.pyx":1091
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse * self.draw_to_virt, nearest, subpixel)
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             minx, miny, maxx, maxy = clip
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "renpy/gl/gldraw.pyx":1088
 * 
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:             # <<<<<<<<<<<<<<
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse * self.draw_to_virt, nearest, subpixel)
 */
    }

    /* "renpy/gl/gldraw.pyx":1093
 *                 return 0
 * 
 *             minx, miny, maxx, maxy = clip             # <<<<<<<<<<<<<<
 * 
 *             # Figure out the transformed width and height of this
 */
    if (likely(__pyx_v_clip != Py_None)) {
      PyObject* sequence = __pyx_v_clip;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1093, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_9,&__pyx_t_2,&__pyx_t_6};
        for (i=0; i < 4; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1093, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1093, __pyx_L1_error)
    }
    __pyx_v_minx = __pyx_t_12;
    __pyx_t_12 = 0;
    __pyx_v_miny = __pyx_t_9;
    __pyx_t_9 = 0;
    __pyx_v_maxx = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_maxy = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":1097
 *             # Figure out the transformed width and height of this
 *             # surface.
 *             tw, th = reverse.transform(what.width, what.height)             # <<<<<<<<<<<<<<
 * 
 *             if rend.xclipping:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_reverse), __pyx_n_s_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_width); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s_height); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_7 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_t_12};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_t_12};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_11, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_11, __pyx_t_12);
      __pyx_t_9 = 0;
      __pyx_t_12 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1097, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_12 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_8 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_8)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1097, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1097, __pyx_L1_error)
      __pyx_L21_unpacking_done:;
    }
    __pyx_v_tw = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_th = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "renpy/gl/gldraw.pyx":1099
 *             tw, th = reverse.transform(what.width, what.height)
 * 
 *             if rend.xclipping:             # <<<<<<<<<<<<<<
 *                 minx = max(minx, min(xo, xo + tw))
 *                 maxx = min(maxx, max(xo, xo + tw))
 */
    __pyx_t_14 = (__pyx_v_rend->xclipping != 0);
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":1100
 * 
 *             if rend.xclipping:
 *                 minx = max(minx, min(xo, xo + tw))             # <<<<<<<<<<<<<<
 *                 maxx = min(maxx, max(xo, xo + tw))
 * 
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_v_tw); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_15 = __pyx_v_xo;
      __pyx_t_2 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_6 = __pyx_t_8;
      } else {
        __pyx_t_12 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1100, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_6 = __pyx_t_12;
        __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_v_minx);
      __pyx_t_6 = __pyx_v_minx;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1100, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_12 = __pyx_t_8;
      } else {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_12 = __pyx_t_6;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __pyx_t_12;
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_minx, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "renpy/gl/gldraw.pyx":1101
 *             if rend.xclipping:
 *                 minx = max(minx, min(xo, xo + tw))
 *                 maxx = min(maxx, max(xo, xo + tw))             # <<<<<<<<<<<<<<
 * 
 *             if rend.yclipping:
 */
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_12 = PyNumber_Add(__pyx_t_8, __pyx_v_tw); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_15 = __pyx_v_xo;
      __pyx_t_6 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_12, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_8 = __pyx_t_12;
      } else {
        __pyx_t_2 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_12 = __pyx_t_8;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_v_maxx);
      __pyx_t_8 = __pyx_v_maxx;
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_12, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_2 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_2 = __pyx_t_8;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __pyx_t_2;
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_maxx, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "renpy/gl/gldraw.pyx":1099
 *             tw, th = reverse.transform(what.width, what.height)
 * 
 *             if rend.xclipping:             # <<<<<<<<<<<<<<
 *                 minx = max(minx, min(xo, xo + tw))
 *                 maxx = min(maxx, max(xo, xo + tw))
 */
    }

    /* "renpy/gl/gldraw.pyx":1103
 *                 maxx = min(maxx, max(xo, xo + tw))
 * 
 *             if rend.yclipping:             # <<<<<<<<<<<<<<
 *                 miny = max(miny, min(yo, yo + th))
 *                 maxy = min(maxy, max(yo, yo + th))
 */
    __pyx_t_14 = (__pyx_v_rend->yclipping != 0);
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":1104
 * 
 *             if rend.yclipping:
 *                 miny = max(miny, min(yo, yo + th))             # <<<<<<<<<<<<<<
 *                 maxy = min(maxy, max(yo, yo + th))
 * 
 */
      __pyx_t_12 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_2 = PyNumber_Add(__pyx_t_12, __pyx_v_th); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_15 = __pyx_v_yo;
      __pyx_t_8 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_12 = __pyx_t_2;
      } else {
        __pyx_t_6 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_12 = __pyx_t_6;
        __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_2 = __pyx_t_12;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_INCREF(__pyx_v_miny);
      __pyx_t_12 = __pyx_v_miny;
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_12, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_6 = __pyx_t_2;
      } else {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_6 = __pyx_t_12;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_t_6;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_miny, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":1105
 *             if rend.yclipping:
 *                 miny = max(miny, min(yo, yo + th))
 *                 maxy = min(maxy, max(yo, yo + th))             # <<<<<<<<<<<<<<
 * 
 *             clip = (minx, miny, maxx, maxy)
 */
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_v_th); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15 = __pyx_v_yo;
      __pyx_t_12 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_12, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_2 = __pyx_t_6;
      } else {
        __pyx_t_8 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __pyx_t_8;
        __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_v_maxy);
      __pyx_t_2 = __pyx_v_maxy;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_6, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1105, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_14) {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_8 = __pyx_t_6;
      } else {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_8 = __pyx_t_2;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __pyx_t_8;
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_maxy, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":1103
 *                 maxx = min(maxx, max(xo, xo + tw))
 * 
 *             if rend.yclipping:             # <<<<<<<<<<<<<<
 *                 miny = max(miny, min(yo, yo + th))
 *                 maxy = min(maxy, max(yo, yo + th))
 */
    }

    /* "renpy/gl/gldraw.pyx":1107
 *                 maxy = min(maxy, max(yo, yo + th))
 * 
 *             clip = (minx, miny, maxx, maxy)             # <<<<<<<<<<<<<<
 * 
 *         alpha = alpha * rend.alpha
 */
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_minx);
    __Pyx_GIVEREF(__pyx_v_minx);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_minx);
    __Pyx_INCREF(__pyx_v_miny);
    __Pyx_GIVEREF(__pyx_v_miny);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_miny);
    __Pyx_INCREF(__pyx_v_maxx);
    __Pyx_GIVEREF(__pyx_v_maxx);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_maxx);
    __Pyx_INCREF(__pyx_v_maxy);
    __Pyx_GIVEREF(__pyx_v_maxy);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_maxy);
    __Pyx_DECREF_SET(__pyx_v_clip, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":1085
 * 
 *         # Compute clipping.
 *         if rend.xclipping or rend.yclipping:             # <<<<<<<<<<<<<<
 * 
 *             # Non-aligned clipping uses RTT.
 */
  }

  /* "renpy/gl/gldraw.pyx":1109
 *             clip = (minx, miny, maxx, maxy)
 * 
 *         alpha = alpha * rend.alpha             # <<<<<<<<<<<<<<
 *         over = over * rend.over
 * 
 */
  __pyx_v_alpha = (__pyx_v_alpha * __pyx_v_rend->alpha);

  /* "renpy/gl/gldraw.pyx":1110
 * 
 *         alpha = alpha * rend.alpha
 *         over = over * rend.over             # <<<<<<<<<<<<<<
 * 
 *         if rend.nearest is not None:
 */
  __pyx_v_over = (__pyx_v_over * __pyx_v_rend->over);

  /* "renpy/gl/gldraw.pyx":1112
 *         over = over * rend.over
 * 
 *         if rend.nearest is not None:             # <<<<<<<<<<<<<<
 *             nearest = rend.nearest
 * 
 */
  __pyx_t_14 = (__pyx_v_rend->nearest != Py_None);
  __pyx_t_13 = (__pyx_t_14 != 0);
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":1113
 * 
 *         if rend.nearest is not None:
 *             nearest = rend.nearest             # <<<<<<<<<<<<<<
 * 
 *         # If our alpha has hit 0, don't do anything.
 */
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_rend->nearest); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1113, __pyx_L1_error)
    __pyx_v_nearest = __pyx_t_13;

    /* "renpy/gl/gldraw.pyx":1112
 *         over = over * rend.over
 * 
 *         if rend.nearest is not None:             # <<<<<<<<<<<<<<
 *             nearest = rend.nearest
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1116
 * 
 *         # If our alpha has hit 0, don't do anything.
 *         if alpha <= 0.003: # (1 / 256)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_13 = ((__pyx_v_alpha <= 0.003) != 0);
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":1117
 *         # If our alpha has hit 0, don't do anything.
 *         if alpha <= 0.003: # (1 / 256)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1116
 * 
 *         # If our alpha has hit 0, don't do anything.
 *         if alpha <= 0.003: # (1 / 256)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1119
 *             return 0
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:             # <<<<<<<<<<<<<<
 *             child_reverse = reverse * rend.reverse
 *         else:
 */
  __pyx_t_14 = (((PyObject *)__pyx_v_rend->reverse) != Py_None);
  __pyx_t_17 = (__pyx_t_14 != 0);
  if (__pyx_t_17) {
  } else {
    __pyx_t_13 = __pyx_t_17;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_17 = (((PyObject *)__pyx_v_rend->reverse) != __pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_t_14 = (__pyx_t_17 != 0);
  __pyx_t_13 = __pyx_t_14;
  __pyx_L27_bool_binop_done:;
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":1120
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:
 *             child_reverse = reverse * rend.reverse             # <<<<<<<<<<<<<<
 *         else:
 *             child_reverse = reverse
 */
    __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_v_reverse), ((PyObject *)__pyx_v_rend->reverse)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1120, __pyx_L1_error)
    __pyx_v_child_reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":1119
 *             return 0
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:             # <<<<<<<<<<<<<<
 *             child_reverse = reverse * rend.reverse
 *         else:
 */
    goto __pyx_L26;
  }

  /* "renpy/gl/gldraw.pyx":1122
 *             child_reverse = reverse * rend.reverse
 *         else:
 *             child_reverse = reverse             # <<<<<<<<<<<<<<
 * 
 *         for child, cx, cy, focus, main in rend.visible_children:
 */
  /*else*/ {
    __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
    __pyx_v_child_reverse = __pyx_v_reverse;
  }
  __pyx_L26:;

  /* "renpy/gl/gldraw.pyx":1124
 *             child_reverse = reverse
 * 
 *         for child, cx, cy, focus, main in rend.visible_children:             # <<<<<<<<<<<<<<
 * 
 *             # The type of cx and cy depends on if this is a subpixel blit or not.
 */
  if (unlikely(__pyx_v_rend->visible_children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1124, __pyx_L1_error)
  }
  __pyx_t_6 = __pyx_v_rend->visible_children; __Pyx_INCREF(__pyx_t_6); __pyx_t_18 = 0;
  for (;;) {
    if (__pyx_t_18 >= PyList_GET_SIZE(__pyx_t_6)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_18); __Pyx_INCREF(__pyx_t_8); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 1124, __pyx_L1_error)
    #else
    __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
      PyObject* sequence = __pyx_t_8;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1124, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_12,&__pyx_t_9,&__pyx_t_7,&__pyx_t_1};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1124, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_12,&__pyx_t_9,&__pyx_t_7,&__pyx_t_1};
      __pyx_t_5 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_5)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_16(__pyx_t_5); if (unlikely(!item)) goto __pyx_L31_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_5), 5) < 0) __PYX_ERR(0, 1124, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L32_unpacking_done;
      __pyx_L31_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1124, __pyx_L1_error)
      __pyx_L32_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":1127
 * 
 *             # The type of cx and cy depends on if this is a subpixel blit or not.
 *             if type(cx) is float:             # <<<<<<<<<<<<<<
 *                 subpixel = True
 * 
 */
    __pyx_t_13 = (((PyObject *)Py_TYPE(__pyx_v_cx)) == ((PyObject *)(&PyFloat_Type)));
    __pyx_t_14 = (__pyx_t_13 != 0);
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":1128
 *             # The type of cx and cy depends on if this is a subpixel blit or not.
 *             if type(cx) is float:
 *                 subpixel = True             # <<<<<<<<<<<<<<
 * 
 *             cxo = cx
 */
      __pyx_v_subpixel = 1;

      /* "renpy/gl/gldraw.pyx":1127
 * 
 *             # The type of cx and cy depends on if this is a subpixel blit or not.
 *             if type(cx) is float:             # <<<<<<<<<<<<<<
 *                 subpixel = True
 * 
 */
    }

    /* "renpy/gl/gldraw.pyx":1130
 *                 subpixel = True
 * 
 *             cxo = cx             # <<<<<<<<<<<<<<
 *             cyo = cy
 * 
 */
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L1_error)
    __pyx_v_cxo = __pyx_t_15;

    /* "renpy/gl/gldraw.pyx":1131
 * 
 *             cxo = cx
 *             cyo = cy             # <<<<<<<<<<<<<<
 * 
 *             tcxo = reverse.xdx * cxo + reverse.xdy * cyo
 */
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1131, __pyx_L1_error)
    __pyx_v_cyo = __pyx_t_15;

    /* "renpy/gl/gldraw.pyx":1133
 *             cyo = cy
 * 
 *             tcxo = reverse.xdx * cxo + reverse.xdy * cyo             # <<<<<<<<<<<<<<
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo
 * 
 */
    __pyx_v_tcxo = ((__pyx_v_reverse->xdx * __pyx_v_cxo) + (__pyx_v_reverse->xdy * __pyx_v_cyo));

    /* "renpy/gl/gldraw.pyx":1134
 * 
 *             tcxo = reverse.xdx * cxo + reverse.xdy * cyo
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo             # <<<<<<<<<<<<<<
 * 
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, over, child_reverse, nearest, subpixel)
 */
    __pyx_v_tcyo = ((__pyx_v_reverse->ydx * __pyx_v_cxo) + (__pyx_v_reverse->ydy * __pyx_v_cyo));

    /* "renpy/gl/gldraw.pyx":1136
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo
 * 
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, over, child_reverse, nearest, subpixel)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_11 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_child, __pyx_v_clip, (__pyx_v_xo + __pyx_v_tcxo), (__pyx_v_yo + __pyx_v_tcyo), __pyx_v_alpha, __pyx_v_over, __pyx_v_child_reverse, __pyx_v_nearest, __pyx_v_subpixel, 0); if (unlikely(__pyx_t_11 == ((int)1))) __PYX_ERR(0, 1136, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1124
 *             child_reverse = reverse
 * 
 *         for child, cx, cy, focus, main in rend.visible_children:             # <<<<<<<<<<<<<<
 * 
 *             # The type of cx and cy depends on if this is a subpixel blit or not.
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1138
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, over, child_reverse, nearest, subpixel)
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def render_to_texture(self, what, alpha):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":940
 *             what.render_to_texture(True)
 * 
 *     cpdef int draw_transformed(             # <<<<<<<<<<<<<<
 *         GLDraw self,
 *         object what,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rend);
  __Pyx_XDECREF((PyObject *)__pyx_v_child_reverse);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_minx);
  __Pyx_XDECREF(__pyx_v_miny);
  __Pyx_XDECREF(__pyx_v_maxx);
  __Pyx_XDECREF(__pyx_v_maxy);
  __Pyx_XDECREF(__pyx_v_tw);
  __Pyx_XDECREF(__pyx_v_th);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_cx);
  __Pyx_XDECREF(__pyx_v_cy);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XDECREF((PyObject *)__pyx_v_reverse);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_clip = 0;
  double __pyx_v_xo;
  double __pyx_v_yo;
  double __pyx_v_alpha;
  double __pyx_v_over;
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_reverse = 0;
  int __pyx_v_nearest;
  int __pyx_v_subpixel;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_transformed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_what,&__pyx_n_s_clip,&__pyx_n_s_xo,&__pyx_n_s_yo,&__pyx_n_s_alpha,&__pyx_n_s_over,&__pyx_n_s_reverse,&__pyx_n_s_nearest,&__pyx_n_s_subpixel,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_clip)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 1); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 2); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 3); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 4); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_over)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 5); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reverse)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 6); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nearest)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 7); __PYX_ERR(0, 940, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_subpixel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, 8); __PYX_ERR(0, 940, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_transformed") < 0)) __PYX_ERR(0, 940, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_what = values[0];
    __pyx_v_clip = ((PyObject*)values[1]);
    __pyx_v_xo = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xo == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error)
    __pyx_v_yo = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_yo == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 945, __pyx_L3_error)
    __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 946, __pyx_L3_error)
    __pyx_v_over = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_over == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 947, __pyx_L3_error)
    __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)values[6]);
    __pyx_v_nearest = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_nearest == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error)
    __pyx_v_subpixel = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_subpixel == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 950, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 940, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_clip), (&PyTuple_Type), 1, "clip", 1))) __PYX_ERR(0, 943, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverse), __pyx_ptype_5renpy_7display_6matrix_Matrix, 1, "reverse", 0))) __PYX_ERR(0, 948, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_32draw_transformed(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, __pyx_v_nearest, __pyx_v_subpixel);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_32draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_reverse, int __pyx_v_nearest, int __pyx_v_subpixel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("draw_transformed", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_transformed(__pyx_v_self, __pyx_v_what, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, __pyx_v_nearest, __pyx_v_subpixel, 1); if (unlikely(__pyx_t_1 == ((int)1))) __PYX_ERR(0, 940, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1140
 *         return 0
 * 
 *     def render_to_texture(self, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         width = int(math.ceil(what.width * self.draw_per_virt))
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_35render_to_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_35render_to_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render_to_texture (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_what,&__pyx_n_s_alpha,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_to_texture", 1, 2, 2, 1); __PYX_ERR(0, 1140, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render_to_texture") < 0)) __PYX_ERR(0, 1140, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_what = values[0];
    __pyx_v_alpha = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render_to_texture", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1140, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_34render_to_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1145
 *         height = int(math.ceil(what.height * self.draw_per_virt))
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func = {"draw_func", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); __PYX_ERR(0, 1145, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); __PYX_ERR(0, 1145, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); __PYX_ERR(0, 1145, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_func") < 0)) __PYX_ERR(0, 1145, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1145, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_draw_func(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_cur_scope;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_outer_scope;
  PyObject *__pyx_v_clip = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("draw_func", 0);
  __pyx_outer_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "renpy/gl/gldraw.pyx":1147
 *         def draw_func(x, y, w, h):
 * 
 *             self.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             if alpha:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1147, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_clip_mode_rtt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
    __Pyx_INCREF(__pyx_v_w);
    __Pyx_GIVEREF(__pyx_v_w);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_w);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_h);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1149
 *             self.clip_mode_rtt(x, y, w, h)
 * 
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_alpha)) { __Pyx_RaiseClosureNameError("alpha"); __PYX_ERR(0, 1149, __pyx_L1_error) }
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_alpha); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1149, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "renpy/gl/gldraw.pyx":1150
 * 
 *             if alpha:
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)             # <<<<<<<<<<<<<<
 *             else:
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)
 */
    __pyx_t_4 = __pyx_f_5renpy_2gl_2gl_glClearColor(0.0, 0.0, 0.0, 0.0); if (unlikely(__pyx_t_4 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1150, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1149
 *             self.clip_mode_rtt(x, y, w, h)
 * 
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 */
    goto __pyx_L3;
  }

  /* "renpy/gl/gldraw.pyx":1152
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *             glClear(GL_COLOR_BUFFER_BIT)
 */
  /*else*/ {
    __pyx_t_4 = __pyx_f_5renpy_2gl_2gl_glClearColor(0.0, 0.0, 0.0, 1.0); if (unlikely(__pyx_t_4 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1152, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":1154
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)
 * 
 *             glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *             self.default_clip = (0, 0, width, height)
 */
  __pyx_t_4 = __pyx_f_5renpy_2gl_2gl_glClear(GL_COLOR_BUFFER_BIT); if (unlikely(__pyx_t_4 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1154, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1156
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             self.default_clip = (0, 0, width, height)             # <<<<<<<<<<<<<<
 *             clip = self.default_clip
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_width)) { __Pyx_RaiseClosureNameError("width"); __PYX_ERR(0, 1156, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_height)) { __Pyx_RaiseClosureNameError("height"); __PYX_ERR(0, 1156, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_width);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_cur_scope->__pyx_v_height);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1156, __pyx_L1_error) }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->default_clip);
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->default_clip);
  __pyx_cur_scope->__pyx_v_self->default_clip = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1157
 * 
 *             self.default_clip = (0, 0, width, height)
 *             clip = self.default_clip             # <<<<<<<<<<<<<<
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, self.virt_to_draw, renpy.config.nearest_neighbor, False)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1157, __pyx_L1_error) }
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->default_clip;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_clip = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1159
 *             clip = self.default_clip
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, self.virt_to_draw, renpy.config.nearest_neighbor, False)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1159, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); __PYX_ERR(0, 1159, __pyx_L1_error) }
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1159, __pyx_L1_error) }
  __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->virt_to_draw);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_config); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nearest_neighbor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_cur_scope->__pyx_v_self, __pyx_t_1, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_2), __pyx_t_6, 0, 0); if (unlikely(__pyx_t_4 == ((int)1))) __PYX_ERR(0, 1159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1145
 *         height = int(math.ceil(what.height * self.draw_per_virt))
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1140
 *         return 0
 * 
 *     def render_to_texture(self, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         width = int(math.ceil(what.width * self.draw_per_virt))
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_34render_to_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_alpha) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_cur_scope;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("render_to_texture", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1140, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);
  __pyx_cur_scope->__pyx_v_alpha = __pyx_v_alpha;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alpha);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alpha);

  /* "renpy/gl/gldraw.pyx":1142
 *     def render_to_texture(self, what, alpha):
 * 
 *         width = int(math.ceil(what.width * self.draw_per_virt))             # <<<<<<<<<<<<<<
 *         height = int(math.ceil(what.height * self.draw_per_virt))
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ceil); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_cur_scope->__pyx_v_self->draw_per_virt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_width = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1143
 * 
 *         width = int(math.ceil(what.width * self.draw_per_virt))
 *         height = int(math.ceil(what.height * self.draw_per_virt))             # <<<<<<<<<<<<<<
 * 
 *         def draw_func(x, y, w, h):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ceil); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_self->draw_per_virt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_cur_scope->__pyx_v_height = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1145
 *         height = int(math.ceil(what.height * self.draw_per_virt))
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */
  __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func, 0, __pyx_n_s_render_to_texture_locals_draw_fu, ((PyObject*)__pyx_cur_scope), __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_draw_func = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1161
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, self.virt_to_draw, renpy.config.nearest_neighbor, False)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  __pyx_t_5 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_5, __pyx_ptype_5renpy_7display_6render_Render); 
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "renpy/gl/gldraw.pyx":1162
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_is_opaque); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1162, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1162, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":1161
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, self.virt_to_draw, renpy.config.nearest_neighbor, False)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1164
 *             what.is_opaque()
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)             # <<<<<<<<<<<<<<
 * 
 *         self.did_render_to_texture = True
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_texture_grid_from_drawing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_width, __pyx_cur_scope->__pyx_v_height, __pyx_v_draw_func, __pyx_cur_scope->__pyx_v_self->rtt, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ)};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1164, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_width, __pyx_cur_scope->__pyx_v_height, __pyx_v_draw_func, __pyx_cur_scope->__pyx_v_self->rtt, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ)};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1164, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_width);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_height);
    __Pyx_INCREF(__pyx_v_draw_func);
    __Pyx_GIVEREF(__pyx_v_draw_func);
    PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_v_draw_func);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rtt);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rtt);
    PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_8, __pyx_cur_scope->__pyx_v_self->rtt);
    __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
    __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
    PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_8, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_rv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1166
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 * 
 *         self.did_render_to_texture = True             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_cur_scope->__pyx_v_self->did_render_to_texture = 1;

  /* "renpy/gl/gldraw.pyx":1168
 *         self.did_render_to_texture = True
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1140
 *         return 0
 * 
 *     def render_to_texture(self, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         width = int(math.ceil(what.width * self.draw_per_virt))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_draw_func);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1171
 * 
 * 
 *     def is_pixel_opaque(self, what, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the pixel is not 100% transparent.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_37is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_36is_pixel_opaque[] = "\n        Returns true if the pixel is not 100% transparent.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_37is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_pixel_opaque (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_what,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, 1); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, 2); __PYX_ERR(0, 1171, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "is_pixel_opaque") < 0)) __PYX_ERR(0, 1171, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_what = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1171, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_36is_pixel_opaque(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1185
 *         alpha_holder = [ 0 ]
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 *             self.environ.viewport(0, 0, 1, 1)
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_1draw_func = {"draw_func", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_1draw_func, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_x = 0;
  CYTHON_UNUSED PyObject *__pyx_v_y = 0;
  CYTHON_UNUSED PyObject *__pyx_v_w = 0;
  CYTHON_UNUSED PyObject *__pyx_v_h = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); __PYX_ERR(0, 1185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); __PYX_ERR(0, 1185, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); __PYX_ERR(0, 1185, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_func") < 0)) __PYX_ERR(0, 1185, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.is_pixel_opaque.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_draw_func(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_draw_func(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_y, CYTHON_UNUSED PyObject *__pyx_v_w, CYTHON_UNUSED PyObject *__pyx_v_h) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *__pyx_cur_scope;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *__pyx_outer_scope;
  PyObject *__pyx_v_clip = NULL;
  unsigned char __pyx_v_pixel[4];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("draw_func", 0);
  __pyx_outer_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "renpy/gl/gldraw.pyx":1186
 * 
 *         def draw_func(x, y, w, h):
 *             self.environ.viewport(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1186, __pyx_L1_error) }
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_cur_scope->__pyx_v_self->environ->__pyx_vtab)->viewport(__pyx_cur_scope->__pyx_v_self->environ, 0, 0, 1, 1);

  /* "renpy/gl/gldraw.pyx":1187
 *         def draw_func(x, y, w, h):
 *             self.environ.viewport(0, 0, 1, 1)
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(0, 0, 1, 1)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1187, __pyx_L1_error) }
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_cur_scope->__pyx_v_self->environ->__pyx_vtab)->ortho(__pyx_cur_scope->__pyx_v_self->environ, 0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

  /* "renpy/gl/gldraw.pyx":1189
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 * 
 *             self.clip_mode_rtt(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 *             clip = (0, 0, 1, 1)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1189, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_clip_mode_rtt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1190
 * 
 *             self.clip_mode_rtt(0, 0, 1, 1)
 *             clip = (0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 0.0)
 */
  __Pyx_INCREF(__pyx_tuple__39);
  __pyx_v_clip = __pyx_tuple__39;

  /* "renpy/gl/gldraw.pyx":1192
 *             clip = (0, 0, 1, 1)
 * 
 *             glClearColor(0.0, 0.0, 0.0, 0.0)             # <<<<<<<<<<<<<<
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 */
  __pyx_t_3 = __pyx_f_5renpy_2gl_2gl_glClearColor(0.0, 0.0, 0.0, 0.0); if (unlikely(__pyx_t_3 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1192, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1193
 * 
 *             glClearColor(0.0, 0.0, 0.0, 0.0)
 *             glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 */
  __pyx_t_3 = __pyx_f_5renpy_2gl_2gl_glClear(GL_COLOR_BUFFER_BIT); if (unlikely(__pyx_t_3 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1193, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1195
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)             # <<<<<<<<<<<<<<
 * 
 *             cdef unsigned char pixel[4]
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1195, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); __PYX_ERR(0, 1195, __pyx_L1_error) }
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(PyTuple_CheckExact(__pyx_v_clip))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_clip)->tp_name), 0))) __PYX_ERR(0, 1195, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_v_reverse)) { __Pyx_RaiseClosureNameError("reverse"); __PYX_ERR(0, 1195, __pyx_L1_error) }
  if (!(likely(((__pyx_cur_scope->__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_reverse, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1195, __pyx_L1_error)
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_reverse;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_config); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_nearest_neighbor); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_cur_scope->__pyx_v_self, __pyx_t_2, ((PyObject*)__pyx_v_clip), 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_1), __pyx_t_6, 0, 0); if (unlikely(__pyx_t_3 == ((int)1))) __PYX_ERR(0, 1195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1198
 * 
 *             cdef unsigned char pixel[4]
 *             glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel)             # <<<<<<<<<<<<<<
 * 
 *             alpha_holder[0] = (pixel[3])
 */
  __pyx_t_3 = __pyx_f_5renpy_2gl_2gl_glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_pixel); if (unlikely(__pyx_t_3 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1198, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1200
 *             glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel)
 * 
 *             alpha_holder[0] = (pixel[3])             # <<<<<<<<<<<<<<
 * 
 *         self.did_render_to_texture = False
 */
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_char((__pyx_v_pixel[3])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_alpha_holder)) { __Pyx_RaiseClosureNameError("alpha_holder"); __PYX_ERR(0, 1200, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_alpha_holder == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1200, __pyx_L1_error)
  }
  if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_alpha_holder, 0, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 1200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1185
 *         alpha_holder = [ 0 ]
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 *             self.environ.viewport(0, 0, 1, 1)
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.is_pixel_opaque.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1171
 * 
 * 
 *     def is_pixel_opaque(self, what, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the pixel is not 100% transparent.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_36is_pixel_opaque(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *__pyx_cur_scope;
  PyObject *__pyx_v_draw_func = 0;
  CYTHON_UNUSED long __pyx_v__i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  long __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("is_pixel_opaque", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1171, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);

  /* "renpy/gl/gldraw.pyx":1176
 *         """
 * 
 *         if x < 0 or y < 0 or x >= what.width or y >= what.height:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_y, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":1177
 * 
 *         if x < 0 or y < 0 or x >= what.width or y >= what.height:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         what = what.subsurface((x, y, 1, 1))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1176
 *         """
 * 
 *         if x < 0 or y < 0 or x >= what.width or y >= what.height:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1179
 *             return 0
 * 
 *         what = what.subsurface((x, y, 1, 1))             # <<<<<<<<<<<<<<
 * 
 *         reverse = IDENTITY
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_y);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_int_1);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_what, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1181
 *         what = what.subsurface((x, y, 1, 1))
 * 
 *         reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         alpha_holder = [ 0 ]
 */
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __Pyx_GIVEREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_cur_scope->__pyx_v_reverse = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;

  /* "renpy/gl/gldraw.pyx":1183
 *         reverse = IDENTITY
 * 
 *         alpha_holder = [ 0 ]             # <<<<<<<<<<<<<<
 * 
 *         def draw_func(x, y, w, h):
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_alpha_holder = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1185
 *         alpha_holder = [ 0 ]
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 *             self.environ.viewport(0, 0, 1, 1)
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_15is_pixel_opaque_1draw_func, 0, __pyx_n_s_is_pixel_opaque_locals_draw_func, ((PyObject*)__pyx_cur_scope), __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_draw_func = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1202
 *             alpha_holder[0] = (pixel[3])
 * 
 *         self.did_render_to_texture = False             # <<<<<<<<<<<<<<
 * 
 *         # We need to render a second time if a render-to-texture occurs, as it
 */
  __pyx_cur_scope->__pyx_v_self->did_render_to_texture = 0;

  /* "renpy/gl/gldraw.pyx":1206
 *         # We need to render a second time if a render-to-texture occurs, as it
 *         # has overwritten the buffer we're drawing to.
 *         for _i in range(2):             # <<<<<<<<<<<<<<
 * 
 *             gltexture.texture_grid_from_drawing(1, 1, draw_func, self.rtt, self.environ)
 */
  for (__pyx_t_8 = 0; __pyx_t_8 < 2; __pyx_t_8+=1) {
    __pyx_v__i = __pyx_t_8;

    /* "renpy/gl/gldraw.pyx":1208
 *         for _i in range(2):
 * 
 *             gltexture.texture_grid_from_drawing(1, 1, draw_func, self.rtt, self.environ)             # <<<<<<<<<<<<<<
 * 
 *             if not self.did_render_to_texture:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_texture_grid_from_drawing); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_int_1, __pyx_int_1, __pyx_v_draw_func, __pyx_cur_scope->__pyx_v_self->rtt, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ)};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1208, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_int_1, __pyx_int_1, __pyx_v_draw_func, __pyx_cur_scope->__pyx_v_self->rtt, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ)};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1208, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_int_1);
      __Pyx_INCREF(__pyx_v_draw_func);
      __Pyx_GIVEREF(__pyx_v_draw_func);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_9, __pyx_v_draw_func);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rtt);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rtt);
      PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_9, __pyx_cur_scope->__pyx_v_self->rtt);
      __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
      __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
      PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_9, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1210
 *             gltexture.texture_grid_from_drawing(1, 1, draw_func, self.rtt, self.environ)
 * 
 *             if not self.did_render_to_texture:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_1 = ((!(__pyx_cur_scope->__pyx_v_self->did_render_to_texture != 0)) != 0);
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":1211
 * 
 *             if not self.did_render_to_texture:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         what.kill()
 */
      goto __pyx_L9_break;

      /* "renpy/gl/gldraw.pyx":1210
 *             gltexture.texture_grid_from_drawing(1, 1, draw_func, self.rtt, self.environ)
 * 
 *             if not self.did_render_to_texture:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    }
  }
  __pyx_L9_break:;

  /* "renpy/gl/gldraw.pyx":1213
 *                 break
 * 
 *         what.kill()             # <<<<<<<<<<<<<<
 * 
 *         return alpha_holder[0]
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_kill); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1215
 *         what.kill()
 * 
 *         return alpha_holder[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_alpha_holder, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1171
 * 
 * 
 *     def is_pixel_opaque(self, what, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the pixel is not 100% transparent.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_draw_func);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1218
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_39get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_38get_half[] = "\n        Gets a texture grid that's half the size of what..\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_39get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_half (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_38get_half(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_what));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1234
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func = {"draw_func", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); __PYX_ERR(0, 1234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); __PYX_ERR(0, 1234, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); __PYX_ERR(0, 1234, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_func") < 0)) __PYX_ERR(0, 1234, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1234, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_half.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8get_half_draw_func(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *__pyx_cur_scope;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *__pyx_outer_scope;
  PyObject *__pyx_v_clip = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("draw_func", 0);
  __pyx_outer_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "renpy/gl/gldraw.pyx":1236
 *         def draw_func(x, y, w, h):
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)             # <<<<<<<<<<<<<<
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 */
  __pyx_t_1 = __pyx_f_5renpy_2gl_2gl_glClearColor(0.0, 0.0, 0.0, 1.0); if (unlikely(__pyx_t_1 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1236, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1237
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 *             glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *             draw.clip_mode_rtt(x, y, w, h)
 */
  __pyx_t_1 = __pyx_f_5renpy_2gl_2gl_glClear(GL_COLOR_BUFFER_BIT); if (unlikely(__pyx_t_1 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1237, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1239
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             draw.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             clip = (0, 0, width, height)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_draw)) { __Pyx_RaiseClosureNameError("draw"); __PYX_ERR(0, 1239, __pyx_L1_error) }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_draw), __pyx_n_s_clip_mode_rtt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_1 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_1 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_1, 4+__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_1, 4+__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(4+__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_1, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_1, __pyx_v_y);
    __Pyx_INCREF(__pyx_v_w);
    __Pyx_GIVEREF(__pyx_v_w);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_1, __pyx_v_w);
    __Pyx_INCREF(__pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_1, __pyx_v_h);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1241
 *             draw.clip_mode_rtt(x, y, w, h)
 * 
 *             clip = (0, 0, width, height)             # <<<<<<<<<<<<<<
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_width)) { __Pyx_RaiseClosureNameError("width"); __PYX_ERR(0, 1241, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_height)) { __Pyx_RaiseClosureNameError("height"); __PYX_ERR(0, 1241, __pyx_L1_error) }
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_cur_scope->__pyx_v_width);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_cur_scope->__pyx_v_height);
  __pyx_v_clip = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1243
 *             clip = (0, 0, width, height)
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_draw)) { __Pyx_RaiseClosureNameError("draw"); __PYX_ERR(0, 1243, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); __PYX_ERR(0, 1243, __pyx_L1_error) }
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_reverse)) { __Pyx_RaiseClosureNameError("reverse"); __PYX_ERR(0, 1243, __pyx_L1_error) }
  __pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_reverse);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_config); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nearest_neighbor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_cur_scope->__pyx_v_draw->__pyx_vtab)->draw_transformed(__pyx_cur_scope->__pyx_v_draw, __pyx_t_2, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_3), __pyx_t_6, 0, 0); if (unlikely(__pyx_t_1 == ((int)1))) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1234
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_half.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1218
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_38get_half(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *__pyx_cur_scope;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("get_half", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1218, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);

  /* "renpy/gl/gldraw.pyx":1224
 *         # Used to work around a bug in cython where self was not getting
 *         # the right type when being assigned to the closure.
 *         cdef GLDraw draw = self             # <<<<<<<<<<<<<<
 * 
 *         if what.half_cache:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_cur_scope->__pyx_v_draw = __pyx_v_self;

  /* "renpy/gl/gldraw.pyx":1226
 *         cdef GLDraw draw = self
 * 
 *         if what.half_cache:             # <<<<<<<<<<<<<<
 *             return what.half_cache
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_half_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1226, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":1227
 * 
 *         if what.half_cache:
 *             return what.half_cache             # <<<<<<<<<<<<<<
 * 
 *         reverse = Matrix2D(0.5, 0, 0, .5)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_half_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1226
 *         cdef GLDraw draw = self
 * 
 *         if what.half_cache:             # <<<<<<<<<<<<<<
 *             return what.half_cache
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1229
 *             return what.half_cache
 * 
 *         reverse = Matrix2D(0.5, 0, 0, .5)             # <<<<<<<<<<<<<<
 * 
 *         width = max(what.width / 2, 1)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D), __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix2D *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1231
 *         reverse = Matrix2D(0.5, 0, 0, .5)
 * 
 *         width = max(what.width / 2, 1)             # <<<<<<<<<<<<<<
 *         height = max(what.height / 2, 1)
 * 
 */
  __pyx_t_3 = 1;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1231, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_2) {
    __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_cur_scope->__pyx_v_width = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1232
 * 
 *         width = max(what.width / 2, 1)
 *         height = max(what.height / 2, 1)             # <<<<<<<<<<<<<<
 * 
 *         def draw_func(x, y, w, h):
 */
  __pyx_t_3 = 1;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_int_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_height = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1234
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func, 0, __pyx_n_s_get_half_locals_draw_func, ((PyObject*)__pyx_cur_scope), __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_draw_func = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1245
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, __pyx_ptype_5renpy_7display_6render_Render); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__pyx_t_2 != 0);
  if (__pyx_t_7) {

    /* "renpy/gl/gldraw.pyx":1246
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_is_opaque); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":1245
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse, renpy.config.nearest_neighbor, False)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1248
 *             what.is_opaque()
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)             # <<<<<<<<<<<<<<
 * 
 *         what.half_cache = rv
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_texture_grid_from_drawing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_width, __pyx_cur_scope->__pyx_v_height, __pyx_v_draw_func, __pyx_v_self->rtt, ((PyObject *)__pyx_v_self->environ)};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_width, __pyx_cur_scope->__pyx_v_height, __pyx_v_draw_func, __pyx_v_self->rtt, ((PyObject *)__pyx_v_self->environ)};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_width);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_height);
    __Pyx_INCREF(__pyx_v_draw_func);
    __Pyx_GIVEREF(__pyx_v_draw_func);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_8, __pyx_v_draw_func);
    __Pyx_INCREF(__pyx_v_self->rtt);
    __Pyx_GIVEREF(__pyx_v_self->rtt);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_8, __pyx_v_self->rtt);
    __Pyx_INCREF(((PyObject *)__pyx_v_self->environ));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->environ));
    PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_8, ((PyObject *)__pyx_v_self->environ));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1250
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 * 
 *         what.half_cache = rv             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s_half_cache, __pyx_v_rv) < 0) __PYX_ERR(0, 1250, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1252
 *         what.half_cache = rv
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1218
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_half", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_draw_func);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1255
 * 
 * 
 *     def translate_point(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Translates (x, y) from physical to virtual coordinates.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_41translate_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_40translate_point[] = "\n        Translates (x, y) from physical to virtual coordinates.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_41translate_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("translate_point (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("translate_point", 1, 2, 2, 1); __PYX_ERR(0, 1255, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate_point") < 0)) __PYX_ERR(0, 1255, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("translate_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1255, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.translate_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_40translate_point(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_40translate_point(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_vw = NULL;
  PyObject *__pyx_v_vh = NULL;
  PyObject *__pyx_v_vx = NULL;
  PyObject *__pyx_v_vy = NULL;
  PyObject *__pyx_v_vbw = NULL;
  PyObject *__pyx_v_vbh = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("translate_point", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/gl/gldraw.pyx":1261
 * 
 *         # Screen sizes.
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box
 */
  __pyx_t_1 = __pyx_v_self->physical_size;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1261, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1261, __pyx_L1_error)
  }
  __pyx_v_pw = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ph = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1262
 *         # Screen sizes.
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size             # <<<<<<<<<<<<<<
 *         vx, vy, vbw, vbh = self.virtual_box
 * 
 */
  __pyx_t_1 = __pyx_v_self->virtual_size;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1262, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1262, __pyx_L1_error)
  }
  __pyx_v_vw = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vh = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1263
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box             # <<<<<<<<<<<<<<
 * 
 *         # Translate to fractional screen.
 */
  __pyx_t_1 = __pyx_v_self->virtual_box;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1263, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1263, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1263, __pyx_L1_error)
  }
  __pyx_v_vx = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vy = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vbw = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_vbh = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1266
 * 
 *         # Translate to fractional screen.
 *         x = 1.0 * x / pw             # <<<<<<<<<<<<<<
 *         y = 1.0 * y / ph
 * 
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_pw); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1267
 *         # Translate to fractional screen.
 *         x = 1.0 * x / pw
 *         y = 1.0 * y / ph             # <<<<<<<<<<<<<<
 * 
 *         # Translate to virtual size.
 */
  __pyx_t_5 = PyNumber_Multiply(__pyx_float_1_0, __pyx_v_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_ph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1270
 * 
 *         # Translate to virtual size.
 *         x = vx + vbw * x             # <<<<<<<<<<<<<<
 *         y = vy + vbh * y
 * 
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_vbw, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Add(__pyx_v_vx, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1271
 *         # Translate to virtual size.
 *         x = vx + vbw * x
 *         y = vy + vbh * y             # <<<<<<<<<<<<<<
 * 
 *         x = int(x)
 */
  __pyx_t_5 = PyNumber_Multiply(__pyx_v_vbh, __pyx_v_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(__pyx_v_vy, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1273
 *         y = vy + vbh * y
 * 
 *         x = int(x)             # <<<<<<<<<<<<<<
 *         y = int(y)
 * 
 */
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1274
 * 
 *         x = int(x)
 *         y = int(y)             # <<<<<<<<<<<<<<
 * 
 *         x = max(0, x)
 */
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1276
 *         y = int(y)
 * 
 *         x = max(0, x)             # <<<<<<<<<<<<<<
 *         x = min(vw, x)
 *         y = max(0, y)
 */
  __Pyx_INCREF(__pyx_v_x);
  __pyx_t_1 = __pyx_v_x;
  __pyx_t_6 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  } else {
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1277
 * 
 *         x = max(0, x)
 *         x = min(vw, x)             # <<<<<<<<<<<<<<
 *         y = max(0, y)
 *         y = min(vh, y)
 */
  __Pyx_INCREF(__pyx_v_x);
  __pyx_t_1 = __pyx_v_x;
  __Pyx_INCREF(__pyx_v_vw);
  __pyx_t_5 = __pyx_v_vw;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1278
 *         x = max(0, x)
 *         x = min(vw, x)
 *         y = max(0, y)             # <<<<<<<<<<<<<<
 *         y = min(vh, y)
 * 
 */
  __Pyx_INCREF(__pyx_v_y);
  __pyx_t_1 = __pyx_v_y;
  __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1279
 *         x = min(vw, x)
 *         y = max(0, y)
 *         y = min(vh, y)             # <<<<<<<<<<<<<<
 * 
 *         return x, y
 */
  __Pyx_INCREF(__pyx_v_y);
  __pyx_t_1 = __pyx_v_y;
  __Pyx_INCREF(__pyx_v_vh);
  __pyx_t_3 = __pyx_v_vh;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1281
 *         y = min(vh, y)
 * 
 *         return x, y             # <<<<<<<<<<<<<<
 * 
 *     def untranslate_point(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1255
 * 
 * 
 *     def translate_point(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Translates (x, y) from physical to virtual coordinates.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.translate_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_vw);
  __Pyx_XDECREF(__pyx_v_vh);
  __Pyx_XDECREF(__pyx_v_vx);
  __Pyx_XDECREF(__pyx_v_vy);
  __Pyx_XDECREF(__pyx_v_vbw);
  __Pyx_XDECREF(__pyx_v_vbh);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1283
 *         return x, y
 * 
 *     def untranslate_point(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Untranslates (x, y) from virtual to physical coordinates.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_43untranslate_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_42untranslate_point[] = "\n        Untranslates (x, y) from virtual to physical coordinates.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_43untranslate_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("untranslate_point (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("untranslate_point", 1, 2, 2, 1); __PYX_ERR(0, 1283, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "untranslate_point") < 0)) __PYX_ERR(0, 1283, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("untranslate_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1283, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.untranslate_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_42untranslate_point(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_42untranslate_point(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_vx = NULL;
  PyObject *__pyx_v_vy = NULL;
  PyObject *__pyx_v_vbw = NULL;
  PyObject *__pyx_v_vbh = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("untranslate_point", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/gl/gldraw.pyx":1289
 * 
 *         # Screen sizes.
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         vx, vy, vbw, vbh = self.virtual_box
 * 
 */
  __pyx_t_1 = __pyx_v_self->physical_size;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1289, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1289, __pyx_L1_error)
  }
  __pyx_v_pw = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ph = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1290
 *         # Screen sizes.
 *         pw, ph = self.physical_size
 *         vx, vy, vbw, vbh = self.virtual_box             # <<<<<<<<<<<<<<
 * 
 *         # Translate from virtual to fractional screen.
 */
  __pyx_t_1 = __pyx_v_self->virtual_box;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1290, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1290, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1290, __pyx_L1_error)
  }
  __pyx_v_vx = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vy = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vbw = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_vbh = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1293
 * 
 *         # Translate from virtual to fractional screen.
 *         x = ( x - vx ) / vbw             # <<<<<<<<<<<<<<
 *         y = ( y - vy ) / vbh
 * 
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_v_vx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_vbw); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1294
 *         # Translate from virtual to fractional screen.
 *         x = ( x - vx ) / vbw
 *         y = ( y - vy ) / vbh             # <<<<<<<<<<<<<<
 * 
 *         # Translate from fractional screen to physical.
 */
  __pyx_t_5 = PyNumber_Subtract(__pyx_v_y, __pyx_v_vy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_vbh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1297
 * 
 *         # Translate from fractional screen to physical.
 *         x = x * pw             # <<<<<<<<<<<<<<
 *         y = y * ph
 * 
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_x, __pyx_v_pw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1298
 *         # Translate from fractional screen to physical.
 *         x = x * pw
 *         y = y * ph             # <<<<<<<<<<<<<<
 * 
 *         x = int(x)
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_y, __pyx_v_ph); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1300
 *         y = y * ph
 * 
 *         x = int(x)             # <<<<<<<<<<<<<<
 *         y = int(y)
 * 
 */
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1301
 * 
 *         x = int(x)
 *         y = int(y)             # <<<<<<<<<<<<<<
 * 
 *         return x, y
 */
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1303
 *         y = int(y)
 * 
 *         return x, y             # <<<<<<<<<<<<<<
 * 
 *     def update_mouse(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1283
 *         return x, y
 * 
 *     def untranslate_point(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Untranslates (x, y) from virtual to physical coordinates.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.untranslate_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_vx);
  __Pyx_XDECREF(__pyx_v_vy);
  __Pyx_XDECREF(__pyx_v_vbw);
  __Pyx_XDECREF(__pyx_v_vbh);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1305
 *         return x, y
 * 
 *     def update_mouse(self):             # <<<<<<<<<<<<<<
 *         # The draw routine updates the mouse. There's no need to
 *         # redraw it event-by-event.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_45update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_45update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_mouse (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_44update_mouse(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_44update_mouse(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_mouse", 0);

  /* "renpy/gl/gldraw.pyx":1309
 *         # redraw it event-by-event.
 * 
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def mouse_event(self, ev):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1305
 *         return x, y
 * 
 *     def update_mouse(self):             # <<<<<<<<<<<<<<
 *         # The draw routine updates the mouse. There's no need to
 *         # redraw it event-by-event.
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1311
 *         return
 * 
 *     def mouse_event(self, ev):             # <<<<<<<<<<<<<<
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())
 *         return self.translate_point(x, y)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_47mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_47mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mouse_event (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_46mouse_event(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_ev));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_46mouse_event(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_ev) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("mouse_event", 0);

  /* "renpy/gl/gldraw.pyx":1312
 * 
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())             # <<<<<<<<<<<<<<
 *         return self.translate_point(x, y)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mouse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_ev, __pyx_n_s_pos, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1312, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1312, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1312, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1313
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())
 *         return self.translate_point(x, y)             # <<<<<<<<<<<<<<
 * 
 *     def get_mouse_pos(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_translate_point); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_x, __pyx_v_y};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_x, __pyx_v_y};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1311
 *         return
 * 
 *     def mouse_event(self, ev):             # <<<<<<<<<<<<<<
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())
 *         return self.translate_point(x, y)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.mouse_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1315
 *         return self.translate_point(x, y)
 * 
 *     def get_mouse_pos(self):             # <<<<<<<<<<<<<<
 *         x, y = pygame.mouse.get_pos()
 *         return self.translate_point(x, y)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_49get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_49get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mouse_pos (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_48get_mouse_pos(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_48get_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("get_mouse_pos", 0);

  /* "renpy/gl/gldraw.pyx":1316
 * 
 *     def get_mouse_pos(self):
 *         x, y = pygame.mouse.get_pos()             # <<<<<<<<<<<<<<
 *         return self.translate_point(x, y)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mouse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1316, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1316, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1316, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_y = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1317
 *     def get_mouse_pos(self):
 *         x, y = pygame.mouse.get_pos()
 *         return self.translate_point(x, y)             # <<<<<<<<<<<<<<
 * 
 *     def set_mouse_pos(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_translate_point); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1315
 *         return self.translate_point(x, y)
 * 
 *     def get_mouse_pos(self):             # <<<<<<<<<<<<<<
 *         x, y = pygame.mouse.get_pos()
 *         return self.translate_point(x, y)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1319
 *         return self.translate_point(x, y)
 * 
 *     def set_mouse_pos(self, x, y):             # <<<<<<<<<<<<<<
 *         x, y = self.untranslate_point(x, y)
 *         pygame.mouse.set_pos([x, y])
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_51set_mouse_pos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_51set_mouse_pos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_mouse_pos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mouse_pos", 1, 2, 2, 1); __PYX_ERR(0, 1319, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_mouse_pos") < 0)) __PYX_ERR(0, 1319, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_mouse_pos", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1319, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_50set_mouse_pos(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_50set_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("set_mouse_pos", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/gl/gldraw.pyx":1320
 * 
 *     def set_mouse_pos(self, x, y):
 *         x, y = self.untranslate_point(x, y)             # <<<<<<<<<<<<<<
 *         pygame.mouse.set_pos([x, y])
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_untranslate_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_y};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_y);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1320, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1320, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1320, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1321
 *     def set_mouse_pos(self, x, y):
 *         x, y = self.untranslate_point(x, y)
 *         pygame.mouse.set_pos([x, y])             # <<<<<<<<<<<<<<
 * 
 *     # Private.
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_mouse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1319
 *         return self.translate_point(x, y)
 * 
 *     def set_mouse_pos(self, x, y):             # <<<<<<<<<<<<<<
 *         x, y = self.untranslate_point(x, y)
 *         pygame.mouse.set_pos([x, y])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1324
 * 
 *     # Private.
 *     def draw_mouse(self):             # <<<<<<<<<<<<<<
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_53draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_53draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_mouse (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_52draw_mouse(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_52draw_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_hardware = NULL;
  PyObject *__pyx_v_mx = NULL;
  PyObject *__pyx_v_my = NULL;
  PyObject *__pyx_v_tex = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_pbx = NULL;
  PyObject *__pyx_v_pby = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_pbw = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_pbh = NULL;
  PyObject *__pyx_v_xmul = NULL;
  PyObject *__pyx_v_ymul = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  double __pyx_t_12;
  double __pyx_t_13;
  __Pyx_RefNannySetupContext("draw_mouse", 0);

  /* "renpy/gl/gldraw.pyx":1326
 *     def draw_mouse(self):
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()             # <<<<<<<<<<<<<<
 * 
 *         self.mouse_info = (mx, my, tex)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_game); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_mouse_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1326, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1326, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1326, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 1326, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1326, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_hardware = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_mx = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_my = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_tex = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1328
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()
 * 
 *         self.mouse_info = (mx, my, tex)             # <<<<<<<<<<<<<<
 * 
 *         if self.mouse_old_visible != hardware:
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_mx);
  __Pyx_GIVEREF(__pyx_v_mx);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mx);
  __Pyx_INCREF(__pyx_v_my);
  __Pyx_GIVEREF(__pyx_v_my);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_my);
  __Pyx_INCREF(__pyx_v_tex);
  __Pyx_GIVEREF(__pyx_v_tex);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_tex);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->mouse_info);
  __Pyx_DECREF(__pyx_v_self->mouse_info);
  __pyx_v_self->mouse_info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1330
 *         self.mouse_info = (mx, my, tex)
 * 
 *         if self.mouse_old_visible != hardware:             # <<<<<<<<<<<<<<
 *             pygame.mouse.set_visible(hardware)
 *             self.mouse_old_visible = hardware
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mouse_old_visible, __pyx_v_hardware, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":1331
 * 
 *         if self.mouse_old_visible != hardware:
 *             pygame.mouse.set_visible(hardware)             # <<<<<<<<<<<<<<
 *             self.mouse_old_visible = hardware
 * 
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_mouse); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_set_visible); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_hardware); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_hardware};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_hardware};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_hardware);
        __Pyx_GIVEREF(__pyx_v_hardware);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_hardware);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":1332
 *         if self.mouse_old_visible != hardware:
 *             pygame.mouse.set_visible(hardware)
 *             self.mouse_old_visible = hardware             # <<<<<<<<<<<<<<
 * 
 *         if not tex:
 */
    __Pyx_INCREF(__pyx_v_hardware);
    __Pyx_GIVEREF(__pyx_v_hardware);
    __Pyx_GOTREF(__pyx_v_self->mouse_old_visible);
    __Pyx_DECREF(__pyx_v_self->mouse_old_visible);
    __pyx_v_self->mouse_old_visible = __pyx_v_hardware;

    /* "renpy/gl/gldraw.pyx":1330
 *         self.mouse_info = (mx, my, tex)
 * 
 *         if self.mouse_old_visible != hardware:             # <<<<<<<<<<<<<<
 *             pygame.mouse.set_visible(hardware)
 *             self.mouse_old_visible = hardware
 */
  }

  /* "renpy/gl/gldraw.pyx":1334
 *             self.mouse_old_visible = hardware
 * 
 *         if not tex:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_tex); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":1335
 * 
 *         if not tex:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         x, y = pygame.mouse.get_pos()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/gl/gldraw.pyx":1334
 *             self.mouse_old_visible = hardware
 * 
 *         if not tex:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1337
 *             return
 * 
 *         x, y = pygame.mouse.get_pos()             # <<<<<<<<<<<<<<
 * 
 *         x -= mx
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_mouse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1337, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1337, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1337, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1337, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1337, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1339
 *         x, y = pygame.mouse.get_pos()
 * 
 *         x -= mx             # <<<<<<<<<<<<<<
 *         y -= my
 * 
 */
  __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_x, __pyx_v_mx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1340
 * 
 *         x -= mx
 *         y -= my             # <<<<<<<<<<<<<<
 * 
 *         pw, ph = self.physical_size
 */
  __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_y, __pyx_v_my); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1342
 *         y -= my
 * 
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         pbx, pby, pbw, pbh = self.physical_box
 * 
 */
  __pyx_t_1 = __pyx_v_self->physical_size;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1342, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1342, __pyx_L1_error)
  }
  __pyx_v_pw = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ph = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1343
 * 
 *         pw, ph = self.physical_size
 *         pbx, pby, pbw, pbh = self.physical_box             # <<<<<<<<<<<<<<
 * 
 *         xmul = 1.0 * self.drawable_size[0] / self.physical_size[0]
 */
  __pyx_t_1 = __pyx_v_self->physical_box;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1343, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1343, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1343, __pyx_L1_error)
  }
  __pyx_v_pbx = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_pby = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_pbw = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_pbh = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1345
 *         pbx, pby, pbw, pbh = self.physical_box
 * 
 *         xmul = 1.0 * self.drawable_size[0] / self.physical_size[0]             # <<<<<<<<<<<<<<
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]
 * 
 */
  if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1345, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_v_self->physical_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1345, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_xmul = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1346
 * 
 *         xmul = 1.0 * self.drawable_size[0] / self.physical_size[0]
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]             # <<<<<<<<<<<<<<
 * 
 *         self.environ.viewport(0, 0, xmul * pw, ymul * ph)
 */
  if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1346, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Multiply(__pyx_float_1_0, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(__pyx_v_self->physical_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1346, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_ymul = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1348
 *         ymul = 1.0 * self.drawable_size[1] / self.physical_size[1]
 * 
 *         self.environ.viewport(0, 0, xmul * pw, ymul * ph)             # <<<<<<<<<<<<<<
 *         self.environ.ortho(0, pw, ph, 0, -1.0, 1.0)
 * 
 */
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_xmul, __pyx_v_pw); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_ymul, __pyx_v_ph); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->viewport(__pyx_v_self->environ, 0, 0, __pyx_t_10, __pyx_t_11);

  /* "renpy/gl/gldraw.pyx":1349
 * 
 *         self.environ.viewport(0, 0, xmul * pw, ymul * ph)
 *         self.environ.ortho(0, pw, ph, 0, -1.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_screen()
 */
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_pw); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1349, __pyx_L1_error)
  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_ph); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1349, __pyx_L1_error)
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->ortho(__pyx_v_self->environ, 0.0, __pyx_t_12, __pyx_t_13, 0.0, -1.0, 1.0);

  /* "renpy/gl/gldraw.pyx":1351
 *         self.environ.ortho(0, pw, ph, 0, -1.0, 1.0)
 * 
 *         self.clip_mode_screen()             # <<<<<<<<<<<<<<
 *         self.set_clip((-pbx, -pby, pw, ph))
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clip_mode_screen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1351, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1352
 * 
 *         self.clip_mode_screen()
 *         self.set_clip((-pbx, -pby, pw, ph))             # <<<<<<<<<<<<<<
 * 
 *         gltexture.blit(
 */
  __pyx_t_3 = PyNumber_Negative(__pyx_v_pbx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Negative(__pyx_v_pby); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_pw);
  __Pyx_GIVEREF(__pyx_v_pw);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_pw);
  __Pyx_INCREF(__pyx_v_ph);
  __Pyx_GIVEREF(__pyx_v_ph);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_ph);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, ((PyObject*)__pyx_t_1), 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1355
 * 
 *         gltexture.blit(
 *             tex,             # <<<<<<<<<<<<<<
 *             x,
 *             y,
 */
  if (!(likely(((__pyx_v_tex) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_tex, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) __PYX_ERR(0, 1355, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1356
 *         gltexture.blit(
 *             tex,
 *             x,             # <<<<<<<<<<<<<<
 *             y,
 *             IDENTITY,
 */
  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1357
 *             tex,
 *             x,
 *             y,             # <<<<<<<<<<<<<<
 *             IDENTITY,
 *             1.0,
 */
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_y); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1357, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1358
 *             x,
 *             y,
 *             IDENTITY,             # <<<<<<<<<<<<<<
 *             1.0,
 *             1.0,
 */
  if (!(likely(((__pyx_v_5renpy_2gl_6gldraw_IDENTITY) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_5renpy_2gl_6gldraw_IDENTITY, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(0, 1358, __pyx_L1_error)
  __pyx_t_4 = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_t_4);

  /* "renpy/gl/gldraw.pyx":1361
 *             1.0,
 *             1.0,
 *             self.environ,             # <<<<<<<<<<<<<<
 *             False)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->environ);
  __Pyx_INCREF(__pyx_t_1);

  /* "renpy/gl/gldraw.pyx":1354
 *         self.set_clip((-pbx, -pby, pw, ph))
 * 
 *         gltexture.blit(             # <<<<<<<<<<<<<<
 *             tex,
 *             x,
 */
  __pyx_t_3 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_v_tex), __pyx_t_13, __pyx_t_12, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_4), 1.0, 1.0, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_1), 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1324
 * 
 *     # Private.
 *     def draw_mouse(self):             # <<<<<<<<<<<<<<
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_hardware);
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_pbx);
  __Pyx_XDECREF(__pyx_v_pby);
  __Pyx_XDECREF(__pyx_v_pbw);
  __Pyx_XDECREF(__pyx_v_pbh);
  __Pyx_XDECREF(__pyx_v_xmul);
  __Pyx_XDECREF(__pyx_v_ymul);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1364
 *             False)
 * 
 *     def screenshot(self, surftree, fullscreen_video):             # <<<<<<<<<<<<<<
 *         cdef unsigned char *pixels
 *         cdef SDL_Surface *surf
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_55screenshot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_55screenshot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surftree = 0;
  PyObject *__pyx_v_fullscreen_video = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("screenshot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surftree,&__pyx_n_s_fullscreen_video,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_surftree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fullscreen_video)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screenshot", 1, 2, 2, 1); __PYX_ERR(0, 1364, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "screenshot") < 0)) __PYX_ERR(0, 1364, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_surftree = values[0];
    __pyx_v_fullscreen_video = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("screenshot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1364, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.screenshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_54screenshot(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, __pyx_v_fullscreen_video);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_54screenshot(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, PyObject *__pyx_v_fullscreen_video) {
  unsigned char *__pyx_v_pixels;
  SDL_Surface *__pyx_v_surf;
  unsigned char *__pyx_v_raw_pixels;
  unsigned char *__pyx_v_rpp;
  int __pyx_v_x;
  CYTHON_UNUSED int __pyx_v_y;
  int __pyx_v_pitch;
  PyObject *__pyx_v_full = NULL;
  PyObject *__pyx_v_px = NULL;
  PyObject *__pyx_v_py = NULL;
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_xmul = NULL;
  PyObject *__pyx_v_ymul = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("screenshot", 0);

  /* "renpy/gl/gldraw.pyx":1373
 * 
 *         # A surface the size of the framebuffer.
 *         full = renpy.display.pgrender.surface_unscaled(self.drawable_size, False)             # <<<<<<<<<<<<<<
 *         surf = PySurface_AsSurface(full)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pgrender); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_surface_unscaled); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self->drawable_size, Py_False};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self->drawable_size, Py_False};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self->drawable_size);
    __Pyx_GIVEREF(__pyx_v_self->drawable_size);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_self->drawable_size);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_False);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_full = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1374
 *         # A surface the size of the framebuffer.
 *         full = renpy.display.pgrender.surface_unscaled(self.drawable_size, False)
 *         surf = PySurface_AsSurface(full)             # <<<<<<<<<<<<<<
 * 
 *         # Create an array that can hold densely-packed pixels.
 */
  __pyx_v_surf = PySurface_AsSurface(__pyx_v_full);

  /* "renpy/gl/gldraw.pyx":1377
 * 
 *         # Create an array that can hold densely-packed pixels.
 *         raw_pixels = <unsigned char *> malloc(surf.w * surf.h * 4)             # <<<<<<<<<<<<<<
 * 
 *         # Draw the last screen to the back buffer.
 */
  __pyx_v_raw_pixels = ((unsigned char *)malloc(((__pyx_v_surf->w * __pyx_v_surf->h) * 4)));

  /* "renpy/gl/gldraw.pyx":1380
 * 
 *         # Draw the last screen to the back buffer.
 *         if surftree is not None:             # <<<<<<<<<<<<<<
 *             self.draw_screen(surftree, fullscreen_video, flip=False)
 *             glFinish()
 */
  __pyx_t_6 = (__pyx_v_surftree != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "renpy/gl/gldraw.pyx":1381
 *         # Draw the last screen to the back buffer.
 *         if surftree is not None:
 *             self.draw_screen(surftree, fullscreen_video, flip=False)             # <<<<<<<<<<<<<<
 *             glFinish()
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_draw_screen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_surftree);
    __Pyx_GIVEREF(__pyx_v_surftree);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surftree);
    __Pyx_INCREF(__pyx_v_fullscreen_video);
    __Pyx_GIVEREF(__pyx_v_fullscreen_video);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_fullscreen_video);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_flip, Py_False) < 0) __PYX_ERR(0, 1381, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1382
 *         if surftree is not None:
 *             self.draw_screen(surftree, fullscreen_video, flip=False)
 *             glFinish()             # <<<<<<<<<<<<<<
 * 
 *         # Read the pixels.
 */
    __pyx_t_4 = __pyx_f_5renpy_2gl_2gl_glFinish(); if (unlikely(__pyx_t_4 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1382, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1380
 * 
 *         # Draw the last screen to the back buffer.
 *         if surftree is not None:             # <<<<<<<<<<<<<<
 *             self.draw_screen(surftree, fullscreen_video, flip=False)
 *             glFinish()
 */
  }

  /* "renpy/gl/gldraw.pyx":1385
 * 
 *         # Read the pixels.
 *         glReadPixels(             # <<<<<<<<<<<<<<
 *             0,
 *             0,
 */
  __pyx_t_4 = __pyx_f_5renpy_2gl_2gl_glReadPixels(0, 0, __pyx_v_surf->w, __pyx_v_surf->h, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_raw_pixels); if (unlikely(__pyx_t_4 == ((int)0) && PyErr_Occurred())) __PYX_ERR(0, 1385, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1395
 * 
 *         # Copy the pixels from raw_pixels to the surface.
 *         pixels = <unsigned char *> surf.pixels             # <<<<<<<<<<<<<<
 *         pitch = surf.pitch
 *         rpp = raw_pixels
 */
  __pyx_v_pixels = ((unsigned char *)__pyx_v_surf->pixels);

  /* "renpy/gl/gldraw.pyx":1396
 *         # Copy the pixels from raw_pixels to the surface.
 *         pixels = <unsigned char *> surf.pixels
 *         pitch = surf.pitch             # <<<<<<<<<<<<<<
 *         rpp = raw_pixels
 * 
 */
  __pyx_t_4 = __pyx_v_surf->pitch;
  __pyx_v_pitch = __pyx_t_4;

  /* "renpy/gl/gldraw.pyx":1397
 *         pixels = <unsigned char *> surf.pixels
 *         pitch = surf.pitch
 *         rpp = raw_pixels             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_v_rpp = __pyx_v_raw_pixels;

  /* "renpy/gl/gldraw.pyx":1399
 *         rpp = raw_pixels
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             for y from 0 <= y < surf.h:
 *                 for x from 0 <= x < (surf.w * 4):
 */
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      #endif
      /*try:*/ {

        /* "renpy/gl/gldraw.pyx":1400
 * 
 *         with nogil:
 *             for y from 0 <= y < surf.h:             # <<<<<<<<<<<<<<
 *                 for x from 0 <= x < (surf.w * 4):
 *                     pixels[x] = rpp[x]
 */
        __pyx_t_4 = __pyx_v_surf->h;
        for (__pyx_v_y = 0; __pyx_v_y < __pyx_t_4; __pyx_v_y++) {

          /* "renpy/gl/gldraw.pyx":1401
 *         with nogil:
 *             for y from 0 <= y < surf.h:
 *                 for x from 0 <= x < (surf.w * 4):             # <<<<<<<<<<<<<<
 *                     pixels[x] = rpp[x]
 * 
 */
          __pyx_t_8 = (__pyx_v_surf->w * 4);
          for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_8; __pyx_v_x++) {

            /* "renpy/gl/gldraw.pyx":1402
 *             for y from 0 <= y < surf.h:
 *                 for x from 0 <= x < (surf.w * 4):
 *                     pixels[x] = rpp[x]             # <<<<<<<<<<<<<<
 * 
 *                 pixels += pitch
 */
            (__pyx_v_pixels[__pyx_v_x]) = (__pyx_v_rpp[__pyx_v_x]);
          }

          /* "renpy/gl/gldraw.pyx":1404
 *                     pixels[x] = rpp[x]
 * 
 *                 pixels += pitch             # <<<<<<<<<<<<<<
 *                 rpp += surf.w * 4
 * 
 */
          __pyx_v_pixels = (__pyx_v_pixels + __pyx_v_pitch);

          /* "renpy/gl/gldraw.pyx":1405
 * 
 *                 pixels += pitch
 *                 rpp += surf.w * 4             # <<<<<<<<<<<<<<
 * 
 *         free(raw_pixels)
 */
          __pyx_v_rpp = (__pyx_v_rpp + (__pyx_v_surf->w * 4));
        }
      }

      /* "renpy/gl/gldraw.pyx":1399
 *         rpp = raw_pixels
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             for y from 0 <= y < surf.h:
 *                 for x from 0 <= x < (surf.w * 4):
 */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "renpy/gl/gldraw.pyx":1407
 *                 rpp += surf.w * 4
 * 
 *         free(raw_pixels)             # <<<<<<<<<<<<<<
 * 
 *         px, py, pw, ph = self.physical_box
 */
  free(__pyx_v_raw_pixels);

  /* "renpy/gl/gldraw.pyx":1409
 *         free(raw_pixels)
 * 
 *         px, py, pw, ph = self.physical_box             # <<<<<<<<<<<<<<
 *         xmul = self.drawable_size[0] / self.physical_size[0]
 *         ymul = self.drawable_size[1] / self.physical_size[1]
 */
  __pyx_t_2 = __pyx_v_self->physical_box;
  __Pyx_INCREF(__pyx_t_2);
  if (likely(__pyx_t_2 != Py_None)) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1409, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_9 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_9);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_9};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1409, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1409, __pyx_L1_error)
  }
  __pyx_v_px = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_py = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_pw = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_ph = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "renpy/gl/gldraw.pyx":1410
 * 
 *         px, py, pw, ph = self.physical_box
 *         xmul = self.drawable_size[0] / self.physical_size[0]             # <<<<<<<<<<<<<<
 *         ymul = self.drawable_size[1] / self.physical_size[1]
 * 
 */
  if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1410, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_v_self->physical_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1410, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_size, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_xmul = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1411
 *         px, py, pw, ph = self.physical_box
 *         xmul = self.drawable_size[0] / self.physical_size[0]
 *         ymul = self.drawable_size[1] / self.physical_size[1]             # <<<<<<<<<<<<<<
 * 
 *         # Crop and flip it, since it's upside down.
 */
  if (unlikely(__pyx_v_self->drawable_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1411, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->drawable_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_v_self->physical_size == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1411, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_v_self->physical_size, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_ymul = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1414
 * 
 *         # Crop and flip it, since it's upside down.
 *         rv = full.subsurface((px * xmul, py * ymul, pw * xmul, ph * ymul))             # <<<<<<<<<<<<<<
 *         rv = renpy.display.pgrender.flip_unscaled(rv, False, True)
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_full, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_px, __pyx_v_xmul); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_py, __pyx_v_ymul); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyNumber_Multiply(__pyx_v_pw, __pyx_v_xmul); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = PyNumber_Multiply(__pyx_v_ph, __pyx_v_ymul); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  if (!__pyx_t_10) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1414, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_rv = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1415
 *         # Crop and flip it, since it's upside down.
 *         rv = full.subsurface((px * xmul, py * ymul, pw * xmul, ph * ymul))
 *         rv = renpy.display.pgrender.flip_unscaled(rv, False, True)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_display); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_pgrender); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_flip_unscaled); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_rv, Py_False, Py_True};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_rv, Py_False, Py_True};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_4, __pyx_v_rv);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_4, Py_False);
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_4, Py_True);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1417
 *         rv = renpy.display.pgrender.flip_unscaled(rv, False, True)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def kill_textures(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1364
 *             False)
 * 
 *     def screenshot(self, surftree, fullscreen_video):             # <<<<<<<<<<<<<<
 *         cdef unsigned char *pixels
 *         cdef SDL_Surface *surf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.screenshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_full);
  __Pyx_XDECREF(__pyx_v_px);
  __Pyx_XDECREF(__pyx_v_py);
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_xmul);
  __Pyx_XDECREF(__pyx_v_ymul);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1419
 *         return rv
 * 
 *     def kill_textures(self):             # <<<<<<<<<<<<<<
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_57kill_textures(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_57kill_textures(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kill_textures (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_56kill_textures(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_56kill_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("kill_textures", 0);

  /* "renpy/gl/gldraw.pyx":1420
 * 
 *     def kill_textures(self):
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->texture_cache, __pyx_n_s_clear); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1420, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1420, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1421
 *     def kill_textures(self):
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *     def event_peek_sleep(self):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gltexture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dealloc_textures); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1419
 *         return rv
 * 
 *     def kill_textures(self):             # <<<<<<<<<<<<<<
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.kill_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1423
 *         gltexture.dealloc_textures()
 * 
 *     def event_peek_sleep(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_59event_peek_sleep(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_59event_peek_sleep(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("event_peek_sleep (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_58event_peek_sleep(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_58event_peek_sleep(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("event_peek_sleep", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1426
 *         pass
 * 
 *     def get_physical_size(self):             # <<<<<<<<<<<<<<
 *         x, y = self.physical_size
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_61get_physical_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_61get_physical_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_physical_size (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_60get_physical_size(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_60get_physical_size(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_physical_size", 0);

  /* "renpy/gl/gldraw.pyx":1427
 * 
 *     def get_physical_size(self):
 *         x, y = self.physical_size             # <<<<<<<<<<<<<<
 * 
 *         x = int(x / self.dpi_scale)
 */
  __pyx_t_1 = __pyx_v_self->physical_size;
  __Pyx_INCREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1427, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1427, __pyx_L1_error)
  }
  __pyx_v_x = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_y = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1429
 *         x, y = self.physical_size
 * 
 *         x = int(x / self.dpi_scale)             # <<<<<<<<<<<<<<
 *         y = int(y / self.dpi_scale)
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->dpi_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1430
 * 
 *         x = int(x / self.dpi_scale)
 *         y = int(y / self.dpi_scale)             # <<<<<<<<<<<<<<
 * 
 *         return (x, y)
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->dpi_scale); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_y, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1432
 *         y = int(y / self.dpi_scale)
 * 
 *         return (x, y)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1426
 *         pass
 * 
 *     def get_physical_size(self):             # <<<<<<<<<<<<<<
 *         x, y = self.physical_size
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_physical_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":32
 *     cdef bint did_texture_test
 *     cdef Environ environ
 *     cdef public object rtt             # <<<<<<<<<<<<<<
 *     cdef object window
 *     cdef tuple virtual_size
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->rtt);
  __pyx_r = __pyx_v_self->rtt;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->rtt);
  __Pyx_DECREF(__pyx_v_self->rtt);
  __pyx_v_self->rtt = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->rtt);
  __Pyx_DECREF(__pyx_v_self->rtt);
  __pyx_v_self->rtt = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":35
 *     cdef object window
 *     cdef tuple virtual_size
 *     cdef public tuple physical_size             # <<<<<<<<<<<<<<
 *     cdef public tuple drawable_size
 *     cdef public tuple virtual_box
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->physical_size);
  __pyx_r = __pyx_v_self->physical_size;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 35, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(__pyx_v_self->physical_size);
  __pyx_v_self->physical_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.physical_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(__pyx_v_self->physical_size);
  __pyx_v_self->physical_size = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":36
 *     cdef tuple virtual_size
 *     cdef public tuple physical_size
 *     cdef public tuple drawable_size             # <<<<<<<<<<<<<<
 *     cdef public tuple virtual_box
 *     cdef public tuple physical_box
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->drawable_size);
  __pyx_r = __pyx_v_self->drawable_size;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 36, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->drawable_size);
  __Pyx_DECREF(__pyx_v_self->drawable_size);
  __pyx_v_self->drawable_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.drawable_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->drawable_size);
  __Pyx_DECREF(__pyx_v_self->drawable_size);
  __pyx_v_self->drawable_size = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":37
 *     cdef public tuple physical_size
 *     cdef public tuple drawable_size
 *     cdef public tuple virtual_box             # <<<<<<<<<<<<<<
 *     cdef public tuple physical_box
 *     cdef object mouse_old_visible
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->virtual_box);
  __pyx_r = __pyx_v_self->virtual_box;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 37, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->virtual_box);
  __Pyx_DECREF(__pyx_v_self->virtual_box);
  __pyx_v_self->virtual_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.virtual_box.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->virtual_box);
  __Pyx_DECREF(__pyx_v_self->virtual_box);
  __pyx_v_self->virtual_box = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":38
 *     cdef public tuple drawable_size
 *     cdef public tuple virtual_box
 *     cdef public tuple physical_box             # <<<<<<<<<<<<<<
 *     cdef object mouse_old_visible
 *     cdef object mouse_info
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->physical_box);
  __pyx_r = __pyx_v_self->physical_box;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 38, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->physical_box);
  __Pyx_DECREF(__pyx_v_self->physical_box);
  __pyx_v_self->physical_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.physical_box.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->physical_box);
  __Pyx_DECREF(__pyx_v_self->physical_box);
  __pyx_v_self->physical_box = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":44
 *     cdef double last_redraw_time
 *     cdef double redraw_period
 *     cdef public dict info             # <<<<<<<<<<<<<<
 *     cdef object old_fullscreen
 *     cdef public object fullscreen_surface
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->info);
  __pyx_r = __pyx_v_self->info;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 44, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->info);
  __Pyx_DECREF(__pyx_v_self->info);
  __pyx_v_self->info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.info.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->info);
  __Pyx_DECREF(__pyx_v_self->info);
  __pyx_v_self->info = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":46
 *     cdef public dict info
 *     cdef object old_fullscreen
 *     cdef public object fullscreen_surface             # <<<<<<<<<<<<<<
 *     cdef object display_info
 *     cdef tuple clip_cache
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->fullscreen_surface);
  __pyx_r = __pyx_v_self->fullscreen_surface;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->fullscreen_surface);
  __Pyx_DECREF(__pyx_v_self->fullscreen_surface);
  __pyx_v_self->fullscreen_surface = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->fullscreen_surface);
  __Pyx_DECREF(__pyx_v_self->fullscreen_surface);
  __pyx_v_self->fullscreen_surface = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":56
 *     cdef object ready_texture_queue
 * 
 *     cdef public tuple clip_rtt_box             # <<<<<<<<<<<<<<
 * 
 *     # The number of drawable pixels per virtual pixel.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->clip_rtt_box);
  __pyx_r = __pyx_v_self->clip_rtt_box;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 56, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(__pyx_v_self->clip_rtt_box);
  __pyx_v_self->clip_rtt_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.clip_rtt_box.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(__pyx_v_self->clip_rtt_box);
  __pyx_v_self->clip_rtt_box = ((PyObject*)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":59
 * 
 *     # The number of drawable pixels per virtual pixel.
 *     cdef public object draw_per_virt             # <<<<<<<<<<<<<<
 * 
 *     # Matrices that transform drawable to virtual, and vice versa.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->draw_per_virt);
  __pyx_r = __pyx_v_self->draw_per_virt;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->draw_per_virt);
  __Pyx_DECREF(__pyx_v_self->draw_per_virt);
  __pyx_v_self->draw_per_virt = __pyx_v_value;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->draw_per_virt);
  __Pyx_DECREF(__pyx_v_self->draw_per_virt);
  __pyx_v_self->draw_per_virt = Py_None;

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":62
 * 
 *     # Matrices that transform drawable to virtual, and vice versa.
 *     cdef public Matrix virt_to_draw             # <<<<<<<<<<<<<<
 *     cdef public Matrix draw_to_virt
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->virt_to_draw));
  __pyx_r = ((PyObject *)__pyx_v_self->virt_to_draw);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(1, 62, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->virt_to_draw);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->virt_to_draw));
  __pyx_v_self->virt_to_draw = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.virt_to_draw.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->virt_to_draw);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->virt_to_draw));
  __pyx_v_self->virt_to_draw = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":63
 *     # Matrices that transform drawable to virtual, and vice versa.
 *     cdef public Matrix virt_to_draw
 *     cdef public Matrix draw_to_virt             # <<<<<<<<<<<<<<
 * 
 *     cdef public int fast_redraw_frames
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->draw_to_virt));
  __pyx_r = ((PyObject *)__pyx_v_self->draw_to_virt);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(1, 63, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->draw_to_virt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->draw_to_virt));
  __pyx_v_self->draw_to_virt = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_to_virt.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->draw_to_virt);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->draw_to_virt));
  __pyx_v_self->draw_to_virt = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)Py_None);

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":65
 *     cdef public Matrix draw_to_virt
 * 
 *     cdef public int fast_redraw_frames             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_clip(GLDraw self, tuple clip)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->fast_redraw_frames); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.fast_redraw_frames.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 65, __pyx_L1_error)
  __pyx_v_self->fast_redraw_frames = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.fast_redraw_frames.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = (self.allow_fixed, self.clip_cache, self.clip_rtt_box, self.default_clip, self.did_init, self.did_render_to_texture, self.did_texture_test, self.display_info, self.dpi_scale, self.draw_per_virt, self.draw_to_virt, self.drawable_size, self.environ, self.fast_dissolve, self.fast_redraw_frames, self.fullscreen_surface, self.info, self.last_redraw_time, self.mouse_info, self.mouse_old_visible, self.old_fullscreen, self.physical_box, self.physical_size, self.ready_texture_queue, self.redraw_period, self.rtt, self.texture_cache, self.virt_to_draw, self.virtual_box, self.virtual_size, self.window)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_63__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_63__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_62__reduce_cython__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_62__reduce_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_v_use_setstate;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v__dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     cdef bint use_setstate
 *     state = (self.allow_fixed, self.clip_cache, self.clip_rtt_box, self.default_clip, self.did_init, self.did_render_to_texture, self.did_texture_test, self.display_info, self.dpi_scale, self.draw_per_virt, self.draw_to_virt, self.drawable_size, self.environ, self.fast_dissolve, self.fast_redraw_frames, self.fullscreen_surface, self.info, self.last_redraw_time, self.mouse_info, self.mouse_old_visible, self.old_fullscreen, self.physical_box, self.physical_size, self.ready_texture_queue, self.redraw_period, self.rtt, self.texture_cache, self.virt_to_draw, self.virtual_box, self.virtual_size, self.window)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->allow_fixed); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->did_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->did_render_to_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->did_texture_test); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->dpi_scale); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->fast_dissolve); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->fast_redraw_frames); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->last_redraw_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->redraw_period); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyTuple_New(31); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->clip_cache);
  __Pyx_GIVEREF(__pyx_v_self->clip_cache);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_self->clip_cache);
  __Pyx_INCREF(__pyx_v_self->clip_rtt_box);
  __Pyx_GIVEREF(__pyx_v_self->clip_rtt_box);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_self->clip_rtt_box);
  __Pyx_INCREF(__pyx_v_self->default_clip);
  __Pyx_GIVEREF(__pyx_v_self->default_clip);
  PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_v_self->default_clip);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_self->display_info);
  __Pyx_GIVEREF(__pyx_v_self->display_info);
  PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_v_self->display_info);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->draw_per_virt);
  __Pyx_GIVEREF(__pyx_v_self->draw_per_virt);
  PyTuple_SET_ITEM(__pyx_t_10, 9, __pyx_v_self->draw_per_virt);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->draw_to_virt));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->draw_to_virt));
  PyTuple_SET_ITEM(__pyx_t_10, 10, ((PyObject *)__pyx_v_self->draw_to_virt));
  __Pyx_INCREF(__pyx_v_self->drawable_size);
  __Pyx_GIVEREF(__pyx_v_self->drawable_size);
  PyTuple_SET_ITEM(__pyx_t_10, 11, __pyx_v_self->drawable_size);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->environ));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->environ));
  PyTuple_SET_ITEM(__pyx_t_10, 12, ((PyObject *)__pyx_v_self->environ));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 13, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_t_7);
  __Pyx_INCREF(__pyx_v_self->fullscreen_surface);
  __Pyx_GIVEREF(__pyx_v_self->fullscreen_surface);
  PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_v_self->fullscreen_surface);
  __Pyx_INCREF(__pyx_v_self->info);
  __Pyx_GIVEREF(__pyx_v_self->info);
  PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_v_self->info);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 17, __pyx_t_8);
  __Pyx_INCREF(__pyx_v_self->mouse_info);
  __Pyx_GIVEREF(__pyx_v_self->mouse_info);
  PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_v_self->mouse_info);
  __Pyx_INCREF(__pyx_v_self->mouse_old_visible);
  __Pyx_GIVEREF(__pyx_v_self->mouse_old_visible);
  PyTuple_SET_ITEM(__pyx_t_10, 19, __pyx_v_self->mouse_old_visible);
  __Pyx_INCREF(__pyx_v_self->old_fullscreen);
  __Pyx_GIVEREF(__pyx_v_self->old_fullscreen);
  PyTuple_SET_ITEM(__pyx_t_10, 20, __pyx_v_self->old_fullscreen);
  __Pyx_INCREF(__pyx_v_self->physical_box);
  __Pyx_GIVEREF(__pyx_v_self->physical_box);
  PyTuple_SET_ITEM(__pyx_t_10, 21, __pyx_v_self->physical_box);
  __Pyx_INCREF(__pyx_v_self->physical_size);
  __Pyx_GIVEREF(__pyx_v_self->physical_size);
  PyTuple_SET_ITEM(__pyx_t_10, 22, __pyx_v_self->physical_size);
  __Pyx_INCREF(__pyx_v_self->ready_texture_queue);
  __Pyx_GIVEREF(__pyx_v_self->ready_texture_queue);
  PyTuple_SET_ITEM(__pyx_t_10, 23, __pyx_v_self->ready_texture_queue);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_10, 24, __pyx_t_9);
  __Pyx_INCREF(__pyx_v_self->rtt);
  __Pyx_GIVEREF(__pyx_v_self->rtt);
  PyTuple_SET_ITEM(__pyx_t_10, 25, __pyx_v_self->rtt);
  __Pyx_INCREF(__pyx_v_self->texture_cache);
  __Pyx_GIVEREF(__pyx_v_self->texture_cache);
  PyTuple_SET_ITEM(__pyx_t_10, 26, __pyx_v_self->texture_cache);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->virt_to_draw));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->virt_to_draw));
  PyTuple_SET_ITEM(__pyx_t_10, 27, ((PyObject *)__pyx_v_self->virt_to_draw));
  __Pyx_INCREF(__pyx_v_self->virtual_box);
  __Pyx_GIVEREF(__pyx_v_self->virtual_box);
  PyTuple_SET_ITEM(__pyx_t_10, 28, __pyx_v_self->virtual_box);
  __Pyx_INCREF(__pyx_v_self->virtual_size);
  __Pyx_GIVEREF(__pyx_v_self->virtual_size);
  PyTuple_SET_ITEM(__pyx_t_10, 29, __pyx_v_self->virtual_size);
  __Pyx_INCREF(__pyx_v_self->window);
  __Pyx_GIVEREF(__pyx_v_self->window);
  PyTuple_SET_ITEM(__pyx_t_10, 30, __pyx_v_self->window);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "(tree fragment)":4
 *     cdef bint use_setstate
 *     state = (self.allow_fixed, self.clip_cache, self.clip_rtt_box, self.default_clip, self.did_init, self.did_render_to_texture, self.did_texture_test, self.display_info, self.dpi_scale, self.draw_per_virt, self.draw_to_virt, self.drawable_size, self.environ, self.fast_dissolve, self.fast_redraw_frames, self.fullscreen_surface, self.info, self.last_redraw_time, self.mouse_info, self.mouse_old_visible, self.old_fullscreen, self.physical_box, self.physical_size, self.ready_texture_queue, self.redraw_period, self.rtt, self.texture_cache, self.virt_to_draw, self.virtual_box, self.virtual_size, self.window)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_10 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v__dict = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "(tree fragment)":5
 *     state = (self.allow_fixed, self.clip_cache, self.clip_rtt_box, self.default_clip, self.did_init, self.did_render_to_texture, self.did_texture_test, self.display_info, self.dpi_scale, self.draw_per_virt, self.draw_to_virt, self.drawable_size, self.environ, self.fast_dissolve, self.fast_redraw_frames, self.fullscreen_surface, self.info, self.last_redraw_time, self.mouse_info, self.mouse_old_visible, self.old_fullscreen, self.physical_box, self.physical_size, self.ready_texture_queue, self.redraw_period, self.rtt, self.texture_cache, self.virt_to_draw, self.virtual_box, self.virtual_size, self.window)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_11 = (__pyx_v__dict != Py_None);
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":6
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v__dict);
    __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "(tree fragment)":7
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.clip_cache is not None or self.clip_rtt_box is not None or self.default_clip is not None or self.display_info is not None or self.draw_per_virt is not None or self.draw_to_virt is not None or self.drawable_size is not None or self.environ is not None or self.fullscreen_surface is not None or self.info is not None or self.mouse_info is not None or self.mouse_old_visible is not None or self.old_fullscreen is not None or self.physical_box is not None or self.physical_size is not None or self.ready_texture_queue is not None or self.rtt is not None or self.texture_cache is not None or self.virt_to_draw is not None or self.virtual_box is not None or self.virtual_size is not None or self.window is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":5
 *     state = (self.allow_fixed, self.clip_cache, self.clip_rtt_box, self.default_clip, self.did_init, self.did_render_to_texture, self.did_texture_test, self.display_info, self.dpi_scale, self.draw_per_virt, self.draw_to_virt, self.drawable_size, self.environ, self.fast_dissolve, self.fast_redraw_frames, self.fullscreen_surface, self.info, self.last_redraw_time, self.mouse_info, self.mouse_old_visible, self.old_fullscreen, self.physical_box, self.physical_size, self.ready_texture_queue, self.redraw_period, self.rtt, self.texture_cache, self.virt_to_draw, self.virtual_box, self.virtual_size, self.window)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":9
 *         use_setstate = True
 *     else:
 *         use_setstate = self.clip_cache is not None or self.clip_rtt_box is not None or self.default_clip is not None or self.display_info is not None or self.draw_per_virt is not None or self.draw_to_virt is not None or self.drawable_size is not None or self.environ is not None or self.fullscreen_surface is not None or self.info is not None or self.mouse_info is not None or self.mouse_old_visible is not None or self.old_fullscreen is not None or self.physical_box is not None or self.physical_size is not None or self.ready_texture_queue is not None or self.rtt is not None or self.texture_cache is not None or self.virt_to_draw is not None or self.virtual_box is not None or self.virtual_size is not None or self.window is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, None), state
 */
  /*else*/ {
    __pyx_t_11 = (__pyx_v_self->clip_cache != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->clip_rtt_box != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->default_clip != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->display_info != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->draw_per_virt != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->draw_to_virt) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->drawable_size != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (((PyObject *)__pyx_v_self->environ) != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->fullscreen_surface != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->info != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->mouse_info != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->mouse_old_visible != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->old_fullscreen != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->physical_box != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->physical_size != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->ready_texture_queue != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->rtt != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->texture_cache != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (((PyObject *)__pyx_v_self->virt_to_draw) != Py_None);
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->virtual_box != ((PyObject*)Py_None));
    __pyx_t_11 = (__pyx_t_13 != 0);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_12 = __pyx_t_11;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_self->virtual_size != ((PyObject*)Py_None));
    __pyx_t_13 = (__pyx_t_11 != 0);
    if (!__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_13 = (__pyx_v_self->window != Py_None);
    __pyx_t_11 = (__pyx_t_13 != 0);
    __pyx_t_12 = __pyx_t_11;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_12;
  }
  __pyx_L3:;

  /* "(tree fragment)":10
 *     else:
 *         use_setstate = self.clip_cache is not None or self.clip_rtt_box is not None or self.default_clip is not None or self.display_info is not None or self.draw_per_virt is not None or self.draw_to_virt is not None or self.drawable_size is not None or self.environ is not None or self.fullscreen_surface is not None or self.info is not None or self.mouse_info is not None or self.mouse_old_visible is not None or self.old_fullscreen is not None or self.physical_box is not None or self.physical_size is not None or self.ready_texture_queue is not None or self.rtt is not None or self.texture_cache is not None or self.virt_to_draw is not None or self.virtual_box is not None or self.virtual_size is not None or self.window is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, None), state
 *     else:
 */
  __pyx_t_12 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_12) {

    /* "(tree fragment)":11
 *         use_setstate = self.clip_cache is not None or self.clip_rtt_box is not None or self.default_clip is not None or self.display_info is not None or self.draw_per_virt is not None or self.draw_to_virt is not None or self.drawable_size is not None or self.environ is not None or self.fullscreen_surface is not None or self.info is not None or self.mouse_info is not None or self.mouse_old_visible is not None or self.old_fullscreen is not None or self.physical_box is not None or self.physical_size is not None or self.ready_texture_queue is not None or self.rtt is not None or self.texture_cache is not None or self.virt_to_draw is not None or self.virtual_box is not None or self.virtual_size is not None or self.window is not None
 *     if use_setstate:
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_GLDraw); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_162010000);
    __Pyx_GIVEREF(__pyx_int_162010000);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_162010000);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_10, 2, Py_None);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_state);
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":10
 *     else:
 *         use_setstate = self.clip_cache is not None or self.clip_rtt_box is not None or self.default_clip is not None or self.display_info is not None or self.draw_per_virt is not None or self.draw_to_virt is not None or self.drawable_size is not None or self.environ is not None or self.fullscreen_surface is not None or self.info is not None or self.mouse_info is not None or self.mouse_old_visible is not None or self.old_fullscreen is not None or self.physical_box is not None or self.physical_size is not None or self.ready_texture_queue is not None or self.rtt is not None or self.texture_cache is not None or self.virt_to_draw is not None or self.virtual_box is not None or self.virtual_size is not None or self.window is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, None), state
 *     else:
 */
  }

  /* "(tree fragment)":13
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, None), state
 *     else:
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_GLDraw__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_GLDraw); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_162010000);
    __Pyx_GIVEREF(__pyx_int_162010000);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_162010000);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_state);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = (self.allow_fixed, self.clip_cache, self.clip_rtt_box, self.default_clip, self.did_init, self.did_render_to_texture, self.did_texture_test, self.display_info, self.dpi_scale, self.draw_per_virt, self.draw_to_virt, self.drawable_size, self.environ, self.fast_dissolve, self.fast_redraw_frames, self.fullscreen_surface, self.info, self.last_redraw_time, self.mouse_info, self.mouse_old_visible, self.old_fullscreen, self.physical_box, self.physical_size, self.ready_texture_queue, self.redraw_period, self.rtt, self.texture_cache, self.virt_to_draw, self.virtual_box, self.virtual_size, self.window)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_GLDraw__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_65__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_65__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_64__setstate_cython__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_64__setstate_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":15
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_GLDraw__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 15, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_GLDraw, (type(self), 0x9a81390, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_GLDraw__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1442
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_1init(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_1init = {"init", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_1init, METH_O, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_1init(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_init(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_init(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init", 0);

  /* "renpy/gl/gldraw.pyx":1443
 * 
 *     def init(self):
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def deinit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1442
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1445
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_3deinit(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_3deinit = {"deinit", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_3deinit, METH_O, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_3deinit(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deinit (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_2deinit(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_2deinit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deinit", 0);

  /* "renpy/gl/gldraw.pyx":1446
 * 
 *     def deinit(self):
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def render(self, texture, x, y, w, h, draw_func):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "renpy/gl/gldraw.pyx":1445
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1448
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_5render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_3Rtt_4render[] = "\n        This function is called to trigger a rendering to a texture.\n        `x`, `y`, `w`, and `h` specify the location and dimensions of\n        the sub-image to render to the texture. `draw_func` is called\n        to render the texture.\n        ";
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_5render = {"render", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_5render, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_3Rtt_4render};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_5render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_texture = 0;
  CYTHON_UNUSED PyObject *__pyx_v_x = 0;
  CYTHON_UNUSED PyObject *__pyx_v_y = 0;
  CYTHON_UNUSED PyObject *__pyx_v_w = 0;
  CYTHON_UNUSED PyObject *__pyx_v_h = 0;
  CYTHON_UNUSED PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_texture,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_w,&__pyx_n_s_h,&__pyx_n_s_draw_func,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_texture)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 1); __PYX_ERR(0, 1448, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 2); __PYX_ERR(0, 1448, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 3); __PYX_ERR(0, 1448, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 4); __PYX_ERR(0, 1448, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 5); __PYX_ERR(0, 1448, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_draw_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 6); __PYX_ERR(0, 1448, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render") < 0)) __PYX_ERR(0, 1448, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_self = values[0];
    __pyx_v_texture = values[1];
    __pyx_v_x = values[2];
    __pyx_v_y = values[3];
    __pyx_v_w = values[4];
    __pyx_v_h = values[5];
    __pyx_v_draw_func = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1448, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_4render(__pyx_self, __pyx_v_self, __pyx_v_texture, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h, __pyx_v_draw_func);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_4render(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_texture, CYTHON_UNUSED PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_y, CYTHON_UNUSED PyObject *__pyx_v_w, CYTHON_UNUSED PyObject *__pyx_v_h, CYTHON_UNUSED PyObject *__pyx_v_draw_func) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("render", 0);

  /* "renpy/gl/gldraw.pyx":1456
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 *     def get_size_limit(self, dimension):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1456, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1448
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1458
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_7get_size_limit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_3Rtt_6get_size_limit[] = "\n        Get the maximum size of a texture.\n        ";
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_7get_size_limit = {"get_size_limit", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_7get_size_limit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_3Rtt_6get_size_limit};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_7get_size_limit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_dimension = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_size_limit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_dimension,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dimension)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_size_limit", 1, 2, 2, 1); __PYX_ERR(0, 1458, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_size_limit") < 0)) __PYX_ERR(0, 1458, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_dimension = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_size_limit", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1458, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.get_size_limit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_6get_size_limit(__pyx_self, __pyx_v_self, __pyx_v_dimension);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_6get_size_limit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_dimension) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_size_limit", 0);

  /* "renpy/gl/gldraw.pyx":1463
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 1463, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1458
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.get_size_limit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1468
 * cdef class Environ(object):
 * 
 *     cdef void blit(self):             # <<<<<<<<<<<<<<
 *         """
 *         Set up a normal blit environment. The texture to be blitted should
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_blit(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blit", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1474
 *         """
 * 
 *     cdef void blend(self, double fraction):             # <<<<<<<<<<<<<<
 *         """
 *         Set up an environment that blends from TEXTURE0 to TEXTURE1.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_blend(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_fraction) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blend", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1481
 *         """
 * 
 *     cdef void imageblend(self, double fraction, int ramp):             # <<<<<<<<<<<<<<
 *         """
 *         Setup an environment that does an imageblend from TEXTURE1 to TEXTURE2.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_imageblend(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_fraction, CYTHON_UNUSED int __pyx_v_ramp) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("imageblend", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1490
 *         """
 * 
 *     cdef void set_vertex(self, float *vertices):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the array of vertices to be shown. Vertices should be an packed
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_vertex(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED float *__pyx_v_vertices) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_vertex", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1496
 *         """
 * 
 *     cdef void set_texture(self, int unit, float *coords):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the array of texture coordinates for unit `unit`.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_texture(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED int __pyx_v_unit, CYTHON_UNUSED float *__pyx_v_coords) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_texture", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1501
 *         """
 * 
 *     cdef void set_color(self, double r, double g, double b, double a):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the color to be shown.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_color(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_r, CYTHON_UNUSED double __pyx_v_g, CYTHON_UNUSED double __pyx_v_b, CYTHON_UNUSED double __pyx_v_a) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_color", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1506
 *         """
 * 
 *     cdef void set_clip(self, tuple clip_box, GLDraw draw):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the clipping rectangle.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_clip(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_clip_box, CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_clip", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1511
 *         """
 * 
 *     cdef void unset_clip(self, GLDraw draw):             # <<<<<<<<<<<<<<
 *         """
 *         Removes the clipping rectangle.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_unset_clip(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unset_clip", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1516
 *         """
 * 
 *     cdef void ortho(self, double left, double right, double bottom, double top, double near, double far):             # <<<<<<<<<<<<<<
 *         """
 *         Enables orthographic projection. `left`, `right`, `top`, `bottom` are the coordinates of the various
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_ortho(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_left, CYTHON_UNUSED double __pyx_v_right, CYTHON_UNUSED double __pyx_v_bottom, CYTHON_UNUSED double __pyx_v_top, CYTHON_UNUSED double __pyx_v_near, CYTHON_UNUSED double __pyx_v_far) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ortho", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1522
 *         """
 * 
 *     cdef void viewport(self, int x, int y, int w, int h):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the GL viewport.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_viewport(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED int __pyx_v_x, CYTHON_UNUSED int __pyx_v_y, CYTHON_UNUSED int __pyx_v_w, CYTHON_UNUSED int __pyx_v_h) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("viewport", 0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = ()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_7Environ_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_7Environ_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_7Environ___reduce_cython__(((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_7Environ___reduce_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self) {
  int __pyx_v_use_setstate;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v__dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":4
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":5
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":6
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":7
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":5
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":9
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":10
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":11
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Environ); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":10
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":13
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Environ__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Environ); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = ()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.Environ.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Environ__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_7Environ_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_7Environ_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_7Environ_2__setstate_cython__(((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_7Environ_2__setstate_cython__(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Environ__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 15, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_Environ__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_Environ, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Environ__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.Environ.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x9a81390:
 *         from pickle import PickleError as __pyx_PickleError
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_1__pyx_unpickle_GLDraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_1__pyx_unpickle_GLDraw = {"__pyx_unpickle_GLDraw", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_1__pyx_unpickle_GLDraw, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_1__pyx_unpickle_GLDraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_GLDraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_GLDraw", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_GLDraw", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_GLDraw") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_GLDraw", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.__pyx_unpickle_GLDraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = NULL;
  PyObject *__pyx_v___pyx_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__pyx_unpickle_GLDraw", 0);

  /* "(tree fragment)":2
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x9a81390:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x9a81390) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":3
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x9a81390:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)
 *     __pyx_result = GLDraw.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":4
 *     if __pyx_checksum != 0x9a81390:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = GLDraw.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x9a, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 4, __pyx_L1_error)

    /* "(tree fragment)":2
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x9a81390:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":5
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)
 *     __pyx_result = GLDraw.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5renpy_2gl_6gldraw_GLDraw), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v___pyx_type);
      __Pyx_GIVEREF(__pyx_v___pyx_type);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)
 *     __pyx_result = GLDraw.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_7 = (__pyx_t_1 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":7
 *     __pyx_result = GLDraw.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 7, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw__set_state(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x9a81390 = (allow_fixed, clip_cache, clip_rtt_box, default_clip, did_init, did_render_to_texture, did_texture_test, display_info, dpi_scale, draw_per_virt, draw_to_virt, drawable_size, environ, fast_dissolve, fast_redraw_frames, fullscreen_surface, info, last_redraw_time, mouse_info, mouse_old_visible, old_fullscreen, physical_box, physical_size, ready_texture_queue, redraw_period, rtt, texture_cache, virt_to_draw, virtual_box, virtual_size, window))" % __pyx_checksum)
 *     __pyx_result = GLDraw.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":8
 *     if __pyx_state is not None:
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x9a81390:
 *         from pickle import PickleError as __pyx_PickleError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.__pyx_unpickle_GLDraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":9
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_GLDraw__set_state(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  float __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_GLDraw__set_state", 0);

  /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[31])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->allow_fixed = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->clip_cache);
  __Pyx_DECREF(__pyx_v___pyx_result->clip_cache);
  __pyx_v___pyx_result->clip_cache = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->clip_rtt_box);
  __Pyx_DECREF(__pyx_v___pyx_result->clip_rtt_box);
  __pyx_v___pyx_result->clip_rtt_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->default_clip);
  __Pyx_DECREF(__pyx_v___pyx_result->default_clip);
  __pyx_v___pyx_result->default_clip = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->did_init = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->did_render_to_texture = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->did_texture_test = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->display_info);
  __Pyx_DECREF(__pyx_v___pyx_result->display_info);
  __pyx_v___pyx_result->display_info = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->dpi_scale = __pyx_t_3;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->draw_per_virt);
  __Pyx_DECREF(__pyx_v___pyx_result->draw_per_virt);
  __pyx_v___pyx_result->draw_per_virt = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->draw_to_virt);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->draw_to_virt));
  __pyx_v___pyx_result->draw_to_virt = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->drawable_size);
  __Pyx_DECREF(__pyx_v___pyx_result->drawable_size);
  __pyx_v___pyx_result->drawable_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->environ);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->environ));
  __pyx_v___pyx_result->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->fast_dissolve = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->fast_redraw_frames = __pyx_t_4;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->fullscreen_surface);
  __Pyx_DECREF(__pyx_v___pyx_result->fullscreen_surface);
  __pyx_v___pyx_result->fullscreen_surface = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 16, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->info);
  __Pyx_DECREF(__pyx_v___pyx_result->info);
  __pyx_v___pyx_result->info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 17, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->last_redraw_time = __pyx_t_5;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 18, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mouse_info);
  __Pyx_DECREF(__pyx_v___pyx_result->mouse_info);
  __pyx_v___pyx_result->mouse_info = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 19, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mouse_old_visible);
  __Pyx_DECREF(__pyx_v___pyx_result->mouse_old_visible);
  __pyx_v___pyx_result->mouse_old_visible = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 20, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->old_fullscreen);
  __Pyx_DECREF(__pyx_v___pyx_result->old_fullscreen);
  __pyx_v___pyx_result->old_fullscreen = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 21, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->physical_box);
  __Pyx_DECREF(__pyx_v___pyx_result->physical_box);
  __pyx_v___pyx_result->physical_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 22, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->physical_size);
  __Pyx_DECREF(__pyx_v___pyx_result->physical_size);
  __pyx_v___pyx_result->physical_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 23, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->ready_texture_queue);
  __Pyx_DECREF(__pyx_v___pyx_result->ready_texture_queue);
  __pyx_v___pyx_result->ready_texture_queue = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 24, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->redraw_period = __pyx_t_5;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 25, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->rtt);
  __Pyx_DECREF(__pyx_v___pyx_result->rtt);
  __pyx_v___pyx_result->rtt = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 26, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->texture_cache);
  __Pyx_DECREF(__pyx_v___pyx_result->texture_cache);
  __pyx_v___pyx_result->texture_cache = __pyx_t_1;
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 27, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->virt_to_draw);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->virt_to_draw));
  __pyx_v___pyx_result->virt_to_draw = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 28, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->virtual_box);
  __Pyx_DECREF(__pyx_v___pyx_result->virtual_box);
  __pyx_v___pyx_result->virtual_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 29, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->virtual_size);
  __Pyx_DECREF(__pyx_v___pyx_result->virtual_size);
  __pyx_v___pyx_result->virtual_size = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 30, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->window);
  __Pyx_DECREF(__pyx_v___pyx_result->window);
  __pyx_v___pyx_result->window = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":11
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[31])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 11, __pyx_L1_error)
  }
  __pyx_t_6 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 11, __pyx_L1_error)
  __pyx_t_7 = ((__pyx_t_6 > 31) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_2 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(2, 11, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_7 != 0);
  __pyx_t_2 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":12
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[31])             # <<<<<<<<<<<<<<
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_update); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 12, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    if (!__pyx_t_11) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":11
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[31])
 */
  }

  /* "(tree fragment)":9
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("renpy.gl.gldraw.__pyx_unpickle_GLDraw__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Environ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3__pyx_unpickle_Environ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3__pyx_unpickle_Environ = {"__pyx_unpickle_Environ", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3__pyx_unpickle_Environ, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3__pyx_unpickle_Environ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Environ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Environ", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Environ", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Environ") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Environ", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.__pyx_unpickle_Environ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_2__pyx_unpickle_Environ(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_2__pyx_unpickle_Environ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = NULL;
  PyObject *__pyx_v___pyx_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Environ", 0);

  /* "(tree fragment)":2
 * def __pyx_unpickle_Environ(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":3
 * def __pyx_unpickle_Environ(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Environ.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":4
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Environ.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 4, __pyx_L1_error)

    /* "(tree fragment)":2
 * def __pyx_unpickle_Environ(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":5
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Environ.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5renpy_2gl_6gldraw_Environ), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v___pyx_type);
      __Pyx_GIVEREF(__pyx_v___pyx_type);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Environ.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_7 = (__pyx_t_1 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":7
 *     __pyx_result = Environ.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 7, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_Environ__set_state(((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Environ.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":8
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Environ(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.__pyx_unpickle_Environ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":9
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_5renpy_2gl_6gldraw___pyx_unpickle_Environ__set_state(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Environ__set_state", 0);

  /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(2, 10, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 10, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":11
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 11, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 11, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":9
 *         __pyx_unpickle_Environ__set_state(<Environ> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Environ__set_state(Environ __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("renpy.gl.gldraw.__pyx_unpickle_Environ__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/matrix.pxd":26
 * 
 * 
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform4(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float *__pyx_v_ow, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform4", 0);

  /* "renpy/display/matrix.pxd":27
 * 
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw             # <<<<<<<<<<<<<<
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 */
  (__pyx_v_ox[0]) = ((((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy)) + (__pyx_v_z * __pyx_v_self->xdz)) + (__pyx_v_w * __pyx_v_self->xdw));

  /* "renpy/display/matrix.pxd":28
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw             # <<<<<<<<<<<<<<
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 */
  (__pyx_v_oy[0]) = ((((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy)) + (__pyx_v_z * __pyx_v_self->ydz)) + (__pyx_v_w * __pyx_v_self->ydw));

  /* "renpy/display/matrix.pxd":29
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw             # <<<<<<<<<<<<<<
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 * 
 */
  (__pyx_v_oz[0]) = ((((__pyx_v_x * __pyx_v_self->zdx) + (__pyx_v_y * __pyx_v_self->zdy)) + (__pyx_v_z * __pyx_v_self->zdz)) + (__pyx_v_w * __pyx_v_self->zdw));

  /* "renpy/display/matrix.pxd":30
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):
 */
  (__pyx_v_ow[0]) = ((((__pyx_v_x * __pyx_v_self->wdx) + (__pyx_v_y * __pyx_v_self->wdy)) + (__pyx_v_z * __pyx_v_self->wdz)) + (__pyx_v_w * __pyx_v_self->wdw));

  /* "renpy/display/matrix.pxd":26
 * 
 * 
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/display/matrix.pxd":32
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform3(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform3", 0);

  /* "renpy/display/matrix.pxd":33
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw             # <<<<<<<<<<<<<<
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 */
  (__pyx_v_ox[0]) = ((((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy)) + (__pyx_v_z * __pyx_v_self->xdz)) + (__pyx_v_w * __pyx_v_self->xdw));

  /* "renpy/display/matrix.pxd":34
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw             # <<<<<<<<<<<<<<
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 */
  (__pyx_v_oy[0]) = ((((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy)) + (__pyx_v_z * __pyx_v_self->ydz)) + (__pyx_v_w * __pyx_v_self->ydw));

  /* "renpy/display/matrix.pxd":35
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):
 */
  (__pyx_v_oz[0]) = ((((__pyx_v_x * __pyx_v_self->zdx) + (__pyx_v_y * __pyx_v_self->zdy)) + (__pyx_v_z * __pyx_v_self->zdz)) + (__pyx_v_w * __pyx_v_self->zdw));

  /* "renpy/display/matrix.pxd":32
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "renpy/display/matrix.pxd":37
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform2(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform2", 0);

  /* "renpy/display/matrix.pxd":38
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw             # <<<<<<<<<<<<<<
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 * 
 */
  (__pyx_v_ox[0]) = ((((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy)) + (__pyx_v_z * __pyx_v_self->xdz)) + (__pyx_v_w * __pyx_v_self->xdw));

  /* "renpy/display/matrix.pxd":39
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint is_unit_aligned(Matrix self)
 */
  (__pyx_v_oy[0]) = ((((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy)) + (__pyx_v_z * __pyx_v_self->ydz)) + (__pyx_v_w * __pyx_v_self->ydw));

  /* "renpy/display/matrix.pxd":37
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ __pyx_vtable_5renpy_2gl_6gldraw_Environ;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_Environ(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw_Environ *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_2gl_6gldraw_Environ;
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw_Environ(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  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))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw_Environ[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_7Environ_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_7Environ_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw_Environ = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.gl.gldraw.Environ", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw_Environ), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw_Environ, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw_Environ, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw_Environ, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw __pyx_vtable_5renpy_2gl_6gldraw_GLDraw;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_GLDraw(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw;
  p->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None); Py_INCREF(Py_None);
  p->rtt = Py_None; Py_INCREF(Py_None);
  p->window = Py_None; Py_INCREF(Py_None);
  p->virtual_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->physical_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->drawable_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->virtual_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->physical_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->mouse_old_visible = Py_None; Py_INCREF(Py_None);
  p->mouse_info = Py_None; Py_INCREF(Py_None);
  p->texture_cache = Py_None; Py_INCREF(Py_None);
  p->info = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->old_fullscreen = Py_None; Py_INCREF(Py_None);
  p->fullscreen_surface = Py_None; Py_INCREF(Py_None);
  p->display_info = Py_None; Py_INCREF(Py_None);
  p->clip_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->default_clip = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->ready_texture_queue = Py_None; Py_INCREF(Py_None);
  p->clip_rtt_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->draw_per_virt = Py_None; Py_INCREF(Py_None);
  p->virt_to_draw = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)Py_None); Py_INCREF(Py_None);
  p->draw_to_virt = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->environ);
  Py_CLEAR(p->rtt);
  Py_CLEAR(p->window);
  Py_CLEAR(p->virtual_size);
  Py_CLEAR(p->physical_size);
  Py_CLEAR(p->drawable_size);
  Py_CLEAR(p->virtual_box);
  Py_CLEAR(p->physical_box);
  Py_CLEAR(p->mouse_old_visible);
  Py_CLEAR(p->mouse_info);
  Py_CLEAR(p->texture_cache);
  Py_CLEAR(p->info);
  Py_CLEAR(p->old_fullscreen);
  Py_CLEAR(p->fullscreen_surface);
  Py_CLEAR(p->display_info);
  Py_CLEAR(p->clip_cache);
  Py_CLEAR(p->default_clip);
  Py_CLEAR(p->ready_texture_queue);
  Py_CLEAR(p->clip_rtt_box);
  Py_CLEAR(p->draw_per_virt);
  Py_CLEAR(p->virt_to_draw);
  Py_CLEAR(p->draw_to_virt);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw_GLDraw(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o;
  if (p->environ) {
    e = (*v)(((PyObject *)p->environ), a); if (e) return e;
  }
  if (p->rtt) {
    e = (*v)(p->rtt, a); if (e) return e;
  }
  if (p->window) {
    e = (*v)(p->window, a); if (e) return e;
  }
  if (p->virtual_size) {
    e = (*v)(p->virtual_size, a); if (e) return e;
  }
  if (p->physical_size) {
    e = (*v)(p->physical_size, a); if (e) return e;
  }
  if (p->drawable_size) {
    e = (*v)(p->drawable_size, a); if (e) return e;
  }
  if (p->virtual_box) {
    e = (*v)(p->virtual_box, a); if (e) return e;
  }
  if (p->physical_box) {
    e = (*v)(p->physical_box, a); if (e) return e;
  }
  if (p->mouse_old_visible) {
    e = (*v)(p->mouse_old_visible, a); if (e) return e;
  }
  if (p->mouse_info) {
    e = (*v)(p->mouse_info, a); if (e) return e;
  }
  if (p->texture_cache) {
    e = (*v)(p->texture_cache, a); if (e) return e;
  }
  if (p->info) {
    e = (*v)(p->info, a); if (e) return e;
  }
  if (p->old_fullscreen) {
    e = (*v)(p->old_fullscreen, a); if (e) return e;
  }
  if (p->fullscreen_surface) {
    e = (*v)(p->fullscreen_surface, a); if (e) return e;
  }
  if (p->display_info) {
    e = (*v)(p->display_info, a); if (e) return e;
  }
  if (p->clip_cache) {
    e = (*v)(p->clip_cache, a); if (e) return e;
  }
  if (p->default_clip) {
    e = (*v)(p->default_clip, a); if (e) return e;
  }
  if (p->ready_texture_queue) {
    e = (*v)(p->ready_texture_queue, a); if (e) return e;
  }
  if (p->clip_rtt_box) {
    e = (*v)(p->clip_rtt_box, a); if (e) return e;
  }
  if (p->draw_per_virt) {
    e = (*v)(p->draw_per_virt, a); if (e) return e;
  }
  if (p->virt_to_draw) {
    e = (*v)(((PyObject *)p->virt_to_draw), a); if (e) return e;
  }
  if (p->draw_to_virt) {
    e = (*v)(((PyObject *)p->draw_to_virt), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw_GLDraw(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o;
  tmp = ((PyObject*)p->environ);
  p->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rtt);
  p->rtt = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->window);
  p->window = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->virtual_size);
  p->virtual_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->physical_size);
  p->physical_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->drawable_size);
  p->drawable_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->virtual_box);
  p->virtual_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->physical_box);
  p->physical_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mouse_old_visible);
  p->mouse_old_visible = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mouse_info);
  p->mouse_info = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->texture_cache);
  p->texture_cache = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->info);
  p->info = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->old_fullscreen);
  p->old_fullscreen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fullscreen_surface);
  p->fullscreen_surface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->display_info);
  p->display_info = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->clip_cache);
  p->clip_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->default_clip);
  p->default_clip = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ready_texture_queue);
  p->ready_texture_queue = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->clip_rtt_box);
  p->clip_rtt_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->draw_per_virt);
  p->draw_per_virt = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->virt_to_draw);
  p->virt_to_draw = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->draw_to_virt);
  p->draw_to_virt = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_rtt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_rtt(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_drawable_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_drawable_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13drawable_size_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_box(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_box(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_info(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_draw_per_virt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_draw_per_virt(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13draw_per_virt_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_virt_to_draw(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_virt_to_draw(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12virt_to_draw_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_draw_to_virt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_draw_to_virt(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12draw_to_virt_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_fast_redraw_frames(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_fast_redraw_frames(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fast_redraw_frames_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw_GLDraw[] = {
  {"get_texture_size", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3get_texture_size, METH_NOARGS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_2get_texture_size},
  {"set_mode", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_5set_mode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_4set_mode},
  {"quit", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_7quit, METH_NOARGS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_6quit},
  {"init", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_9init, METH_NOARGS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_8init},
  {"can_block", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11can_block, METH_NOARGS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_10can_block},
  {"should_redraw", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13should_redraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_12should_redraw},
  {"mutated_surface", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15mutated_surface, METH_O, 0},
  {"load_texture", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17load_texture, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_16load_texture},
  {"ready_one_texture", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_19ready_one_texture, METH_NOARGS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_18ready_one_texture},
  {"solid_texture", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_21solid_texture, METH_VARARGS|METH_KEYWORDS, 0},
  {"clip_mode_screen", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23clip_mode_screen, METH_NOARGS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_22clip_mode_screen},
  {"clip_mode_rtt", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_25clip_mode_rtt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_24clip_mode_rtt},
  {"set_clip", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27set_clip, METH_O, 0},
  {"draw_screen", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_screen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_28draw_screen},
  {"draw_render_textures", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31draw_render_textures, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_30draw_render_textures},
  {"draw_transformed", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33draw_transformed, METH_VARARGS|METH_KEYWORDS, 0},
  {"render_to_texture", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_35render_to_texture, METH_VARARGS|METH_KEYWORDS, 0},
  {"is_pixel_opaque", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_37is_pixel_opaque, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_36is_pixel_opaque},
  {"get_half", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_39get_half, METH_O, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_38get_half},
  {"translate_point", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_41translate_point, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_40translate_point},
  {"untranslate_point", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_43untranslate_point, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_42untranslate_point},
  {"update_mouse", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_45update_mouse, METH_NOARGS, 0},
  {"mouse_event", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_47mouse_event, METH_O, 0},
  {"get_mouse_pos", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_49get_mouse_pos, METH_NOARGS, 0},
  {"set_mouse_pos", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_51set_mouse_pos, METH_VARARGS|METH_KEYWORDS, 0},
  {"draw_mouse", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_53draw_mouse, METH_NOARGS, 0},
  {"screenshot", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_55screenshot, METH_VARARGS|METH_KEYWORDS, 0},
  {"kill_textures", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_57kill_textures, METH_NOARGS, 0},
  {"event_peek_sleep", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_59event_peek_sleep, METH_NOARGS, 0},
  {"get_physical_size", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_61get_physical_size, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_63__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_65__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_2gl_6gldraw_GLDraw[] = {
  {(char *)"rtt", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_rtt, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_rtt, (char *)0, 0},
  {(char *)"physical_size", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_size, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_size, (char *)0, 0},
  {(char *)"drawable_size", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_drawable_size, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_drawable_size, (char *)0, 0},
  {(char *)"virtual_box", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box, (char *)0, 0},
  {(char *)"physical_box", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_box, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_box, (char *)0, 0},
  {(char *)"info", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_info, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_info, (char *)0, 0},
  {(char *)"fullscreen_surface", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface, (char *)0, 0},
  {(char *)"clip_rtt_box", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box, (char *)0, 0},
  {(char *)"draw_per_virt", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_draw_per_virt, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_draw_per_virt, (char *)0, 0},
  {(char *)"virt_to_draw", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_virt_to_draw, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_virt_to_draw, (char *)0, 0},
  {(char *)"draw_to_virt", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_draw_to_virt, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_draw_to_virt, (char *)0, 0},
  {(char *)"fast_redraw_frames", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_fast_redraw_frames, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_fast_redraw_frames, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw_GLDraw = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.gl.gldraw.GLDraw", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw_GLDraw, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw_GLDraw, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw_GLDraw, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw_GLDraw, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_2gl_6gldraw_GLDraw, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw_GLDraw, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct__init[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct__init[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_extensions);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init)))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct__init[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o;
  if (p->__pyx_v_extensions) {
    e = (*v)(p->__pyx_v_extensions, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o;
  tmp = ((PyObject*)p->__pyx_v_extensions);
  p->__pyx_v_extensions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.gl.gldraw.__pyx_scope_struct__init", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alpha);
  Py_CLEAR(p->__pyx_v_height);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_what);
  Py_CLEAR(p->__pyx_v_width);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture)))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  if (p->__pyx_v_alpha) {
    e = (*v)(p->__pyx_v_alpha, a); if (e) return e;
  }
  if (p->__pyx_v_height) {
    e = (*v)(p->__pyx_v_height, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_what) {
    e = (*v)(p->__pyx_v_what, a); if (e) return e;
  }
  if (p->__pyx_v_width) {
    e = (*v)(p->__pyx_v_width, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  tmp = ((PyObject*)p->__pyx_v_alpha);
  p->__pyx_v_alpha = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_height);
  p->__pyx_v_height = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_what);
  p->__pyx_v_what = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_width);
  p->__pyx_v_width = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.gl.gldraw.__pyx_scope_struct_1_render_to_texture", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alpha_holder);
  Py_CLEAR(p->__pyx_v_reverse);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_what);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque)))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *)o;
  if (p->__pyx_v_alpha_holder) {
    e = (*v)(p->__pyx_v_alpha_holder, a); if (e) return e;
  }
  if (p->__pyx_v_reverse) {
    e = (*v)(p->__pyx_v_reverse, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_what) {
    e = (*v)(p->__pyx_v_what, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque *)o;
  tmp = ((PyObject*)p->__pyx_v_alpha_holder);
  p->__pyx_v_alpha_holder = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_reverse);
  p->__pyx_v_reverse = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_what);
  p->__pyx_v_what = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.gl.gldraw.__pyx_scope_struct_2_is_pixel_opaque", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_draw);
  Py_CLEAR(p->__pyx_v_height);
  Py_CLEAR(p->__pyx_v_reverse);
  Py_CLEAR(p->__pyx_v_what);
  Py_CLEAR(p->__pyx_v_width);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half)))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *)o;
  if (p->__pyx_v_draw) {
    e = (*v)(((PyObject *)p->__pyx_v_draw), a); if (e) return e;
  }
  if (p->__pyx_v_height) {
    e = (*v)(p->__pyx_v_height, a); if (e) return e;
  }
  if (p->__pyx_v_reverse) {
    e = (*v)(((PyObject *)p->__pyx_v_reverse), a); if (e) return e;
  }
  if (p->__pyx_v_what) {
    e = (*v)(p->__pyx_v_what, a); if (e) return e;
  }
  if (p->__pyx_v_width) {
    e = (*v)(p->__pyx_v_width, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half *)o;
  tmp = ((PyObject*)p->__pyx_v_draw);
  p->__pyx_v_draw = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_height);
  p->__pyx_v_height = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_reverse);
  p->__pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix2D *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_what);
  p->__pyx_v_what = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_width);
  p->__pyx_v_width = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.gl.gldraw.__pyx_scope_struct_3_get_half", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_gldraw(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_gldraw},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "gldraw",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_Can_t_find_a_workable_environmen, __pyx_k_Can_t_find_a_workable_environmen, sizeof(__pyx_k_Can_t_find_a_workable_environmen), 0, 0, 1, 0},
  {&__pyx_kp_s_Can_t_find_a_workable_rtt, __pyx_k_Can_t_find_a_workable_rtt, sizeof(__pyx_k_Can_t_find_a_workable_rtt), 0, 0, 1, 0},
  {&__pyx_n_s_Color, __pyx_k_Color, sizeof(__pyx_k_Color), 0, 0, 1, 1},
  {&__pyx_n_s_CopyRtt, __pyx_k_CopyRtt, sizeof(__pyx_k_CopyRtt), 0, 0, 1, 1},
  {&__pyx_kp_s_Could_not_get_pygame_screen_r, __pyx_k_Could_not_get_pygame_screen_r, sizeof(__pyx_k_Could_not_get_pygame_screen_r), 0, 0, 1, 0},
  {&__pyx_n_s_DISSOLVE, __pyx_k_DISSOLVE, sizeof(__pyx_k_DISSOLVE), 0, 0, 1, 1},
  {&__pyx_n_s_DOUBLEBUF, __pyx_k_DOUBLEBUF, sizeof(__pyx_k_DOUBLEBUF), 0, 0, 1, 1},
  {&__pyx_kp_s_Display_Info_s, __pyx_k_Display_Info_s, sizeof(__pyx_k_Display_Info_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Extensions, __pyx_k_Extensions, sizeof(__pyx_k_Extensions), 0, 0, 1, 0},
  {&__pyx_n_s_FLATTEN, __pyx_k_FLATTEN, sizeof(__pyx_k_FLATTEN), 0, 0, 1, 1},
  {&__pyx_n_s_FboRtt, __pyx_k_FboRtt, sizeof(__pyx_k_FboRtt), 0, 0, 1, 1},
  {&__pyx_n_s_FixedFunctionEnviron, __pyx_k_FixedFunctionEnviron, sizeof(__pyx_k_FixedFunctionEnviron), 0, 0, 1, 1},
  {&__pyx_kp_s_Fixed_function_is_blacklisted, __pyx_k_Fixed_function_is_blacklisted, sizeof(__pyx_k_Fixed_function_is_blacklisted), 0, 0, 1, 0},
  {&__pyx_kp_s_Fullscreen_mode, __pyx_k_Fullscreen_mode, sizeof(__pyx_k_Fullscreen_mode), 0, 0, 1, 0},
  {&__pyx_n_s_GL_ALPHA_SIZE, __pyx_k_GL_ALPHA_SIZE, sizeof(__pyx_k_GL_ALPHA_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_GL_ARB_fragment_shader, __pyx_k_GL_ARB_fragment_shader, sizeof(__pyx_k_GL_ARB_fragment_shader), 0, 0, 1, 1},
  {&__pyx_n_s_GL_ARB_framebuffer_object, __pyx_k_GL_ARB_framebuffer_object, sizeof(__pyx_k_GL_ARB_framebuffer_object), 0, 0, 1, 1},
  {&__pyx_n_s_GL_ARB_texture_env_combine, __pyx_k_GL_ARB_texture_env_combine, sizeof(__pyx_k_GL_ARB_texture_env_combine), 0, 0, 1, 1},
  {&__pyx_n_s_GL_ARB_texture_env_crossbar, __pyx_k_GL_ARB_texture_env_crossbar, sizeof(__pyx_k_GL_ARB_texture_env_crossbar), 0, 0, 1, 1},
  {&__pyx_n_s_GL_ARB_vertex_shader, __pyx_k_GL_ARB_vertex_shader, sizeof(__pyx_k_GL_ARB_vertex_shader), 0, 0, 1, 1},
  {&__pyx_n_s_GL_CONTEXT_MAJOR_VERSION, __pyx_k_GL_CONTEXT_MAJOR_VERSION, sizeof(__pyx_k_GL_CONTEXT_MAJOR_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_GL_CONTEXT_MINOR_VERSION, __pyx_k_GL_CONTEXT_MINOR_VERSION, sizeof(__pyx_k_GL_CONTEXT_MINOR_VERSION), 0, 0, 1, 1},
  {&__pyx_kp_s_GL_Disabled, __pyx_k_GL_Disabled, sizeof(__pyx_k_GL_Disabled), 0, 0, 1, 0},
  {&__pyx_n_s_GL_NV_texture_env_combine4, __pyx_k_GL_NV_texture_env_combine4, sizeof(__pyx_k_GL_NV_texture_env_combine4), 0, 0, 1, 1},
  {&__pyx_n_s_GL_SWAP_CONTROL, __pyx_k_GL_SWAP_CONTROL, sizeof(__pyx_k_GL_SWAP_CONTROL), 0, 0, 1, 1},
  {&__pyx_kp_s_GL_is_totally_blacklisted, __pyx_k_GL_is_totally_blacklisted, sizeof(__pyx_k_GL_is_totally_blacklisted), 0, 0, 1, 0},
  {&__pyx_kp_s_Glew_init_failed_s, __pyx_k_Glew_init_failed_s, sizeof(__pyx_k_Glew_init_failed_s), 0, 0, 1, 0},
  {&__pyx_n_s_IDENTITY, __pyx_k_IDENTITY, sizeof(__pyx_k_IDENTITY), 0, 0, 1, 1},
  {&__pyx_n_s_IMAGEDISSOLVE, __pyx_k_IMAGEDISSOLVE, sizeof(__pyx_k_IMAGEDISSOLVE), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0x9a, __pyx_k_Incompatible_checksums_s_vs_0x9a, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x9a), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0},
  {&__pyx_kp_s_Initializing_EGL_s, __pyx_k_Initializing_EGL_s, sizeof(__pyx_k_Initializing_EGL_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Initializing_shader_environment, __pyx_k_Initializing_shader_environment, sizeof(__pyx_k_Initializing_shader_environment), 0, 0, 1, 0},
  {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
  {&__pyx_n_s_LimitedEnviron, __pyx_k_LimitedEnviron, sizeof(__pyx_k_LimitedEnviron), 0, 0, 1, 1},
  {&__pyx_kp_s_Not_implemented, __pyx_k_Not_implemented, sizeof(__pyx_k_Not_implemented), 0, 0, 1, 0},
  {&__pyx_kp_s_Number_of_texture_units_d, __pyx_k_Number_of_texture_units_d, sizeof(__pyx_k_Number_of_texture_units_d), 0, 0, 1, 0},
  {&__pyx_n_s_OPENGL, __pyx_k_OPENGL, sizeof(__pyx_k_OPENGL), 0, 0, 1, 1},
  {&__pyx_kp_s_Opening_in_fullscreen_failed_r, __pyx_k_Opening_in_fullscreen_failed_r, sizeof(__pyx_k_Opening_in_fullscreen_failed_r), 0, 0, 1, 0},
  {&__pyx_n_s_PIXELLATE, __pyx_k_PIXELLATE, sizeof(__pyx_k_PIXELLATE), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_RENPY_FAIL, __pyx_k_RENPY_FAIL, sizeof(__pyx_k_RENPY_FAIL), 0, 0, 1, 1},
  {&__pyx_n_s_RENPY_GL_ENVIRON, __pyx_k_RENPY_GL_ENVIRON, sizeof(__pyx_k_RENPY_GL_ENVIRON), 0, 0, 1, 1},
  {&__pyx_n_s_RENPY_GL_RTT, __pyx_k_RENPY_GL_RTT, sizeof(__pyx_k_RENPY_GL_RTT), 0, 0, 1, 1},
  {&__pyx_n_s_RENPY_GL_VSYNC, __pyx_k_RENPY_GL_VSYNC, sizeof(__pyx_k_RENPY_GL_VSYNC), 0, 0, 1, 1},
  {&__pyx_n_s_RENPY_bogus_extension, __pyx_k_RENPY_bogus_extension, sizeof(__pyx_k_RENPY_bogus_extension), 0, 0, 1, 1},
  {&__pyx_n_s_RESIZABLE, __pyx_k_RESIZABLE, sizeof(__pyx_k_RESIZABLE), 0, 0, 1, 1},
  {&__pyx_kp_s_Renderer_r, __pyx_k_Renderer_r, sizeof(__pyx_k_Renderer_r), 0, 0, 1, 0},
  {&__pyx_n_s_Rtt, __pyx_k_Rtt, sizeof(__pyx_k_Rtt), 0, 0, 1, 1},
  {&__pyx_n_s_Rtt_deinit, __pyx_k_Rtt_deinit, sizeof(__pyx_k_Rtt_deinit), 0, 0, 1, 1},
  {&__pyx_n_s_Rtt_get_size_limit, __pyx_k_Rtt_get_size_limit, sizeof(__pyx_k_Rtt_get_size_limit), 0, 0, 1, 1},
  {&__pyx_n_s_Rtt_init, __pyx_k_Rtt_init, sizeof(__pyx_k_Rtt_init), 0, 0, 1, 1},
  {&__pyx_n_s_Rtt_render, __pyx_k_Rtt_render, sizeof(__pyx_k_Rtt_render), 0, 0, 1, 1},
  {&__pyx_kp_s_Screen_sizes_virtual_r_physical, __pyx_k_Screen_sizes_virtual_r_physical, sizeof(__pyx_k_Screen_sizes_virtual_r_physical), 0, 0, 1, 0},
  {&__pyx_n_s_ShaderEnviron, __pyx_k_ShaderEnviron, sizeof(__pyx_k_ShaderEnviron), 0, 0, 1, 1},
  {&__pyx_kp_s_Shaders_are_blacklisted, __pyx_k_Shaders_are_blacklisted, sizeof(__pyx_k_Shaders_are_blacklisted), 0, 0, 1, 0},
  {&__pyx_kp_s_Subclasses_of_this_class_handle, __pyx_k_Subclasses_of_this_class_handle, sizeof(__pyx_k_Subclasses_of_this_class_handle), 0, 0, 1, 0},
  {&__pyx_n_s_Surface, __pyx_k_Surface, sizeof(__pyx_k_Surface), 0, 0, 1, 1},
  {&__pyx_kp_s_Unknown_drawing_type, __pyx_k_Unknown_drawing_type, sizeof(__pyx_k_Unknown_drawing_type), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_0_renderer, __pyx_k_Using_0_renderer, sizeof(__pyx_k_Using_0_renderer), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_FBO_RTT, __pyx_k_Using_FBO_RTT, sizeof(__pyx_k_Using_FBO_RTT), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_copy_RTT, __pyx_k_Using_copy_RTT, sizeof(__pyx_k_Using_copy_RTT), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_fixed_function_environment, __pyx_k_Using_fixed_function_environment, sizeof(__pyx_k_Using_fixed_function_environment), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_fixed_function_environment_2, __pyx_k_Using_fixed_function_environment_2, sizeof(__pyx_k_Using_fixed_function_environment_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_limited_environment, __pyx_k_Using_limited_environment, sizeof(__pyx_k_Using_limited_environment), 0, 0, 1, 0},
  {&__pyx_kp_s_Using_shader_environment, __pyx_k_Using_shader_environment, sizeof(__pyx_k_Using_shader_environment), 0, 0, 1, 0},
  {&__pyx_kp_s_Vendor_r, __pyx_k_Vendor_r, sizeof(__pyx_k_Vendor_r), 0, 0, 1, 0},
  {&__pyx_kp_s_Version_r, __pyx_k_Version_r, sizeof(__pyx_k_Version_r), 0, 0, 1, 0},
  {&__pyx_n_s_WINDOW_ALLOW_HIGHDPI, __pyx_k_WINDOW_ALLOW_HIGHDPI, sizeof(__pyx_k_WINDOW_ALLOW_HIGHDPI), 0, 0, 1, 1},
  {&__pyx_n_s_WINDOW_FULLSCREEN, __pyx_k_WINDOW_FULLSCREEN, sizeof(__pyx_k_WINDOW_FULLSCREEN), 0, 0, 1, 1},
  {&__pyx_n_s_WINDOW_FULLSCREEN_DESKTOP, __pyx_k_WINDOW_FULLSCREEN_DESKTOP, sizeof(__pyx_k_WINDOW_FULLSCREEN_DESKTOP), 0, 0, 1, 1},
  {&__pyx_n_s_WINDOW_MAXIMIZED, __pyx_k_WINDOW_MAXIMIZED, sizeof(__pyx_k_WINDOW_MAXIMIZED), 0, 0, 1, 1},
  {&__pyx_n_s_WeakKeyDictionary, __pyx_k_WeakKeyDictionary, sizeof(__pyx_k_WeakKeyDictionary), 0, 0, 1, 1},
  {&__pyx_n_s_WeakSet, __pyx_k_WeakSet, sizeof(__pyx_k_WeakSet), 0, 0, 1, 1},
  {&__pyx_kp_s_Windowed_mode, __pyx_k_Windowed_mode, sizeof(__pyx_k_Windowed_mode), 0, 0, 1, 0},
  {&__pyx_kp_s__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 0},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_additive, __pyx_k_additive, sizeof(__pyx_k_additive), 0, 0, 1, 1},
  {&__pyx_n_s_adjust_view_size, __pyx_k_adjust_view_size, sizeof(__pyx_k_adjust_view_size), 0, 0, 1, 1},
  {&__pyx_kp_s_after_broken_vsync_sleep, __pyx_k_after_broken_vsync_sleep, sizeof(__pyx_k_after_broken_vsync_sleep), 0, 0, 1, 0},
  {&__pyx_n_s_allow_fixed, __pyx_k_allow_fixed, sizeof(__pyx_k_allow_fixed), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_android, __pyx_k_android, sizeof(__pyx_k_android), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_can_block, __pyx_k_can_block, sizeof(__pyx_k_can_block), 0, 0, 1, 1},
  {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1},
  {&__pyx_n_s_cleanup, __pyx_k_cleanup, sizeof(__pyx_k_cleanup), 0, 0, 1, 1},
  {&__pyx_n_s_clear, __pyx_k_clear, sizeof(__pyx_k_clear), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_clip, __pyx_k_clip, sizeof(__pyx_k_clip), 0, 0, 1, 1},
  {&__pyx_n_s_clip_mode_rtt, __pyx_k_clip_mode_rtt, sizeof(__pyx_k_clip_mode_rtt), 0, 0, 1, 1},
  {&__pyx_n_s_clip_mode_screen, __pyx_k_clip_mode_screen, sizeof(__pyx_k_clip_mode_screen), 0, 0, 1, 1},
  {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
  {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_current_h, __pyx_k_current_h, sizeof(__pyx_k_current_h), 0, 0, 1, 1},
  {&__pyx_n_s_current_w, __pyx_k_current_w, sizeof(__pyx_k_current_w), 0, 0, 1, 1},
  {&__pyx_n_s_dealloc_textures, __pyx_k_dealloc_textures, sizeof(__pyx_k_dealloc_textures), 0, 0, 1, 1},
  {&__pyx_n_s_deinit, __pyx_k_deinit, sizeof(__pyx_k_deinit), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1},
  {&__pyx_n_s_display, __pyx_k_display, sizeof(__pyx_k_display), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dpi_scale, __pyx_k_dpi_scale, sizeof(__pyx_k_dpi_scale), 0, 0, 1, 1},
  {&__pyx_n_s_draw_func, __pyx_k_draw_func, sizeof(__pyx_k_draw_func), 0, 0, 1, 1},
  {&__pyx_n_s_draw_mouse, __pyx_k_draw_mouse, sizeof(__pyx_k_draw_mouse), 0, 0, 1, 1},
  {&__pyx_n_s_draw_render_textures, __pyx_k_draw_render_textures, sizeof(__pyx_k_draw_render_textures), 0, 0, 1, 1},
  {&__pyx_n_s_draw_screen, __pyx_k_draw_screen, sizeof(__pyx_k_draw_screen), 0, 0, 1, 1},
  {&__pyx_n_s_draw_transformed, __pyx_k_draw_transformed, sizeof(__pyx_k_draw_transformed), 0, 0, 1, 1},
  {&__pyx_n_s_emscripten, __pyx_k_emscripten, sizeof(__pyx_k_emscripten), 0, 0, 1, 1},
  {&__pyx_n_s_environ, __pyx_k_environ, sizeof(__pyx_k_environ), 0, 0, 1, 1},
  {&__pyx_n_s_envval, __pyx_k_envval, sizeof(__pyx_k_envval), 0, 0, 1, 1},
  {&__pyx_n_s_envvar, __pyx_k_envvar, sizeof(__pyx_k_envvar), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
  {&__pyx_n_s_fast_redraw_frames, __pyx_k_fast_redraw_frames, sizeof(__pyx_k_fast_redraw_frames), 0, 0, 1, 1},
  {&__pyx_n_s_fbo, __pyx_k_fbo, sizeof(__pyx_k_fbo), 0, 0, 1, 1},
  {&__pyx_n_s_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 0, 0, 1, 1},
  {&__pyx_n_s_first_pass, __pyx_k_first_pass, sizeof(__pyx_k_first_pass), 0, 0, 1, 1},
  {&__pyx_n_s_fixed, __pyx_k_fixed, sizeof(__pyx_k_fixed), 0, 0, 1, 1},
  {&__pyx_n_s_flip, __pyx_k_flip, sizeof(__pyx_k_flip), 0, 0, 1, 1},
  {&__pyx_n_s_flip_unscaled, __pyx_k_flip_unscaled, sizeof(__pyx_k_flip_unscaled), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_frame_duration, __pyx_k_frame_duration, sizeof(__pyx_k_frame_duration), 0, 0, 1, 1},
  {&__pyx_n_s_frame_times, __pyx_k_frame_times, sizeof(__pyx_k_frame_times), 0, 0, 1, 1},
  {&__pyx_n_s_fullscreen, __pyx_k_fullscreen, sizeof(__pyx_k_fullscreen), 0, 0, 1, 1},
  {&__pyx_n_s_fullscreen_video, __pyx_k_fullscreen_video, sizeof(__pyx_k_fullscreen_video), 0, 0, 1, 1},
  {&__pyx_n_s_game, __pyx_k_game, sizeof(__pyx_k_game), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_display_bounds, __pyx_k_get_display_bounds, sizeof(__pyx_k_get_display_bounds), 0, 0, 1, 1},
  {&__pyx_n_s_get_drawable_size, __pyx_k_get_drawable_size, sizeof(__pyx_k_get_drawable_size), 0, 0, 1, 1},
  {&__pyx_n_s_get_flags, __pyx_k_get_flags, sizeof(__pyx_k_get_flags), 0, 0, 1, 1},
  {&__pyx_n_s_get_half, __pyx_k_get_half, sizeof(__pyx_k_get_half), 0, 0, 1, 1},
  {&__pyx_n_s_get_half_locals_draw_func, __pyx_k_get_half_locals_draw_func, sizeof(__pyx_k_get_half_locals_draw_func), 0, 0, 1, 1},
  {&__pyx_n_s_get_info, __pyx_k_get_info, sizeof(__pyx_k_get_info), 0, 0, 1, 1},
  {&__pyx_n_s_get_mouse_info, __pyx_k_get_mouse_info, sizeof(__pyx_k_get_mouse_info), 0, 0, 1, 1},
  {&__pyx_n_s_get_pos, __pyx_k_get_pos, sizeof(__pyx_k_get_pos), 0, 0, 1, 1},
  {&__pyx_n_s_get_size, __pyx_k_get_size, sizeof(__pyx_k_get_size), 0, 0, 1, 1},
  {&__pyx_n_s_get_size_limit, __pyx_k_get_size_limit, sizeof(__pyx_k_get_size_limit), 0, 0, 1, 1},
  {&__pyx_n_s_get_surface, __pyx_k_get_surface, sizeof(__pyx_k_get_surface), 0, 0, 1, 1},
  {&__pyx_n_s_get_window, __pyx_k_get_window, sizeof(__pyx_k_get_window), 0, 0, 1, 1},
  {&__pyx_n_s_get_window_flags, __pyx_k_get_window_flags, sizeof(__pyx_k_get_window_flags), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_gl, __pyx_k_gl, sizeof(__pyx_k_gl), 0, 0, 1, 1},
  {&__pyx_n_s_gl_clear_color, __pyx_k_gl_clear_color, sizeof(__pyx_k_gl_clear_color), 0, 0, 1, 1},
  {&__pyx_n_s_gl_enable, __pyx_k_gl_enable, sizeof(__pyx_k_gl_enable), 0, 0, 1, 1},
  {&__pyx_n_s_gl_framerate, __pyx_k_gl_framerate, sizeof(__pyx_k_gl_framerate), 0, 0, 1, 1},
  {&__pyx_n_s_gl_powersave, __pyx_k_gl_powersave, sizeof(__pyx_k_gl_powersave), 0, 0, 1, 1},
  {&__pyx_n_s_gl_resize, __pyx_k_gl_resize, sizeof(__pyx_k_gl_resize), 0, 0, 1, 1},
  {&__pyx_n_s_gl_set_attribute, __pyx_k_gl_set_attribute, sizeof(__pyx_k_gl_set_attribute), 0, 0, 1, 1},
  {&__pyx_n_s_gl_size, __pyx_k_gl_size, sizeof(__pyx_k_gl_size), 0, 0, 1, 1},
  {&__pyx_n_s_gl_tearing, __pyx_k_gl_tearing, sizeof(__pyx_k_gl_tearing), 0, 0, 1, 1},
  {&__pyx_n_s_glenviron_fixed, __pyx_k_glenviron_fixed, sizeof(__pyx_k_glenviron_fixed), 0, 0, 1, 1},
  {&__pyx_n_s_glenviron_limited, __pyx_k_glenviron_limited, sizeof(__pyx_k_glenviron_limited), 0, 0, 1, 1},
  {&__pyx_n_s_glenviron_shader, __pyx_k_glenviron_shader, sizeof(__pyx_k_glenviron_shader), 0, 0, 1, 1},
  {&__pyx_n_s_glrtt_copy, __pyx_k_glrtt_copy, sizeof(__pyx_k_glrtt_copy), 0, 0, 1, 1},
  {&__pyx_n_s_glrtt_fbo, __pyx_k_glrtt_fbo, sizeof(__pyx_k_glrtt_fbo), 0, 0, 1, 1},
  {&__pyx_n_s_gltexture, __pyx_k_gltexture, sizeof(__pyx_k_gltexture), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_half_cache, __pyx_k_half_cache, sizeof(__pyx_k_half_cache), 0, 0, 1, 1},
  {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
  {&__pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_k_home_tom_ab_renpy_renpy_gl_gldr, sizeof(__pyx_k_home_tom_ab_renpy_renpy_gl_gldr), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init_locals_use_subsystem, __pyx_k_init_locals_use_subsystem, sizeof(__pyx_k_init_locals_use_subsystem), 0, 0, 1, 1},
  {&__pyx_n_s_interface, __pyx_k_interface, sizeof(__pyx_k_interface), 0, 0, 1, 1},
  {&__pyx_n_s_ios, __pyx_k_ios, sizeof(__pyx_k_ios), 0, 0, 1, 1},
  {&__pyx_n_s_is_opaque, __pyx_k_is_opaque, sizeof(__pyx_k_is_opaque), 0, 0, 1, 1},
  {&__pyx_n_s_is_pixel_opaque_locals_draw_func, __pyx_k_is_pixel_opaque_locals_draw_func, sizeof(__pyx_k_is_pixel_opaque_locals_draw_func), 0, 0, 1, 1},
  {&__pyx_n_s_kill, __pyx_k_kill, sizeof(__pyx_k_kill), 0, 0, 1, 1},
  {&__pyx_n_s_kill_textures, __pyx_k_kill_textures, sizeof(__pyx_k_kill_textures), 0, 0, 1, 1},
  {&__pyx_n_s_kill_textures_and_surfaces, __pyx_k_kill_textures_and_surfaces, sizeof(__pyx_k_kill_textures_and_surfaces), 0, 0, 1, 1},
  {&__pyx_n_s_limited, __pyx_k_limited, sizeof(__pyx_k_limited), 0, 0, 1, 1},
  {&__pyx_n_s_load_texture, __pyx_k_load_texture, sizeof(__pyx_k_load_texture), 0, 0, 1, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_ready, __pyx_k_make_ready, sizeof(__pyx_k_make_ready), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_s_max_window_size, __pyx_k_max_window_size, sizeof(__pyx_k_max_window_size), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_mobile, __pyx_k_mobile, sizeof(__pyx_k_mobile), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_module_2, __pyx_k_module_2, sizeof(__pyx_k_module_2), 0, 0, 1, 1},
  {&__pyx_n_s_mouse, __pyx_k_mouse, sizeof(__pyx_k_mouse), 0, 0, 1, 1},
  {&__pyx_n_s_movie, __pyx_k_movie, sizeof(__pyx_k_movie), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_nearest, __pyx_k_nearest, sizeof(__pyx_k_nearest), 0, 0, 1, 1},
  {&__pyx_n_s_nearest_neighbor, __pyx_k_nearest_neighbor, sizeof(__pyx_k_nearest_neighbor), 0, 0, 1, 1},
  {&__pyx_n_s_needs_redraw, __pyx_k_needs_redraw, sizeof(__pyx_k_needs_redraw), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_non_aligned, __pyx_k_non_aligned, sizeof(__pyx_k_non_aligned), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_operation_alpha, __pyx_k_operation_alpha, sizeof(__pyx_k_operation_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_operation_complete, __pyx_k_operation_complete, sizeof(__pyx_k_operation_complete), 0, 0, 1, 1},
  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  {&__pyx_n_s_os_path, __pyx_k_os_path, sizeof(__pyx_k_os_path), 0, 0, 1, 1},
  {&__pyx_n_s_over, __pyx_k_over, sizeof(__pyx_k_over), 0, 0, 1, 1},
  {&__pyx_n_s_pgrender, __pyx_k_pgrender, sizeof(__pyx_k_pgrender), 0, 0, 1, 1},
  {&__pyx_n_s_physical_size, __pyx_k_physical_size, sizeof(__pyx_k_physical_size), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_pixel, __pyx_k_pixel, sizeof(__pyx_k_pixel), 0, 0, 1, 1},
  {&__pyx_n_s_plog, __pyx_k_plog, sizeof(__pyx_k_plog), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_post_init, __pyx_k_post_init, sizeof(__pyx_k_post_init), 0, 0, 1, 1},
  {&__pyx_n_s_preferences, __pyx_k_preferences, sizeof(__pyx_k_preferences), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_kp_s_primary_display_bounds_r, __pyx_k_primary_display_bounds_r, sizeof(__pyx_k_primary_display_bounds_r), 0, 0, 1, 0},
  {&__pyx_n_s_pygame, __pyx_k_pygame, sizeof(__pyx_k_pygame), 0, 0, 1, 1},
  {&__pyx_n_s_pygame_sdl2, __pyx_k_pygame_sdl2, sizeof(__pyx_k_pygame_sdl2), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Environ, __pyx_k_pyx_unpickle_Environ, sizeof(__pyx_k_pyx_unpickle_Environ), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_GLDraw, __pyx_k_pyx_unpickle_GLDraw, sizeof(__pyx_k_pyx_unpickle_GLDraw), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_quit, __pyx_k_quit, sizeof(__pyx_k_quit), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_ready, __pyx_k_ready, sizeof(__pyx_k_ready), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_refresh_rate, __pyx_k_refresh_rate, sizeof(__pyx_k_refresh_rate), 0, 0, 1, 1},
  {&__pyx_n_s_render, __pyx_k_render, sizeof(__pyx_k_render), 0, 0, 1, 1},
  {&__pyx_n_s_render_movie, __pyx_k_render_movie, sizeof(__pyx_k_render_movie), 0, 0, 1, 1},
  {&__pyx_n_s_render_to_texture, __pyx_k_render_to_texture, sizeof(__pyx_k_render_to_texture), 0, 0, 1, 1},
  {&__pyx_n_s_render_to_texture_locals_draw_fu, __pyx_k_render_to_texture_locals_draw_fu, sizeof(__pyx_k_render_to_texture_locals_draw_fu), 0, 0, 1, 1},
  {&__pyx_n_s_renderer, __pyx_k_renderer, sizeof(__pyx_k_renderer), 0, 0, 1, 1},
  {&__pyx_n_s_renpy, __pyx_k_renpy, sizeof(__pyx_k_renpy), 0, 0, 1, 1},
  {&__pyx_n_s_renpy_gl_gldraw, __pyx_k_renpy_gl_gldraw, sizeof(__pyx_k_renpy_gl_gldraw), 0, 0, 1, 1},
  {&__pyx_n_s_req_ext, __pyx_k_req_ext, sizeof(__pyx_k_req_ext), 0, 0, 1, 1},
  {&__pyx_n_s_resizable, __pyx_k_resizable, sizeof(__pyx_k_resizable), 0, 0, 1, 1},
  {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_rgb, __pyx_k_rgb, sizeof(__pyx_k_rgb), 0, 0, 1, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_n_s_rtt, __pyx_k_rtt, sizeof(__pyx_k_rtt), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_n_s_screen_rect, __pyx_k_screen_rect, sizeof(__pyx_k_screen_rect), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_set_clip, __pyx_k_set_clip, sizeof(__pyx_k_set_clip), 0, 0, 1, 1},
  {&__pyx_n_s_set_mode, __pyx_k_set_mode, sizeof(__pyx_k_set_mode), 0, 0, 1, 1},
  {&__pyx_n_s_set_pos, __pyx_k_set_pos, sizeof(__pyx_k_set_pos), 0, 0, 1, 1},
  {&__pyx_n_s_set_rgba_masks, __pyx_k_set_rgba_masks, sizeof(__pyx_k_set_rgba_masks), 0, 0, 1, 1},
  {&__pyx_n_s_set_visible, __pyx_k_set_visible, sizeof(__pyx_k_set_visible), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shader, __pyx_k_shader, sizeof(__pyx_k_shader), 0, 0, 1, 1},
  {&__pyx_n_s_sleep, __pyx_k_sleep, sizeof(__pyx_k_sleep), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_kp_s_start_draw_screen, __pyx_k_start_draw_screen, sizeof(__pyx_k_start_draw_screen), 0, 0, 1, 0},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_subpixel, __pyx_k_subpixel, sizeof(__pyx_k_subpixel), 0, 0, 1, 1},
  {&__pyx_n_s_subsurface, __pyx_k_subsurface, sizeof(__pyx_k_subsurface), 0, 0, 1, 1},
  {&__pyx_n_s_surf, __pyx_k_surf, sizeof(__pyx_k_surf), 0, 0, 1, 1},
  {&__pyx_n_s_surface, __pyx_k_surface, sizeof(__pyx_k_surface), 0, 0, 1, 1},
  {&__pyx_n_s_surface_unscaled, __pyx_k_surface_unscaled, sizeof(__pyx_k_surface_unscaled), 0, 0, 1, 1},
  {&__pyx_n_s_surftree, __pyx_k_surftree, sizeof(__pyx_k_surftree), 0, 0, 1, 1},
  {&__pyx_kp_s_swap_interval_r_frames, __pyx_k_swap_interval_r_frames, sizeof(__pyx_k_swap_interval_r_frames), 0, 0, 1, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_test_texture_sizes, __pyx_k_test_texture_sizes, sizeof(__pyx_k_test_texture_sizes), 0, 0, 1, 1},
  {&__pyx_n_s_text_rect, __pyx_k_text_rect, sizeof(__pyx_k_text_rect), 0, 0, 1, 1},
  {&__pyx_n_s_texture, __pyx_k_texture, sizeof(__pyx_k_texture), 0, 0, 1, 1},
  {&__pyx_n_s_texture_count, __pyx_k_texture_count, sizeof(__pyx_k_texture_count), 0, 0, 1, 1},
  {&__pyx_n_s_texture_grid_from_drawing, __pyx_k_texture_grid_from_drawing, sizeof(__pyx_k_texture_grid_from_drawing), 0, 0, 1, 1},
  {&__pyx_n_s_texture_grid_from_surface, __pyx_k_texture_grid_from_surface, sizeof(__pyx_k_texture_grid_from_surface), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_total_texture_size, __pyx_k_total_texture_size, sizeof(__pyx_k_total_texture_size), 0, 0, 1, 1},
  {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1},
  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
  {&__pyx_n_s_translate_point, __pyx_k_translate_point, sizeof(__pyx_k_translate_point), 0, 0, 1, 1},
  {&__pyx_n_s_untranslate_point, __pyx_k_untranslate_point, sizeof(__pyx_k_untranslate_point), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_use_drawable_resolution, __pyx_k_use_drawable_resolution, sizeof(__pyx_k_use_drawable_resolution), 0, 0, 1, 1},
  {&__pyx_n_s_use_gl, __pyx_k_use_gl, sizeof(__pyx_k_use_gl), 0, 0, 1, 1},
  {&__pyx_n_s_use_gles, __pyx_k_use_gles, sizeof(__pyx_k_use_gles), 0, 0, 1, 1},
  {&__pyx_n_s_use_subsystem, __pyx_k_use_subsystem, sizeof(__pyx_k_use_subsystem), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_video, __pyx_k_video, sizeof(__pyx_k_video), 0, 0, 1, 1},
  {&__pyx_n_s_virtual_size, __pyx_k_virtual_size, sizeof(__pyx_k_virtual_size), 0, 0, 1, 1},
  {&__pyx_n_s_vsync, __pyx_k_vsync, sizeof(__pyx_k_vsync), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_weakref, __pyx_k_weakref, sizeof(__pyx_k_weakref), 0, 0, 1, 1},
  {&__pyx_n_s_what, __pyx_k_what, sizeof(__pyx_k_what), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_windows, __pyx_k_windows, sizeof(__pyx_k_windows), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xo, __pyx_k_xo, sizeof(__pyx_k_xo), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_yo, __pyx_k_yo, sizeof(__pyx_k_yo), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 1437, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 1541, __pyx_L1_error)
  __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(0, 268, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 753, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 1206, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "renpy/gl/gldraw.pyx":109
 * 
 *         # The (x, y) and texture of the software mouse.
 *         self.mouse_info = (0, 0, None)             # <<<<<<<<<<<<<<
 * 
 *         # This is used to cache the surface->texture operation.
 */
  __pyx_tuple_ = PyTuple_Pack(3, __pyx_int_0, __pyx_int_0, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "renpy/gl/gldraw.pyx":181
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_GL_Disabled); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "renpy/gl/gldraw.pyx":211
 *             renpy.display.interface.post_init()
 * 
 *         renpy.display.log.write("")             # <<<<<<<<<<<<<<
 * 
 *         self.virtual_size = virtual_size
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "renpy/gl/gldraw.pyx":241
 *         visible_h = info.current_h
 * 
 *         if renpy.windows and renpy.windows <= (6, 1):             # <<<<<<<<<<<<<<
 *             visible_h -= 102
 * 
 */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_int_6, __pyx_int_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "renpy/gl/gldraw.pyx":244
 *             visible_h -= 102
 * 
 *         bounds = pygame.display.get_display_bounds(0)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("primary display bounds: %r", bounds)
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "renpy/gl/gldraw.pyx":343
 *         if (self.window is None) and fullscreen:
 *             try:
 *                 renpy.display.log.write("Fullscreen mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)
 *             except pygame.error as e:
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Fullscreen_mode); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "renpy/gl/gldraw.pyx":344
 *             try:
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.WINDOW_FULLSCREEN_DESKTOP | resizable | opengl | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 *             except pygame.error as e:
 *                 renpy.display.log.write("Opening in fullscreen failed: %r", e)
 */
  __pyx_tuple__8 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "renpy/gl/gldraw.pyx":351
 *         if self.window is None:
 *             try:
 *                 renpy.display.log.write("Windowed mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF, **window_args)
 * 
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Windowed_mode); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "renpy/gl/gldraw.pyx":504
 * 
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")             # <<<<<<<<<<<<<<
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Shaders_are_blacklisted); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "renpy/gl/gldraw.pyx":506
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader and not allow_fixed:
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Fixed_function_is_blacklisted); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "renpy/gl/gldraw.pyx":509
 * 
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_GL_is_totally_blacklisted); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "renpy/gl/gldraw.pyx":529
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Extensions:")
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s__13); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "renpy/gl/gldraw.pyx":531
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.display.log.write("Extensions:")             # <<<<<<<<<<<<<<
 * 
 *         for i in sorted(extensions):
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Extensions); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "renpy/gl/gldraw.pyx":536
 *             renpy.display.log.write("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */
  __pyx_tuple__16 = PyTuple_Pack(6, __pyx_n_s_module, __pyx_n_s_envvar, __pyx_n_s_envval, __pyx_n_s_req_ext, __pyx_n_s_value, __pyx_n_s_i); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_use_subsystem, 536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 536, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":578
 * 
 *             try:
 *                 renpy.display.log.write("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Using_shader_environment); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "renpy/gl/gldraw.pyx":584
 * 
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.display.log.exception()
 *                 self.environ = None
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Initializing_shader_environment); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "renpy/gl/gldraw.pyx":597
 *                 "GL_ARB_texture_env_combine"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Using_fixed_function_environment); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "renpy/gl/gldraw.pyx":608
 *                 "GL_NV_texture_env_combine4"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Using_fixed_function_environment_2); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "renpy/gl/gldraw.pyx":619
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.display.log.write("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Using_limited_environment); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "renpy/gl/gldraw.pyx":625
 * 
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Can_t_find_a_workable_environmen); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "renpy/gl/gldraw.pyx":636
 * 
 *         if use_fbo:
 *             renpy.display.log.write("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Using_FBO_RTT); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "renpy/gl/gldraw.pyx":642
 * 
 *         elif glrtt_copy:
 *             renpy.display.log.write("Using copy RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_Using_copy_RTT); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "renpy/gl/gldraw.pyx":648
 * 
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Can_t_find_a_workable_rtt); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "renpy/gl/gldraw.pyx":757
 * 
 *             if not tex.ready:
 *                 tex.make_ready(False)             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
  __pyx_tuple__27 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "renpy/gl/gldraw.pyx":810
 *         """
 * 
 *         renpy.plog(1, "start draw_screen")             # <<<<<<<<<<<<<<
 * 
 *         if renpy.config.use_drawable_resolution:
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_int_1, __pyx_kp_s_start_draw_screen); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "renpy/gl/gldraw.pyx":859
 *             start = time.time()
 * 
 *             renpy.plog(1, "flip")             # <<<<<<<<<<<<<<
 * 
 *             if EGL:
 */
  __pyx_tuple__29 = PyTuple_Pack(2, __pyx_int_1, __pyx_n_s_flip); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "renpy/gl/gldraw.pyx":882
 *                     if (frame_times[-1] - frame_times[0] < .001 * 10):
 *                         time.sleep(1.0 / 120.0)
 *                         renpy.plog(1, "after broken vsync sleep")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__30 = PyTuple_Pack(2, __pyx_int_1, __pyx_kp_s_after_broken_vsync_sleep); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "renpy/gl/gldraw.pyx":935
 * 
 *             elif rend.operation == FLATTEN:
 *                 child.render_to_texture(True)             # <<<<<<<<<<<<<<
 * 
 *         if render_what:
 */
  __pyx_tuple__31 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "renpy/gl/gldraw.pyx":938
 * 
 *         if render_what:
 *             what.render_to_texture(True)             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_transformed(
 */
  __pyx_tuple__32 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "renpy/gl/gldraw.pyx":1028
 * 
 *             gltexture.imageblend(
 *                 rend.children[0][0].render_to_texture(True),             # <<<<<<<<<<<<<<
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),
 */
  __pyx_tuple__33 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "renpy/gl/gldraw.pyx":1072
 * 
 *             gltexture.blit(
 *                 rend.children[0][0].render_to_texture(True),             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
  __pyx_tuple__34 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "renpy/gl/gldraw.pyx":1089
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse * self.draw_to_virt, nearest, subpixel)
 *                 return 0
 */
  __pyx_tuple__35 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "renpy/gl/gldraw.pyx":1145
 *         height = int(math.ceil(what.height * self.draw_per_virt))
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */
  __pyx_tuple__36 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_w, __pyx_n_s_h, __pyx_n_s_clip); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_draw_func, 1145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 1145, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1189
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 * 
 *             self.clip_mode_rtt(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 *             clip = (0, 0, 1, 1)
 * 
 */
  __pyx_tuple__38 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "renpy/gl/gldraw.pyx":1190
 * 
 *             self.clip_mode_rtt(0, 0, 1, 1)
 *             clip = (0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 0.0)
 */
  __pyx_tuple__39 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "renpy/gl/gldraw.pyx":1185
 *         alpha_holder = [ 0 ]
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 *             self.environ.viewport(0, 0, 1, 1)
 *             self.environ.ortho(0, 1, 0, 1, -1, 1)
 */
  __pyx_tuple__40 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_w, __pyx_n_s_h, __pyx_n_s_clip, __pyx_n_s_pixel); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 1185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 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_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_draw_func, 1185, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 1185, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1229
 *             return what.half_cache
 * 
 *         reverse = Matrix2D(0.5, 0, 0, .5)             # <<<<<<<<<<<<<<
 * 
 *         width = max(what.width / 2, 1)
 */
  __pyx_tuple__42 = PyTuple_Pack(4, __pyx_float_0_5, __pyx_int_0, __pyx_int_0, __pyx_float__5); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 1229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "renpy/gl/gldraw.pyx":1234
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */
  __pyx_tuple__43 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_w, __pyx_n_s_h, __pyx_n_s_clip); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_draw_func, 1234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 1234, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1456
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 *     def get_size_limit(self, dimension):
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_Not_implemented); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "renpy/gl/gldraw.pyx":1463
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_Not_implemented); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "renpy/gl/gldraw.pyx":1437
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_tuple__47 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "renpy/gl/gldraw.pyx":1442
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_init, 1442, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1442, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1445
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_deinit, 1445, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1445, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1448
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */
  __pyx_tuple__52 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_texture, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_w, __pyx_n_s_h, __pyx_n_s_draw_func); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_render, 1448, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 1448, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":1458
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */
  __pyx_tuple__54 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_dimension); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 1458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_gl_gldr, __pyx_n_s_get_size_limit, 1458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 1458, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x9a81390:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_tuple__56 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);
  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_GLDraw, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Environ, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyList_Type_pop.type = (PyObject*)&PyList_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float__5 = PyFloat_FromDouble(.5); if (unlikely(!__pyx_float__5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_60 = PyInt_FromLong(60); if (unlikely(!__pyx_int_60)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_102 = PyInt_FromLong(102); if (unlikely(!__pyx_int_102)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_162010000 = PyInt_FromLong(162010000L); if (unlikely(!__pyx_int_162010000)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initgldraw(void); /*proto*/
PyMODINIT_FUNC initgldraw(void)
#else
PyMODINIT_FUNC PyInit_gldraw(void); /*proto*/
PyMODINIT_FUNC PyInit_gldraw(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static int __pyx_pymod_exec_gldraw(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  #endif
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_gldraw(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("gldraw", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_renpy__gl__gldraw) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "renpy.gl.gldraw")) {
      if (unlikely(PyDict_SetItemString(modules, "renpy.gl.gldraw", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  __pyx_v_5renpy_2gl_6gldraw_IDENTITY = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_5renpy_2gl_6gldraw_Environ = &__pyx_vtable_5renpy_2gl_6gldraw_Environ;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.blit = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *))__pyx_f_5renpy_2gl_6gldraw_7Environ_blit;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.blend = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double))__pyx_f_5renpy_2gl_6gldraw_7Environ_blend;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.imageblend = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, int))__pyx_f_5renpy_2gl_6gldraw_7Environ_imageblend;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_vertex = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, float *))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_vertex;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_texture = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, float *))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_texture;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_color = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, double, double, double))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_color;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_clip = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, PyObject *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_clip;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.unset_clip = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *))__pyx_f_5renpy_2gl_6gldraw_7Environ_unset_clip;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.ortho = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, double, double, double, double, double))__pyx_f_5renpy_2gl_6gldraw_7Environ_ortho;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.viewport = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int, int, int))__pyx_f_5renpy_2gl_6gldraw_7Environ_viewport;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw_Environ) < 0) __PYX_ERR(0, 1466, __pyx_L1_error)
  __pyx_type_5renpy_2gl_6gldraw_Environ.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5renpy_2gl_6gldraw_Environ.tp_dict, __pyx_vtabptr_5renpy_2gl_6gldraw_Environ) < 0) __PYX_ERR(0, 1466, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Environ", (PyObject *)&__pyx_type_5renpy_2gl_6gldraw_Environ) < 0) __PYX_ERR(0, 1466, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5renpy_2gl_6gldraw_Environ) < 0) __PYX_ERR(0, 1466, __pyx_L1_error)
  __pyx_ptype_5renpy_2gl_6gldraw_Environ = &__pyx_type_5renpy_2gl_6gldraw_Environ;
  __pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw = &__pyx_vtable_5renpy_2gl_6gldraw_GLDraw;
  __pyx_vtable_5renpy_2gl_6gldraw_GLDraw.set_clip = (PyObject *(*)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5renpy_2gl_6gldraw_6GLDraw_set_clip;
  __pyx_vtable_5renpy_2gl_6gldraw_GLDraw.draw_render_textures = (int (*)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch))__pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_render_textures;
  __pyx_vtable_5renpy_2gl_6gldraw_GLDraw.draw_transformed = (int (*)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, int, int, int __pyx_skip_dispatch))__pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_transformed;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw_GLDraw) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
  __pyx_type_5renpy_2gl_6gldraw_GLDraw.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5renpy_2gl_6gldraw_GLDraw.tp_dict, __pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "GLDraw", (PyObject *)&__pyx_type_5renpy_2gl_6gldraw_GLDraw) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5renpy_2gl_6gldraw_GLDraw) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
  __pyx_ptype_5renpy_2gl_6gldraw_GLDraw = &__pyx_type_5renpy_2gl_6gldraw_GLDraw;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init) < 0) __PYX_ERR(0, 475, __pyx_L1_error)
  __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init.tp_print = 0;
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct__init = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture) < 0) __PYX_ERR(0, 1140, __pyx_L1_error)
  __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture.tp_print = 0;
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque) < 0) __PYX_ERR(0, 1171, __pyx_L1_error)
  __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque.tp_print = 0;
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_is_pixel_opaque;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half) < 0) __PYX_ERR(0, 1218, __pyx_L1_error)
  __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half.tp_print = 0;
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_3_get_half;
  /*--- Type import code ---*/
  __pyx_ptype_5renpy_7display_6matrix_Matrix = __Pyx_ImportType("renpy.display.matrix", "Matrix", sizeof(struct __pyx_obj_5renpy_7display_6matrix_Matrix), 1); if (unlikely(!__pyx_ptype_5renpy_7display_6matrix_Matrix)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_vtabptr_5renpy_7display_6matrix_Matrix = (struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6matrix_Matrix->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6matrix_Matrix)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_ptype_5renpy_7display_6matrix_Matrix2D = __Pyx_ImportType("renpy.display.matrix", "Matrix2D", sizeof(struct __pyx_obj_5renpy_7display_6matrix_Matrix2D), 1); if (unlikely(!__pyx_ptype_5renpy_7display_6matrix_Matrix2D)) __PYX_ERR(3, 43, __pyx_L1_error)
  __pyx_vtabptr_5renpy_7display_6matrix_Matrix2D = (struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix2D*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6matrix_Matrix2D->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6matrix_Matrix2D)) __PYX_ERR(3, 43, __pyx_L1_error)
  __pyx_ptype_5renpy_7display_6render_Render = __Pyx_ImportType("renpy.display.render", "Render", sizeof(struct __pyx_obj_5renpy_7display_6render_Render), 1); if (unlikely(!__pyx_ptype_5renpy_7display_6render_Render)) __PYX_ERR(4, 25, __pyx_L1_error)
  __pyx_vtabptr_5renpy_7display_6render_Render = (struct __pyx_vtabstruct_5renpy_7display_6render_Render*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6render_Render->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6render_Render)) __PYX_ERR(4, 25, __pyx_L1_error)
  __pyx_ptype_5renpy_2gl_9gltexture_TextureCore = __Pyx_ImportType("renpy.gl.gltexture", "TextureCore", sizeof(struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore), 1); if (unlikely(!__pyx_ptype_5renpy_2gl_9gltexture_TextureCore)) __PYX_ERR(5, 26, __pyx_L1_error)
  __pyx_vtabptr_5renpy_2gl_9gltexture_TextureCore = (struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureCore*)__Pyx_GetVtable(__pyx_ptype_5renpy_2gl_9gltexture_TextureCore->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_2gl_9gltexture_TextureCore)) __PYX_ERR(5, 26, __pyx_L1_error)
  __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid = __Pyx_ImportType("renpy.gl.gltexture", "TextureGrid", sizeof(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid), 1); if (unlikely(!__pyx_ptype_5renpy_2gl_9gltexture_TextureGrid)) __PYX_ERR(5, 52, __pyx_L1_error)
  __pyx_vtabptr_5renpy_2gl_9gltexture_TextureGrid = (struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureGrid*)__Pyx_GetVtable(__pyx_ptype_5renpy_2gl_9gltexture_TextureGrid->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_2gl_9gltexture_TextureGrid)) __PYX_ERR(5, 52, __pyx_L1_error)
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("renpy.gl.gl"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glBlendFunc", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glBlendFunc, "int (GLenum, GLenum)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glClear", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glClear, "int (GLbitfield)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glClearColor", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glClearColor, "int (GLclampf, GLclampf, GLclampf, GLclampf)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glEnable", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glEnable, "int (GLenum)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glFinish", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glFinish, "int (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glGetIntegerv", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glGetIntegerv, "int (GLenum, GLint *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glGetString", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glGetString, "GLchar *(GLenum)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "glReadPixels", (void (**)(void))&__pyx_f_5renpy_2gl_2gl_glReadPixels, "int (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLubyte *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_ImportModule("renpy.gl.gltexture"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_2, "blit", (void (**)(void))&__pyx_f_5renpy_2gl_9gltexture_blit, "PyObject *(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, double, double, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_2, "blend", (void (**)(void))&__pyx_f_5renpy_2gl_9gltexture_blend, "PyObject *(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, double, double, double, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_2, "imageblend", (void (**)(void))&__pyx_f_5renpy_2gl_9gltexture_imageblend, "PyObject *(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6matrix_Matrix *, double, double, double, int, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "renpy/gl/gldraw.pyx":33
 * 
 * from pygame_sdl2 cimport *
 * import_pygame_sdl2()             # <<<<<<<<<<<<<<
 * 
 * import renpy
 */
  import_pygame_sdl2();

  /* "renpy/gl/gldraw.pyx":35
 * import_pygame_sdl2()
 * 
 * import renpy             # <<<<<<<<<<<<<<
 * import pygame_sdl2 as pygame
 * import os
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_renpy, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_renpy, __pyx_t_3) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":36
 * 
 * import renpy
 * import pygame_sdl2 as pygame             # <<<<<<<<<<<<<<
 * import os
 * import os.path
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_sdl2, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pygame, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":37
 * import renpy
 * import pygame_sdl2 as pygame
 * import os             # <<<<<<<<<<<<<<
 * import os.path
 * import weakref
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_3) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":38
 * import pygame_sdl2 as pygame
 * import os
 * import os.path             # <<<<<<<<<<<<<<
 * import weakref
 * import array
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_os_path, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_3) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":39
 * import os
 * import os.path
 * import weakref             # <<<<<<<<<<<<<<
 * import array
 * import time
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_weakref, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_weakref, __pyx_t_3) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":40
 * import os.path
 * import weakref
 * import array             # <<<<<<<<<<<<<<
 * import time
 * import math
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_array, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":41
 * import weakref
 * import array
 * import time             # <<<<<<<<<<<<<<
 * import math
 * 
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_3) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":42
 * import array
 * import time
 * import math             # <<<<<<<<<<<<<<
 * 
 * cimport renpy.display.render as render
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":46
 * cimport renpy.display.render as render
 * cimport gltexture
 * import gltexture             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_gltexture, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gltexture, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":65
 * # EGL is a flag we check to see if we have EGL on this platform.
 * cdef bint EGL
 * EGL = egl_available()             # <<<<<<<<<<<<<<
 * 
 * # Cache various externals, so we can use them more efficiently.
 */
  __pyx_v_5renpy_2gl_6gldraw_EGL = egl_available();

  /* "renpy/gl/gldraw.pyx":69
 * # Cache various externals, so we can use them more efficiently.
 * cdef int DISSOLVE, IMAGEDISSOLVE, PIXELLATE, FLATTEN
 * DISSOLVE = renpy.display.render.DISSOLVE             # <<<<<<<<<<<<<<
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_render); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DISSOLVE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_5renpy_2gl_6gldraw_DISSOLVE = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":70
 * cdef int DISSOLVE, IMAGEDISSOLVE, PIXELLATE, FLATTEN
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE             # <<<<<<<<<<<<<<
 * PIXELLATE = renpy.display.render.PIXELLATE
 * FLATTEN  = renpy.display.render.FLATTEN
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_render); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_IMAGEDISSOLVE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":71
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE             # <<<<<<<<<<<<<<
 * FLATTEN  = renpy.display.render.FLATTEN
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_render); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PIXELLATE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_5renpy_2gl_6gldraw_PIXELLATE = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":72
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE
 * FLATTEN  = renpy.display.render.FLATTEN             # <<<<<<<<<<<<<<
 * 
 * cdef object IDENTITY
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_render); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_FLATTEN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_5renpy_2gl_6gldraw_FLATTEN = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":75
 * 
 * cdef object IDENTITY
 * IDENTITY = renpy.display.render.IDENTITY             # <<<<<<<<<<<<<<
 * 
 * # Should we try to vsync?
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_render); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_XGOTREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __Pyx_DECREF_SET(__pyx_v_5renpy_2gl_6gldraw_IDENTITY, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":78
 * 
 * # Should we try to vsync?
 * vsync = True             # <<<<<<<<<<<<<<
 * 
 * # A list of frame end times, used for the same purpose.
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vsync, Py_True) < 0) __PYX_ERR(0, 78, __pyx_L1_error)

  /* "renpy/gl/gldraw.pyx":81
 * 
 * # A list of frame end times, used for the same purpose.
 * frame_times = [ ]             # <<<<<<<<<<<<<<
 * 
 * cdef class GLDraw:
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_frame_times, __pyx_t_4) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1437
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__47); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_tuple__47, __pyx_n_s_Rtt, __pyx_n_s_Rtt, (PyObject *) NULL, __pyx_n_s_renpy_gl_gldraw, __pyx_kp_s_Subclasses_of_this_class_handle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "renpy/gl/gldraw.pyx":1442
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_1init, 0, __pyx_n_s_Rtt_init, NULL, __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 1442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1445
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_3deinit, 0, __pyx_n_s_Rtt_deinit, NULL, __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_deinit, __pyx_t_6) < 0) __PYX_ERR(0, 1445, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1448
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_5render, 0, __pyx_n_s_Rtt_render, NULL, __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_render, __pyx_t_6) < 0) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1458
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */
  __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_7get_size_limit, 0, __pyx_n_s_Rtt_get_size_limit, NULL, __pyx_n_s_renpy_gl_gldraw, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_get_size_limit, __pyx_t_6) < 0) __PYX_ERR(0, 1458, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1437
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_Rtt, __pyx_tuple__47, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Rtt, __pyx_t_6) < 0) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1530
 * # These imports need to be down at the bottom, after the Rtt and Environ
 * # classes have been created.
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_copy
 * except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1531
 * # classes have been created.
 * try:
 *     import glrtt_copy             # <<<<<<<<<<<<<<
 * except:
 *     glrtt_copy = None
 */
      __pyx_t_4 = __Pyx_Import(__pyx_n_s_glrtt_copy, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1531, __pyx_L2_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glrtt_copy, __pyx_t_4) < 0) __PYX_ERR(0, 1531, __pyx_L2_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":1530
 * # These imports need to be down at the bottom, after the Rtt and Environ
 * # classes have been created.
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_copy
 * except:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L7_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":1532
 * try:
 *     import glrtt_copy
 * except:             # <<<<<<<<<<<<<<
 *     glrtt_copy = None
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_6) < 0) __PYX_ERR(0, 1532, __pyx_L4_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_6);

      /* "renpy/gl/gldraw.pyx":1533
 *     import glrtt_copy
 * except:
 *     glrtt_copy = None             # <<<<<<<<<<<<<<
 * 
 * # Copy doesn't work on iOS.
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glrtt_copy, Py_None) < 0) __PYX_ERR(0, 1533, __pyx_L4_except_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;

    /* "renpy/gl/gldraw.pyx":1530
 * # These imports need to be down at the bottom, after the Rtt and Environ
 * # classes have been created.
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_copy
 * except:
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L7_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1536
 * 
 * # Copy doesn't work on iOS.
 * if renpy.ios:             # <<<<<<<<<<<<<<
 *     glrtt_copy = None
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ios); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_10) {

    /* "renpy/gl/gldraw.pyx":1537
 * # Copy doesn't work on iOS.
 * if renpy.ios:
 *     glrtt_copy = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_glrtt_copy, Py_None) < 0) __PYX_ERR(0, 1537, __pyx_L1_error)

    /* "renpy/gl/gldraw.pyx":1536
 * 
 * # Copy doesn't work on iOS.
 * if renpy.ios:             # <<<<<<<<<<<<<<
 *     glrtt_copy = None
 * 
 */
  }

  /* "renpy/gl/gldraw.pyx":1539
 *     glrtt_copy = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_fbo
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1540
 * 
 * try:
 *     import glrtt_fbo             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glrtt_fbo = None
 */
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_glrtt_fbo, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1540, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glrtt_fbo, __pyx_t_3) < 0) __PYX_ERR(0, 1540, __pyx_L11_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":1539
 *     glrtt_copy = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_fbo
 * except ImportError:
 */
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L16_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":1541
 * try:
 *     import glrtt_fbo
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glrtt_fbo = None
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_6, &__pyx_t_4) < 0) __PYX_ERR(0, 1541, __pyx_L13_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_4);

      /* "renpy/gl/gldraw.pyx":1542
 *     import glrtt_fbo
 * except ImportError:
 *     glrtt_fbo = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glrtt_fbo, Py_None) < 0) __PYX_ERR(0, 1542, __pyx_L13_except_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L12_exception_handled;
    }
    goto __pyx_L13_except_error;
    __pyx_L13_except_error:;

    /* "renpy/gl/gldraw.pyx":1539
 *     glrtt_copy = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_fbo
 * except ImportError:
 */
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    __pyx_L16_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1544
 *     glrtt_fbo = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_fixed
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1545
 * 
 * try:
 *     import glenviron_fixed             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_fixed = None
 */
      __pyx_t_4 = __Pyx_Import(__pyx_n_s_glenviron_fixed, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1545, __pyx_L19_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glenviron_fixed, __pyx_t_4) < 0) __PYX_ERR(0, 1545, __pyx_L19_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":1544
 *     glrtt_fbo = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_fixed
 * except ImportError:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L24_try_end;
    __pyx_L19_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":1546
 * try:
 *     import glenviron_fixed
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_fixed = None
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_3) < 0) __PYX_ERR(0, 1546, __pyx_L21_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_3);

      /* "renpy/gl/gldraw.pyx":1547
 *     import glenviron_fixed
 * except ImportError:
 *     glenviron_fixed = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glenviron_fixed, Py_None) < 0) __PYX_ERR(0, 1547, __pyx_L21_except_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L20_exception_handled;
    }
    goto __pyx_L21_except_error;
    __pyx_L21_except_error:;

    /* "renpy/gl/gldraw.pyx":1544
 *     glrtt_fbo = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_fixed
 * except ImportError:
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L20_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L24_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1549
 *     glenviron_fixed = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_shader
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1550
 * 
 * try:
 *     import glenviron_shader             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_shader = None
 */
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_glenviron_shader, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1550, __pyx_L27_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glenviron_shader, __pyx_t_3) < 0) __PYX_ERR(0, 1550, __pyx_L27_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":1549
 *     glenviron_fixed = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_shader
 * except ImportError:
 */
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L32_try_end;
    __pyx_L27_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":1551
 * try:
 *     import glenviron_shader
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_shader = None
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_6, &__pyx_t_4) < 0) __PYX_ERR(0, 1551, __pyx_L29_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_4);

      /* "renpy/gl/gldraw.pyx":1552
 *     import glenviron_shader
 * except ImportError:
 *     glenviron_shader = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glenviron_shader, Py_None) < 0) __PYX_ERR(0, 1552, __pyx_L29_except_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L28_exception_handled;
    }
    goto __pyx_L29_except_error;
    __pyx_L29_except_error:;

    /* "renpy/gl/gldraw.pyx":1549
 *     glenviron_fixed = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_shader
 * except ImportError:
 */
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L28_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    __pyx_L32_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1554
 *     glenviron_shader = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_limited
 * except ImportError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1555
 * 
 * try:
 *     import glenviron_limited             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_limited = None
 */
      __pyx_t_4 = __Pyx_Import(__pyx_n_s_glenviron_limited, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1555, __pyx_L35_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glenviron_limited, __pyx_t_4) < 0) __PYX_ERR(0, 1555, __pyx_L35_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":1554
 *     glenviron_shader = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_limited
 * except ImportError:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L40_try_end;
    __pyx_L35_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":1556
 * try:
 *     import glenviron_limited
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_limited = None
 * 
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_3) < 0) __PYX_ERR(0, 1556, __pyx_L37_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_3);

      /* "renpy/gl/gldraw.pyx":1557
 *     import glenviron_limited
 * except ImportError:
 *     glenviron_limited = None             # <<<<<<<<<<<<<<
 * 
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_glenviron_limited, Py_None) < 0) __PYX_ERR(0, 1557, __pyx_L37_except_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L36_exception_handled;
    }
    goto __pyx_L37_except_error;
    __pyx_L37_except_error:;

    /* "renpy/gl/gldraw.pyx":1554
 *     glenviron_shader = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_limited
 * except ImportError:
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L36_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L40_try_end:;
  }

  /* "(tree fragment)":1
 * def __pyx_unpickle_GLDraw(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x9a81390:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_1__pyx_unpickle_GLDraw, NULL, __pyx_n_s_renpy_gl_gldraw); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_GLDraw, __pyx_t_3) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":9
 *         __pyx_unpickle_GLDraw__set_state(<GLDraw> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_GLDraw__set_state(GLDraw __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.allow_fixed = __pyx_state[0]; __pyx_result.clip_cache = __pyx_state[1]; __pyx_result.clip_rtt_box = __pyx_state[2]; __pyx_result.default_clip = __pyx_state[3]; __pyx_result.did_init = __pyx_state[4]; __pyx_result.did_render_to_texture = __pyx_state[5]; __pyx_result.did_texture_test = __pyx_state[6]; __pyx_result.display_info = __pyx_state[7]; __pyx_result.dpi_scale = __pyx_state[8]; __pyx_result.draw_per_virt = __pyx_state[9]; __pyx_result.draw_to_virt = __pyx_state[10]; __pyx_result.drawable_size = __pyx_state[11]; __pyx_result.environ = __pyx_state[12]; __pyx_result.fast_dissolve = __pyx_state[13]; __pyx_result.fast_redraw_frames = __pyx_state[14]; __pyx_result.fullscreen_surface = __pyx_state[15]; __pyx_result.info = __pyx_state[16]; __pyx_result.last_redraw_time = __pyx_state[17]; __pyx_result.mouse_info = __pyx_state[18]; __pyx_result.mouse_old_visible = __pyx_state[19]; __pyx_result.old_fullscreen = __pyx_state[20]; __pyx_result.physical_box = __pyx_state[21]; __pyx_result.physical_size = __pyx_state[22]; __pyx_result.ready_texture_queue = __pyx_state[23]; __pyx_result.redraw_period = __pyx_state[24]; __pyx_result.rtt = __pyx_state[25]; __pyx_result.texture_cache = __pyx_state[26]; __pyx_result.virt_to_draw = __pyx_state[27]; __pyx_result.virtual_box = __pyx_state[28]; __pyx_result.virtual_size = __pyx_state[29]; __pyx_result.window = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3__pyx_unpickle_Environ, NULL, __pyx_n_s_renpy_gl_gldraw); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Environ, __pyx_t_3) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * #@PydevCodeAnalysisIgnore
 * # Copyright 2004-2019 Tom Rothamel <pytom@bishoujo.us>
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/matrix.pxd":37
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init renpy.gl.gldraw", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init renpy.gl.gldraw");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* GetModuleGlobalName */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* PyCFunctionFastCall */
  #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
  #if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallMethO */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallNoArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* RaiseTooManyValuesToUnpack */
    static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
    static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
    static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
    static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* PyIntBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* GetItemInt */
    static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* SaveResetException */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if PY_VERSION_HEX >= 0x030700A2
    *type = tstate->exc_state.exc_type;
    *value = tstate->exc_state.exc_value;
    *tb = tstate->exc_state.exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = type;
    tstate->exc_state.exc_value = value;
    tstate->exc_state.exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
    #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
    #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = local_type;
    tstate->exc_state.exc_value = local_value;
    tstate->exc_state.exc_traceback = local_tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyFloatBinop */
      #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyFloatBinop */
        #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double a = floatval;
    double b, result;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* None */
          static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* FetchCommonType */
          static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
          static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* ExtTypeTest */
              static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyObjectCallMethod0 */
              static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *function = PyMethod_GET_FUNCTION(method);
            result = __Pyx_PyObject_CallOneArg(function, self);
            Py_DECREF(method);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* UnpackUnboundCMethod */
              static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
              static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* pop */
              static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
    if (Py_TYPE(L) == &PySet_Type) {
        return PySet_Pop(L);
    }
    return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
    if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
        Py_SIZE(L) -= 1;
        return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
    }
    return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyList_Type_pop, L);
}
#endif

/* PyIntBinop */
              #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* ArgTypeTest */
              static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* PyObjectCallMethod1 */
              static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = NULL;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
    goto done;
done:
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto done;
    result = __Pyx__PyObject_CallMethod1(method, arg);
done:
    Py_XDECREF(method);
    return result;
}

/* append */
              static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* pop_index */
              static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix) {
    PyObject *r;
    if (unlikely(!py_ix)) return NULL;
    r = __Pyx__PyObject_PopIndex(L, py_ix);
    Py_DECREF(py_ix);
    return r;
}
static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix) {
    return __Pyx_PyObject_CallMethod1(L, __pyx_n_s_pop, py_ix);
}
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix) {
    Py_ssize_t size = PyList_GET_SIZE(L);
    if (likely(size > (((PyListObject*)L)->allocated >> 1))) {
        Py_ssize_t cix = ix;
        if (cix < 0) {
            cix += size;
        }
        if (likely(0 <= cix && cix < size)) {
            PyObject* v = PyList_GET_ITEM(L, cix);
            Py_SIZE(L) -= 1;
            size -= 1;
            memmove(&PyList_GET_ITEM(L, cix), &PyList_GET_ITEM(L, cix+1), (size_t)(size-cix)*sizeof(PyObject*));
            return v;
        }
    }
    if (py_ix == Py_None) {
        return __Pyx__PyObject_PopNewIndex(L, PyInt_FromSsize_t(ix));
    } else {
        return __Pyx__PyObject_PopIndex(L, py_ix);
    }
}
#endif

/* PyErrFetchRestore */
              #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
              #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* RaiseNoneIterError */
              static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* SetItemInt */
              static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* GetAttr */
                static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
                static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* Import */
                static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
                static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* HasAttr */
                static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* SetVTable */
                static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* SetupReduce */
                static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* GetVTable */
                static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* CalculateMetaclass */
                static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
                static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module_2, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback */
                #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
      use_cline = PyDict_GetItem(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (PyObject_Not(use_cline) != 0) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
                static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
                #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
                #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_GLint(GLint value) {
    const GLint neg_one = (GLint) -1, const_zero = (GLint) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(GLint) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(GLint) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(GLint) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(GLint) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(GLint) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(GLint),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
                static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) {
    const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
                static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
                static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
                #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
                static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* ModuleImport */
                #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* TypeImport */
                #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

/* FunctionImport */
                #ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* InitStrings */
                static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            PyErr_Clear();
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
